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:
@@ -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 ) {
|
// panel.clearContent();
|
||||||
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ;
|
// panel.addContent ( txt );
|
||||||
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){
|
return false;
|
||||||
|
|
||||||
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 );
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showHideFilterForm( divName)
|
function showHideFilterForm(divName) {
|
||||||
{
|
if (document.getElementById(divName).style.display === 'none')
|
||||||
if (document.getElementById( divName ).style.display==='none')
|
document.getElementById(divName).style.display = '';
|
||||||
document.getElementById( divName).style.display = '';
|
else
|
||||||
else
|
document.getElementById(divName).style.display = 'none';
|
||||||
document.getElementById( divName).style.display = 'none';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function newHoliday(ev) {
|
function newHoliday(ev) {
|
||||||
var coor = leimnud.dom.mouse(ev);
|
var coor = leimnud.dom.mouse(ev);
|
||||||
var myPanel=new leimnud.module.panel();
|
var myPanel = new leimnud.module.panel();
|
||||||
myPanel.options={
|
myPanel.options = {
|
||||||
size:{w:500,h:200},
|
size : {
|
||||||
position:{x:coor.x-200,y:coor.y},
|
w : 500,
|
||||||
title:"New Holiday",
|
h : 200
|
||||||
theme:"panel",
|
},
|
||||||
control:{
|
position : {
|
||||||
close:true,
|
x : coor.x - 200,
|
||||||
drag:true
|
y : coor.y
|
||||||
},
|
},
|
||||||
fx: { modal:true }
|
title : "New Holiday",
|
||||||
};
|
theme : "panel",
|
||||||
|
control : {
|
||||||
myPanel.make();
|
close : true,
|
||||||
|
drag : true
|
||||||
|
},
|
||||||
|
fx : {
|
||||||
|
modal : true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var r = new leimnud.module.rpc.xmlhttp({url:"holidayNew.php"});
|
myPanel.make();
|
||||||
r.callback=leimnud.closure({Function:function(rpc){
|
|
||||||
myPanel.addContent(rpc.xmlhttp.responseText);
|
var r = new leimnud.module.rpc.xmlhttp({
|
||||||
},args:r})
|
url : "holidayNew.php"
|
||||||
r.make();
|
});
|
||||||
|
r.callback = leimnud.closure({
|
||||||
|
Function : function(rpc) {
|
||||||
|
myPanel.addContent(rpc.xmlhttp.responseText);
|
||||||
|
},
|
||||||
|
args : r
|
||||||
|
})
|
||||||
|
r.make();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteHoliday( uid ) {
|
function deleteHoliday(uid) {
|
||||||
url = "setupAjax.php?action=deleteHoliday&uid=" + uid;
|
url = "setupAjax.php?action=deleteHoliday&uid=" + uid;
|
||||||
var r = new leimnud.module.rpc.xmlhttp({url: url });
|
var r = new leimnud.module.rpc.xmlhttp({
|
||||||
r.callback=leimnud.closure({Function:function(rpc){
|
url : url
|
||||||
//myPanel.addContent(rpc.xmlhttp.responseText);
|
});
|
||||||
myPanel = setupPanel.panels.control;
|
r.callback = leimnud.closure({
|
||||||
myPanel.tabLastSelected=false;
|
Function : function(rpc) {
|
||||||
myPanel.tabSelected=0;
|
// myPanel.addContent(rpc.xmlhttp.responseText);
|
||||||
myPanel.makeTab();
|
myPanel = setupPanel.panels.control;
|
||||||
|
myPanel.tabLastSelected = false;
|
||||||
|
myPanel.tabSelected = 0;
|
||||||
|
myPanel.makeTab();
|
||||||
|
|
||||||
|
},
|
||||||
|
args : r
|
||||||
|
})
|
||||||
|
r.make();
|
||||||
|
|
||||||
|
// myPanel.clearContent();
|
||||||
|
// myPanel.addContent ( uid );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
},args:r})
|
|
||||||
r.make();
|
|
||||||
|
|
||||||
|
|
||||||
// myPanel.clearContent();
|
|
||||||
// myPanel.addContent ( uid );
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -12,76 +12,71 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* New Admin User interface
|
* New Admin User interface
|
||||||
|
*
|
||||||
* @author Erik A. O. <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. O. <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
* @date Apr 5th, 2010
|
* @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_MAIN_MENU = "processmaker";
|
||||||
$G_ID_MENU_SELECTED = "SETUP";
|
$G_ID_MENU_SELECTED = "SETUP";
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
global $G_TMP_MENU;
|
global $G_TMP_MENU;
|
||||||
$oMenu = new Menu();
|
$oMenu = new Menu();
|
||||||
$oMenu->load('setup');
|
$oMenu->load( 'setup' );
|
||||||
$toolItems = Array();
|
$toolItems = Array ();
|
||||||
|
|
||||||
foreach( $oMenu->Options as $i=>$option) {
|
foreach ($oMenu->Options as $i => $option) {
|
||||||
$toolItems[] = Array(
|
$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'
|
||||||
'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 = new TemplatePower( PATH_TPL . 'setup' . PATH_SEP . 'tools.html' );
|
||||||
$template->prepare();
|
$template->prepare();
|
||||||
|
|
||||||
$template->assign ('LeftWidth', '230');
|
$template->assign( 'LeftWidth', '230' );
|
||||||
$template->assign ('contentHeight', '520');
|
$template->assign( 'contentHeight', '520' );
|
||||||
|
|
||||||
if( isset($_GET['i18']) ){
|
if (isset( $_GET['i18'] )) {
|
||||||
$_SESSION['TOOLS_VIEWTYPE'] = true;
|
$_SESSION['TOOLS_VIEWTYPE'] = true;
|
||||||
$template->assign ('displayLanguageTool', 'block');
|
$template->assign( 'displayLanguageTool', 'block' );
|
||||||
} else {
|
} else {
|
||||||
$template->assign ('displayLanguageTool', 'none');
|
$template->assign( 'displayLanguageTool', 'none' );
|
||||||
}
|
}
|
||||||
if( isset($_GET['newSite']) ){
|
if (isset( $_GET['newSite'] )) {
|
||||||
$template->assign ('displayNewSiteTool', 'block');
|
$template->assign( 'displayNewSiteTool', 'block' );
|
||||||
} else {
|
} else {
|
||||||
$template->assign ('displayNewSiteTool', 'none');
|
$template->assign( 'displayNewSiteTool', 'none' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($toolItems as $item) {
|
||||||
foreach($toolItems as $item) {
|
$template->newBlock( 'tool_options' );
|
||||||
$template->newBlock( 'tool_options');
|
foreach ($item as $propertyName => $propertyValue)
|
||||||
foreach($item as $propertyName=>$propertyValue)
|
$template->assign( $propertyName, $propertyValue );
|
||||||
$template->assign ($propertyName, $propertyValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$G_PUBLISH->AddContent('template', '', '', '', $template );
|
$G_PUBLISH->AddContent( 'template', '', '', '', $template );
|
||||||
G::RenderPage('publish');
|
G::RenderPage( 'publish' );
|
||||||
if(isset($_GET['module'])){
|
if (isset( $_GET['module'] )) {
|
||||||
|
|
||||||
print "
|
print "
|
||||||
<script>
|
<script>
|
||||||
admToolsContent.location='".$_GET['module']."';
|
admToolsContent.location='" . $_GET['module'] . "';
|
||||||
</script>
|
</script>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* setupAjax.php
|
* setupAjax.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,30 +12,30 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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)
|
||||||
//$oSMTPJSON = new Services_JSON();
|
return $RBAC_Response;
|
||||||
//$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data']));
|
//$oSMTPJSON = new Services_JSON();
|
||||||
//$sOutput = '';
|
//$oSMTPData = $oSMTPJSON->decode(stripslashes($_POST['data']));
|
||||||
G::LoadClass('setup');
|
//$sOutput = '';
|
||||||
|
G::LoadClass( 'setup' );
|
||||||
|
|
||||||
$oSMTPSetup = new Setup(new DBConnection);
|
$oSMTPSetup = new Setup( new DBConnection() );
|
||||||
|
|
||||||
$action = strtolower ( $_GET['action'] );
|
$action = strtolower( $_GET['action'] );
|
||||||
$data = $_GET;
|
$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 );
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@@ -12,105 +12,104 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
// if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response;
|
// if (($RBAC_Response = $RBAC->userCanAccess("PM_CASES"))!=1) return $RBAC_Response;
|
||||||
|
|
||||||
$idDecode64 = base64_decode($_GET['id']);
|
|
||||||
$idExploded = explode( '/', $idDecode64 );
|
$idDecode64 = base64_decode( $_GET['id'] );
|
||||||
if ( $idExploded[0] == '' ) array_shift($idExploded);
|
$idExploded = explode( '/', $idDecode64 );
|
||||||
if ( $idExploded[0] == 'plugin' ) {
|
if ($idExploded[0] == '')
|
||||||
|
array_shift( $idExploded );
|
||||||
|
if ($idExploded[0] == 'plugin') {
|
||||||
//Get the Plugin Folder, always the first element
|
//Get the Plugin Folder, always the first element
|
||||||
$pluginFolder = $idExploded[1];
|
$pluginFolder = $idExploded[1];
|
||||||
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html'. PATH_SEP . $idExploded[2];
|
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $idExploded[2];
|
||||||
if ( file_exists ( $pluginFilename ) ) {
|
if (file_exists( $pluginFilename )) {
|
||||||
G::streamFile ( $pluginFilename );
|
G::streamFile( $pluginFilename );
|
||||||
}
|
}
|
||||||
die;
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ainfoSite = explode("/",$_SERVER["REQUEST_URI"]);
|
$ainfoSite = explode( "/", $_SERVER["REQUEST_URI"] );
|
||||||
//it was added to show the logo into management plugin add by krlos
|
//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'];
|
$ainfoSite[1] = $_GET['wsName'];
|
||||||
}
|
}
|
||||||
//end add
|
//end add
|
||||||
$dir=PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos";
|
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
|
||||||
$imagen = $dir .PATH_SEP.$idDecode64;
|
$imagen = $dir . PATH_SEP . $idDecode64;
|
||||||
|
|
||||||
|
if (is_file( $imagen )) {
|
||||||
|
showLogo( $imagen );
|
||||||
|
|
||||||
if (is_file($imagen))
|
} else {
|
||||||
{
|
|
||||||
showLogo($imagen);
|
|
||||||
|
|
||||||
}
|
$newDir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
|
||||||
else {
|
$dir = PATH_HOME . "public_html/files/logos";
|
||||||
|
|
||||||
$newDir = PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos";
|
if (! is_dir( $newDir )) {
|
||||||
$dir = PATH_HOME . "public_html/files/logos";
|
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showLogo($imagen){
|
|
||||||
$info = @getimagesize($imagen);
|
|
||||||
$fp = fopen($imagen, "rb");
|
|
||||||
if ($info && $fp) {
|
|
||||||
header("Content-type: {$info['mime']}");
|
|
||||||
fpassthru($fp);
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
throw new Exception("Image format not valid");
|
|
||||||
}
|
}
|
||||||
}
|
//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();
|
||||||
|
|
||||||
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;
|
function showLogo ($imagen)
|
||||||
$dir2 = $newDir.PATH_SEP.$file;
|
{
|
||||||
//print $dir1 ." *** ".$dir2."<br><br>";
|
$info = @getimagesize( $imagen );
|
||||||
copy($dir1,$dir2);
|
$fp = fopen( $imagen, "rb" );
|
||||||
|
if ($info && $fp) {
|
||||||
|
header( "Content-type: {$info['mime']}" );
|
||||||
|
fpassthru( $fp );
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
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'
|
||||||
|
) )) {
|
||||||
|
|
||||||
}
|
$dir1 = $dir . PATH_SEP . $file;
|
||||||
|
$dir2 = $newDir . PATH_SEP . $file;
|
||||||
|
//print $dir1 ." *** ".$dir2."<br><br>";
|
||||||
|
copy( $dir1, $dir2 );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
closedir( $handle );
|
||||||
closedir($handle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
die;
|
die();
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,255 +1,250 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!isset($_REQUEST ['action'])) {
|
if (! isset( $_REQUEST['action'] )) {
|
||||||
$res ['success'] = false;
|
$res['success'] = false;
|
||||||
$res ['error']=$res ['message'] = 'You may request an action';
|
$res['error'] = $res['message'] = 'You may request an action';
|
||||||
|
|
||||||
print G::json_encode($res);
|
print G::json_encode( $res );
|
||||||
die ();
|
die();
|
||||||
}
|
}
|
||||||
if (!function_exists($_REQUEST ['action'])) {
|
if (! function_exists( $_REQUEST['action'] )) {
|
||||||
$res ['success'] = false;
|
$res['success'] = false;
|
||||||
$res ['error']=$res ['message'] = 'The requested action does not exist';
|
$res['error'] = $res['message'] = 'The requested action does not exist';
|
||||||
|
|
||||||
print G::json_encode($res);
|
print G::json_encode( $res );
|
||||||
die ();
|
die();
|
||||||
}
|
}
|
||||||
$restrictedFunctions=array('copy_skin_folder','addTarFolder');
|
$restrictedFunctions = array ('copy_skin_folder','addTarFolder'
|
||||||
if (in_array($_REQUEST ['action'],$restrictedFunctions)) {
|
);
|
||||||
$res ['success'] = false;
|
if (in_array( $_REQUEST['action'], $restrictedFunctions )) {
|
||||||
$res ['error']=$res ['message'] = 'The requested action does not exist *';
|
$res['success'] = false;
|
||||||
print G::json_encode($res);
|
$res['error'] = $res['message'] = 'The requested action does not exist *';
|
||||||
die ();
|
print G::json_encode( $res );
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$functionName = $_REQUEST['action'];
|
||||||
$functionName = $_REQUEST ['action'];
|
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
|
||||||
$functionParams = isset($_REQUEST ['params']) ? $_REQUEST ['params'] : array();
|
|
||||||
|
|
||||||
$functionName();
|
$functionName();
|
||||||
|
|
||||||
function updatePageSize()
|
function updatePageSize ()
|
||||||
{
|
{
|
||||||
G::LoadClass('configuration');
|
G::LoadClass( 'configuration' );
|
||||||
$c = new Configurations();
|
$c = new Configurations();
|
||||||
$arr['pageSize'] = $_REQUEST['size'];
|
$arr['pageSize'] = $_REQUEST['size'];
|
||||||
$arr['dateSave'] = date('Y-m-d H:i:s');
|
$arr['dateSave'] = date( 'Y-m-d H:i:s' );
|
||||||
$config = Array();
|
$config = Array ();
|
||||||
$config[] = $arr;
|
$config[] = $arr;
|
||||||
$c->aConfig = $config;
|
$c->aConfig = $config;
|
||||||
$c->saveConfig('skinsList', 'pageSize', '', $_SESSION['USER_LOGGED']);
|
$c->saveConfig( 'skinsList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||||
echo '{success: true}';
|
echo '{success: true}';
|
||||||
}
|
}
|
||||||
|
|
||||||
function skinList()
|
function skinList ()
|
||||||
{
|
{
|
||||||
G::loadClass('system');
|
G::loadClass( 'system' );
|
||||||
|
|
||||||
$skinList = System::getSkingList();
|
$skinList = System::getSkingList();
|
||||||
|
|
||||||
$wildcard = '';
|
$wildcard = '';
|
||||||
if(isset($_REQUEST['activeskin']))
|
if (isset( $_REQUEST['activeskin'] )) {
|
||||||
{
|
|
||||||
$wildcard = '@';
|
$wildcard = '@';
|
||||||
}
|
}
|
||||||
foreach ($skinList['skins'] as $key => $value) {
|
foreach ($skinList['skins'] as $key => $value) {
|
||||||
if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs') {
|
if ($value['SKIN_FOLDER_ID'] != 'simplified' && $value['SKIN_FOLDER_ID'] != 'uxs') {
|
||||||
if($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']){
|
if ($skinList['currentSkin'] == $value['SKIN_FOLDER_ID']) {
|
||||||
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation('ID_ACTIVE');
|
$value['SKIN_STATUS'] = $wildcard . G::LoadTranslation( 'ID_ACTIVE' );
|
||||||
$value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
|
$value['SKIN_NAME'] = $wildcard . $value['SKIN_NAME'];
|
||||||
$value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
|
$value['SKIN_DESCRIPTION'] = $wildcard . $value['SKIN_DESCRIPTION'];
|
||||||
$value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
|
$value['SKIN_AUTHOR'] = $wildcard . $value['SKIN_AUTHOR'];
|
||||||
$value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
|
$value['SKIN_CREATEDATE'] = $wildcard . $value['SKIN_CREATEDATE'];
|
||||||
$value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE'];
|
$value['SKIN_MODIFIEDDATE'] = $wildcard . $value['SKIN_MODIFIEDDATE'];
|
||||||
}
|
} else {
|
||||||
else{
|
$value['SKIN_STATUS'] = G::LoadTranslation( 'ID_INACTIVE' );
|
||||||
$value['SKIN_STATUS'] = G::LoadTranslation('ID_INACTIVE');
|
|
||||||
}
|
}
|
||||||
$skinListArray['skins'][] = $value;
|
$skinListArray['skins'][] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$skinListArray['currentSkin'] = $skinList['currentSkin'];
|
$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';
|
$skinBase = $baseSkin != "" ? strtolower( $baseSkin ) : 'classic';
|
||||||
if ((isset($_REQUEST['skinBase'])) && ($_REQUEST['skinBase'] != "")) {
|
if ((isset( $_REQUEST['skinBase'] )) && ($_REQUEST['skinBase'] != "")) {
|
||||||
$skinBase = strtolower($_REQUEST['skinBase']);
|
$skinBase = strtolower( $_REQUEST['skinBase'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!(isset($_REQUEST['skinName']))) {
|
if (! (isset( $_REQUEST['skinName'] ))) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
|
||||||
}
|
}
|
||||||
if (!(isset($_REQUEST['skinFolder']))) {
|
if (! (isset( $_REQUEST['skinFolder'] ))) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
|
||||||
}
|
}
|
||||||
//Should validate skin folder name here
|
//Should validate skin folder name here
|
||||||
//if....
|
//if....
|
||||||
|
|
||||||
|
|
||||||
$skinName = $_REQUEST['skinName'];
|
$skinName = $_REQUEST['skinName'];
|
||||||
$skinFolder = $_REQUEST['skinFolder'];
|
$skinFolder = $_REQUEST['skinFolder'];
|
||||||
$skinDescription = isset($_REQUEST['skinDescription']) ? $_REQUEST['skinDescription'] : '';
|
$skinDescription = isset( $_REQUEST['skinDescription'] ) ? $_REQUEST['skinDescription'] : '';
|
||||||
$skinAuthor = isset($_REQUEST['skinAuthor']) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
|
$skinAuthor = isset( $_REQUEST['skinAuthor'] ) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team';
|
||||||
|
|
||||||
if (is_dir(PATH_CUSTOM_SKINS . $skinFolder)) {
|
if (is_dir( PATH_CUSTOM_SKINS . $skinFolder )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
|
||||||
}
|
}
|
||||||
if (strtolower($skinFolder) == 'classic') {
|
if (strtolower( $skinFolder ) == 'classic') {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ALREADY_EXISTS' ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
//All validations OK then create skin
|
//All validations OK then create skin
|
||||||
switch ($skinBase) {
|
switch ($skinBase) {
|
||||||
//Validate skin base
|
//Validate skin base
|
||||||
case 'uxmodern':
|
case 'uxmodern':
|
||||||
copy_skin_folder(G::ExpandPath("skinEngine") . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS .
|
copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
|
||||||
$skinFolder,array("config.xml"));
|
) );
|
||||||
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP;
|
$pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
|
||||||
break;
|
break;
|
||||||
case 'classic':
|
case 'classic':
|
||||||
//Special Copy of this dir + xmlreplace
|
//Special Copy of this dir + xmlreplace
|
||||||
copy_skin_folder(G::ExpandPath("skinEngine") . 'base' . PATH_SEP, PATH_CUSTOM_SKINS .
|
copy_skin_folder( G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml","baseCss"
|
||||||
$skinFolder,array("config.xml","baseCss"));
|
) );
|
||||||
$pathBase=G::ExpandPath("skinEngine") . 'base' . PATH_SEP;
|
$pathBase = G::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//Commmon copy/paste of a folder + xmlrepalce
|
//Commmon copy/paste of a folder + xmlrepalce
|
||||||
copy_skin_folder(PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder,array("config.xml"));
|
copy_skin_folder( PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder, array ("config.xml"
|
||||||
$pathBase=PATH_CUSTOM_SKINS.$skinBase;
|
) );
|
||||||
|
$pathBase = PATH_CUSTOM_SKINS . $skinBase;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//ReBuild config file
|
//ReBuild config file
|
||||||
//TODO: Improve this pre_replace lines
|
//TODO: Improve this pre_replace lines
|
||||||
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
|
$configFileOriginal = $pathBase . PATH_SEP . 'config.xml';
|
||||||
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
|
$configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml';
|
||||||
$xmlConfiguration = file_get_contents($configFileOriginal);
|
$xmlConfiguration = file_get_contents( $configFileOriginal );
|
||||||
$xmlConfiguration = preg_replace('/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() .
|
$xmlConfiguration = preg_replace( '/(<id>)(.+?)(<\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration );
|
||||||
'</id><!-- $2 -->', $xmlConfiguration);
|
$xmlConfiguration = preg_replace( "/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName . "</name><!-- $2 -->", $xmlConfiguration );
|
||||||
$xmlConfiguration = preg_replace("/(<name>)(.+?)(<\/name>)/i", "<name>" . $skinName .
|
$xmlConfiguration = preg_replace( "/(<description>)(.+?)(<\/description>)/i", "<description>" . $skinDescription . "</description><!-- $2 -->", $xmlConfiguration );
|
||||||
"</name><!-- $2 -->", $xmlConfiguration);
|
$xmlConfiguration = preg_replace( "/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor . "</author><!-- $2 -->", $xmlConfiguration );
|
||||||
$xmlConfiguration = preg_replace("/(<description>)(.+?)(<\/description>)/i", "<description>" .
|
$xmlConfiguration = preg_replace( "/(<createDate>)(.+?)(<\/createDate>)/i", "<createDate>" . date( "Y-m-d H:i:s" ) . "</createDate><!-- $2 -->", $xmlConfiguration );
|
||||||
$skinDescription . "</description><!-- $2 -->", $xmlConfiguration);
|
$xmlConfiguration = preg_replace( "/(<modifiedDate>)(.+?)(<\/modifiedDate>)/i", "<modifiedDate>" . date( "Y-m-d H:i:s" ) . "</modifiedDate><!-- $2 -->", $xmlConfiguration );
|
||||||
$xmlConfiguration = preg_replace("/(<author>)(.+?)(<\/author>)/i", "<author>" . $skinAuthor .
|
file_put_contents( $configFileFinal, $xmlConfiguration );
|
||||||
"</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['success'] = true;
|
||||||
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESS_CREATE');
|
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESS_CREATE' );
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response['success'] = false;
|
$response['success'] = false;
|
||||||
$response['message'] = $e->getMessage();
|
$response['message'] = $e->getMessage();
|
||||||
$response['error'] = $e->getMessage();
|
$response['error'] = $e->getMessage();
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function importSkin()
|
function importSkin ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!isset($_FILES['uploadedFile'])) {
|
if (! isset( $_FILES['uploadedFile'] )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FILE_REQUIRED')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FILE_REQUIRED' ) ));
|
||||||
}
|
}
|
||||||
$uploadedInstances = count($_FILES['uploadedFile']['name']);
|
$uploadedInstances = count( $_FILES['uploadedFile']['name'] );
|
||||||
$sw_error = false;
|
$sw_error = false;
|
||||||
$sw_error_exists = isset($_FILES['uploadedFile']['error']);
|
$sw_error_exists = isset( $_FILES['uploadedFile']['error'] );
|
||||||
$emptyInstances = 0;
|
$emptyInstances = 0;
|
||||||
$quequeUpload = array();
|
$quequeUpload = array ();
|
||||||
|
|
||||||
// upload files & check for errors
|
// upload files & check for errors
|
||||||
$tmp = $_FILES['uploadedFile']['tmp_name'];
|
$tmp = $_FILES['uploadedFile']['tmp_name'];
|
||||||
$items = stripslashes($_FILES['uploadedFile']['name']);
|
$items = stripslashes( $_FILES['uploadedFile']['name'] );
|
||||||
if ($sw_error_exists) {
|
if ($sw_error_exists) {
|
||||||
$up_err = $_FILES['uploadedFile']['error'];
|
$up_err = $_FILES['uploadedFile']['error'];
|
||||||
} else {
|
} else {
|
||||||
$up_err= ( file_exists($tmp) ? 0 : 4);
|
$up_err = (file_exists( $tmp ) ? 0 : 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($items == "" || $up_err == 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) {
|
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';
|
//$errors[$i]='miscfilesize';
|
||||||
}
|
}
|
||||||
if ($up_err == 3) {
|
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';
|
//$errors[$i]='miscfilepart';
|
||||||
}
|
}
|
||||||
if (!@is_uploaded_file($tmp)) {
|
if (! @is_uploaded_file( $tmp )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR')));
|
throw (new Exception( G::LoadTranslation( 'ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR' ) ));
|
||||||
//$errors[$i]='uploadfile';
|
//$errors[$i]='uploadfile';
|
||||||
}
|
}
|
||||||
$fileInfo = pathinfo($items);
|
$fileInfo = pathinfo( $items );
|
||||||
$validType = array('tar', 'gz');
|
$validType = array ('tar','gz'
|
||||||
|
);
|
||||||
|
|
||||||
if (!in_array($fileInfo['extension'], $validType)) {
|
if (! in_array( $fileInfo['extension'], $validType )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_FILE_UPLOAD_INCORRECT_EXTENSION')));
|
throw (new Exception( G::LoadTranslation( 'ID_FILE_UPLOAD_INCORRECT_EXTENSION' ) ));
|
||||||
//$errors[$i]='wrongtype';
|
//$errors[$i]='wrongtype';
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = $items;
|
$filename = $items;
|
||||||
$tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
|
$tempPath = PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP;
|
||||||
G::verifyPath($tempPath, true);
|
G::verifyPath( $tempPath, true );
|
||||||
$tempName = $tmp;
|
$tempName = $tmp;
|
||||||
G::uploadFile($tempName, $tempPath, $filename);
|
G::uploadFile( $tempName, $tempPath, $filename );
|
||||||
G::LoadThirdParty('pear/Archive', 'Tar');
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
$tar = new Archive_Tar($tempPath . $filename);
|
$tar = new Archive_Tar( $tempPath . $filename );
|
||||||
$aFiles = $tar->listContent();
|
$aFiles = $tar->listContent();
|
||||||
$swConfigFile = false;
|
$swConfigFile = false;
|
||||||
|
|
||||||
foreach ($aFiles as $key => $val) {
|
foreach ($aFiles as $key => $val) {
|
||||||
if (basename($val['filename']) == 'config.xml') {
|
if (basename( $val['filename'] ) == 'config.xml') {
|
||||||
$skinName = dirname($val['filename']);
|
$skinName = dirname( $val['filename'] );
|
||||||
$skinArray = explode("/", $skinName);
|
$skinArray = explode( "/", $skinName );
|
||||||
if (count($skinArray) == 1) {
|
if (count( $skinArray ) == 1) {
|
||||||
$swConfigFile = true;
|
$swConfigFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$swConfigFile) {
|
if (! $swConfigFile) {
|
||||||
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
|
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')));
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir(PATH_CUSTOM_SKINS . $skinName)) {
|
if (is_dir( PATH_CUSTOM_SKINS . $skinName )) {
|
||||||
if ((isset($_REQUEST['overwrite_files'])) && ($_REQUEST['overwrite_files'] == 'on')) {
|
if ((isset( $_REQUEST['overwrite_files'] )) && ($_REQUEST['overwrite_files'] == 'on')) {
|
||||||
G::rm_dir(PATH_CUSTOM_SKINS . $skinName, false);
|
G::rm_dir( PATH_CUSTOM_SKINS . $skinName, false );
|
||||||
} else {
|
} 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);
|
$res = $tar->extract( PATH_CUSTOM_SKINS );
|
||||||
if (!$res) {
|
if (! $res) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_ERROR_EXTRACTING')));
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_ERROR_EXTRACTING' ) ));
|
||||||
}
|
}
|
||||||
//Delete Temporal
|
//Delete Temporal
|
||||||
@unlink(PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename);
|
@unlink( PATH_CUSTOM_SKINS . '.tmp' . PATH_SEP . $filename );
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
$response['message'] = G::LoadTranslation('ID_SKIN_SUCCESSFUL_IMPORTED');
|
$response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESSFUL_IMPORTED' );
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response['success'] = false;
|
$response['success'] = false;
|
||||||
$response['message'] = $e->getMessage();
|
$response['message'] = $e->getMessage();
|
||||||
$response['error'] = $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 {
|
try {
|
||||||
if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
|
if (! isset( $_REQUEST['SKIN_FOLDER_ID'] )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NAME_REQUIRED' ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
|
$skinName = $_REQUEST['SKIN_FOLDER_ID'];
|
||||||
@@ -257,113 +252,116 @@ function exportSkin($skinToExport="")
|
|||||||
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
|
$skinFolderBase = PATH_CUSTOM_SKINS . $skinName;
|
||||||
$skinFolder = $skinFolderBase . PATH_SEP;
|
$skinFolder = $skinFolderBase . PATH_SEP;
|
||||||
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
|
$skinTar = PATH_CUSTOM_SKINS . $skinName . '.tar';
|
||||||
if (!is_dir($skinFolder)) {
|
if (! is_dir( $skinFolder )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_DOESNT_EXIST')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_DOESNT_EXIST' ) ));
|
||||||
}
|
}
|
||||||
if (!file_exists($skinFolder . "config.xml")) {
|
if (! file_exists( $skinFolder . "config.xml" )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_CONFIGURATION_MISSING')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_CONFIGURATION_MISSING' ) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($skinTar)) {
|
if (file_exists( $skinTar )) {
|
||||||
//try to delete
|
//try to delete
|
||||||
if (!unlink($skinTar)) {
|
if (! unlink( $skinTar )) {
|
||||||
throw ( new Exception(G::LoadTranslation('ID_SKIN_FOLDER_PERMISSIONS')) );
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_PERMISSIONS' ) ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Try to generate tar file
|
//Try to generate tar file
|
||||||
G::LoadThirdParty('pear/Archive', 'Tar');
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
$tar = new Archive_Tar($skinTar);
|
$tar = new Archive_Tar( $skinTar );
|
||||||
$tar->_compress = false;
|
$tar->_compress = false;
|
||||||
|
|
||||||
addTarFolder($tar, $skinFolder, PATH_CUSTOM_SKINS);
|
addTarFolder( $tar, $skinFolder, PATH_CUSTOM_SKINS );
|
||||||
|
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
$response['message'] = $skinTar;
|
$response['message'] = $skinTar;
|
||||||
|
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response['success'] = false;
|
$response['success'] = false;
|
||||||
$response['message'] = $e->getMessage();
|
$response['message'] = $e->getMessage();
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function deleteSkin()
|
|
||||||
|
function deleteSkin ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!(isset($_REQUEST['SKIN_FOLDER_ID']))) {
|
if (! (isset( $_REQUEST['SKIN_FOLDER_ID'] ))) {
|
||||||
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')));
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_REQUIRED' ) ));
|
||||||
}
|
}
|
||||||
if (($_REQUEST['SKIN_FOLDER_ID'])=="classic") {
|
if (($_REQUEST['SKIN_FOLDER_ID']) == "classic") {
|
||||||
throw (new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE')));
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_FOLDER_NOT_DELETEABLE' ) ));
|
||||||
}
|
}
|
||||||
$folderId=$_REQUEST['SKIN_FOLDER_ID'];
|
$folderId = $_REQUEST['SKIN_FOLDER_ID'];
|
||||||
if (!is_dir(PATH_CUSTOM_SKINS.$folderId)) {
|
if (! is_dir( PATH_CUSTOM_SKINS . $folderId )) {
|
||||||
throw (new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS')));
|
throw (new Exception( G::LoadTranslation( 'ID_SKIN_NOT_EXISTS' ) ));
|
||||||
}
|
}
|
||||||
//Delete
|
//Delete
|
||||||
G::rm_dir(PATH_CUSTOM_SKINS.$folderId);
|
G::rm_dir( PATH_CUSTOM_SKINS . $folderId );
|
||||||
$response['success'] = true;
|
$response['success'] = true;
|
||||||
$response['message'] = "$folderId deleted";
|
$response['message'] = "$folderId deleted";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response['success'] = false;
|
$response['success'] = false;
|
||||||
$response['error']=$response['message'] = $e->getMessage();
|
$response['error'] = $response['message'] = $e->getMessage();
|
||||||
print_r(G::json_encode($response));
|
print_r( G::json_encode( $response ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function streamSkin()
|
|
||||||
|
function streamSkin ()
|
||||||
{
|
{
|
||||||
$skinTar = $_REQUEST['file'];
|
$skinTar = $_REQUEST['file'];
|
||||||
$bDownload = true;
|
$bDownload = true;
|
||||||
G::streamFile($skinTar, $bDownload, basename($skinTar));
|
G::streamFile( $skinTar, $bDownload, basename( $skinTar ) );
|
||||||
@unlink($fileTar);
|
@unlink( $fileTar );
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTarFolder($tar, $pathBase, $pluginHome)
|
function addTarFolder ($tar, $pathBase, $pluginHome)
|
||||||
{
|
{
|
||||||
$aux = explode(PATH_SEP, $pathBase);
|
$aux = explode( PATH_SEP, $pathBase );
|
||||||
if ($aux[count($aux) - 2] == '.svn') {
|
if ($aux[count( $aux ) - 2] == '.svn') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($handle = opendir($pathBase)) {
|
if ($handle = opendir( $pathBase )) {
|
||||||
while (false !== ($file = readdir($handle))) {
|
while (false !== ($file = readdir( $handle ))) {
|
||||||
if (is_file($pathBase . $file)) {
|
if (is_file( $pathBase . $file )) {
|
||||||
//print "file $file \n";
|
//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";
|
//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(".","..");
|
$defaultExcluded = array (".",".."
|
||||||
$excludedItems=array_merge($defaultExcluded,$exclude);
|
);
|
||||||
if (is_dir($path)) {
|
$excludedItems = array_merge( $defaultExcluded, $exclude );
|
||||||
@mkdir($dest);
|
if (is_dir( $path )) {
|
||||||
$objects = scandir($path);
|
@mkdir( $dest );
|
||||||
if (sizeof($objects) > 0) {
|
$objects = scandir( $path );
|
||||||
|
if (sizeof( $objects ) > 0) {
|
||||||
foreach ($objects as $file) {
|
foreach ($objects as $file) {
|
||||||
if (in_array($file,$excludedItems)) {
|
if (in_array( $file, $excludedItems )) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// go on
|
// go on
|
||||||
if (is_dir($path . PATH_SEP . $file)) {
|
if (is_dir( $path . PATH_SEP . $file )) {
|
||||||
copy_skin_folder($path . PATH_SEP . $file, $dest . PATH_SEP . $file,$exclude);
|
copy_skin_folder( $path . PATH_SEP . $file, $dest . PATH_SEP . $file, $exclude );
|
||||||
} else {
|
} else {
|
||||||
copy($path . PATH_SEP . $file, $dest . PATH_SEP . $file);
|
copy( $path . PATH_SEP . $file, $dest . PATH_SEP . $file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} elseif (is_file($path)) {
|
} elseif (is_file( $path )) {
|
||||||
return copy($path, $dest);
|
return copy( $path, $dest );
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* skinsExport.php
|
* skinsExport.php
|
||||||
*
|
*
|
||||||
@@ -12,173 +13,175 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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 savePluginFile ( $tplName, $fileName, $fields ) {
|
function copyFile ($input, $output)
|
||||||
$pluginTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' .PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
|
{
|
||||||
|
$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';
|
||||||
$template = new TemplatePower( $pluginTpl );
|
$template = new TemplatePower( $pluginTpl );
|
||||||
$template->prepare();
|
$template->prepare();
|
||||||
|
|
||||||
if ( is_array ($fields) ) {
|
|
||||||
foreach ( $fields as $block => $data ) {
|
|
||||||
$template->gotoBlock( "_ROOT" );
|
|
||||||
if ( is_array( $data) )
|
|
||||||
foreach ( $data as $rowId => $row ) {
|
|
||||||
$template->newBlock( $block );
|
|
||||||
foreach ( $row as $key => $val )
|
|
||||||
$template->assign( $key, $val );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$template->assign( $block, $data );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = $template->getOutputContent();
|
|
||||||
$iSize = file_put_contents ( $fileName, $content );
|
|
||||||
return $iSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addTarFolder ( $tar, $pathBase,$pluginHome ) {
|
if (is_array( $fields )) {
|
||||||
$aux = explode( PATH_SEP, $pathBase);
|
foreach ($fields as $block => $data) {
|
||||||
if ( $aux[count($aux) -2 ] == '.svn' ) return;
|
$template->gotoBlock( "_ROOT" );
|
||||||
|
if (is_array( $data ))
|
||||||
if ($handle = opendir( $pathBase )) {
|
foreach ($data as $rowId => $row) {
|
||||||
while ( false !== ($file = readdir($handle))) {
|
$template->newBlock( $block );
|
||||||
if ( is_file ( $pathBase . $file ) ) {
|
foreach ($row as $key => $val)
|
||||||
//print "file $file \n";
|
$template->assign( $key, $val );
|
||||||
$tar->addModify( $pathBase . $file,'', $pluginHome);
|
}
|
||||||
|
else
|
||||||
|
$template->assign( $block, $data );
|
||||||
}
|
}
|
||||||
if ( is_dir ( $pathBase . $file ) && $file != '..' && $file != '.' ) {
|
|
||||||
//print "dir $pathBase$file \n";
|
|
||||||
addTarFolder ( $tar, $pathBase . $file . PATH_SEP ,$pluginHome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function packPlugin ( $pluginName, $version ) {
|
$content = $template->getOutputContent();
|
||||||
|
$iSize = file_put_contents( $fileName, $content );
|
||||||
|
return $iSize;
|
||||||
|
}
|
||||||
|
|
||||||
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP;
|
function addTarFolder ($tar, $pathBase, $pluginHome)
|
||||||
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName ;
|
{
|
||||||
$fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar';
|
$aux = explode( PATH_SEP, $pathBase );
|
||||||
|
if ($aux[count( $aux ) - 2] == '.svn')
|
||||||
G::LoadSystem ('templatePower');
|
return;
|
||||||
/*
|
|
||||||
|
if ($handle = opendir( $pathBase )) {
|
||||||
|
while (false !== ($file = readdir( $handle ))) {
|
||||||
|
if (is_file( $pathBase . $file )) {
|
||||||
|
//print "file $file \n";
|
||||||
|
$tar->addModify( $pathBase . $file, '', $pluginHome );
|
||||||
|
}
|
||||||
|
if (is_dir( $pathBase . $file ) && $file != '..' && $file != '.') {
|
||||||
|
//print "dir $pathBase$file \n";
|
||||||
|
addTarFolder( $tar, $pathBase . $file . PATH_SEP, $pluginHome );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir( $handle );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function packPlugin ($pluginName, $version)
|
||||||
|
{
|
||||||
|
|
||||||
|
$pathBase = PATH_DATA . 'skins' . PATH_SEP . $pluginName . PATH_SEP;
|
||||||
|
$pathHome = PATH_DATA . 'skins' . PATH_SEP . $pluginName;
|
||||||
|
$fileTar = PATH_DATA . 'skins' . PATH_SEP . $pluginName . '-' . $version . '.tar';
|
||||||
|
|
||||||
|
G::LoadSystem( 'templatePower' );
|
||||||
|
/*
|
||||||
$pluginDirectory = PATH_PLUGINS . $pluginName;
|
$pluginDirectory = PATH_PLUGINS . $pluginName;
|
||||||
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
||||||
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
||||||
|
|
||||||
//verify if plugin exists,
|
//verify if plugin exists,
|
||||||
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
||||||
if ( !is_file ( $pluginClassFilename ) ) {
|
if ( !is_file ( $pluginClassFilename ) ) {
|
||||||
printf("The plugin %s doesn't exist in this file %s \n", pakeColor::colorize( $pluginName, 'ERROR'), pakeColor::colorize( $pluginClassFilename, 'INFO') );
|
printf("The plugin %s doesn't exist in this file %s \n", pakeColor::colorize( $pluginName, 'ERROR'), pakeColor::colorize( $pluginClassFilename, 'INFO') );
|
||||||
die ;
|
die ;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
G::LoadThirdParty( 'pear/Archive','Tar');
|
G::LoadThirdParty( 'pear/Archive', 'Tar' );
|
||||||
$tar = new Archive_Tar ( $fileTar);
|
$tar = new Archive_Tar( $fileTar );
|
||||||
$tar->_compress=false;
|
$tar->_compress = false;
|
||||||
|
|
||||||
//$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome);
|
//$tar->createModify( $pathHome . PATH_SEP . $pluginName . '.php' ,'', $pathHome);
|
||||||
addTarFolder ( $tar, $pathBase, $pathHome );
|
addTarFolder( $tar, $pathBase, $pathHome );
|
||||||
$aFiles = $tar->listContent();
|
$aFiles = $tar->listContent();
|
||||||
return $fileTar;
|
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;
|
|
||||||
break;
|
|
||||||
case -1:
|
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
|
||||||
G::header('location: ../login/login');
|
|
||||||
die;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G::LoadClass("system");
|
global $RBAC;
|
||||||
|
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();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$id = $_GET['id'];
|
G::LoadClass( "system" );
|
||||||
|
|
||||||
$fileObj = PATH_SKINS . $id . '.cnf';
|
$id = $_GET['id'];
|
||||||
|
|
||||||
if ( !file_exists($fileObj) ) {
|
$fileObj = PATH_SKINS . $id . '.cnf';
|
||||||
|
|
||||||
|
if (! file_exists( $fileObj )) {
|
||||||
$oConf = new stdClass();
|
$oConf = new stdClass();
|
||||||
$oConf->name = $id;
|
$oConf->name = $id;
|
||||||
$oConf->description = "description of skin $id ";
|
$oConf->description = "description of skin $id ";
|
||||||
$oConf->version = 1;
|
$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 ) );
|
||||||
|
|
||||||
|
$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' );
|
||||||
|
|
||||||
$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;
|
|
||||||
|
|
||||||
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" );
|
// file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id , "hello world" );
|
||||||
$fields['className'] = $id;
|
$fields['className'] = $id;
|
||||||
$fields['version'] = $oConf->version;
|
$fields['version'] = $oConf->version;
|
||||||
$fields['description'] = $oConf->description;
|
$fields['description'] = $oConf->description;
|
||||||
$fields['PMversion'] = System::getVersion();
|
$fields['PMversion'] = System::getVersion();
|
||||||
savePluginFile ( 'skinPluginMainClass' , $pathHome . $id . '.php', $fields );
|
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_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc' , $pathPublic );
|
|
||||||
copyFile ( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css' , $pathPublic );
|
|
||||||
|
|
||||||
|
copyFile( PATH_SKINS . $id . '.php', $pathBase . 'data' );
|
||||||
|
copyFile( PATH_SKINS . $id . '.html', $pathBase . 'data' );
|
||||||
|
copyFile( PATH_SKINS . $id . '.cnf', $pathBase . 'data' );
|
||||||
|
|
||||||
$aFiles = array ();
|
copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic );
|
||||||
if ($handle = opendir( $pathImages )) {
|
copyFile( PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic );
|
||||||
while ( false !== ($file = readdir($handle))) {
|
|
||||||
if ( substr($file,0,1) != '.' ) {
|
$aFiles = array ();
|
||||||
if ( isset($aFiles[ $file ]) ) $aFiles[$file] = 0;
|
if ($handle = opendir( $pathImages )) {
|
||||||
copyFile ( $pathImages. $file , $pathPublic . 'images' . PATH_SEP );
|
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 ) );
|
||||||
|
|
||||||
|
@G::rm_dir( $pathHome );
|
||||||
|
@unlink( $fileTar );
|
||||||
|
|
||||||
$bDownload = true;
|
|
||||||
G::streamFile ( $fileTar, $bDownload, basename($fileTar) );
|
|
||||||
|
|
||||||
@G::rm_dir ($pathHome);
|
|
||||||
@unlink ($fileTar);
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* pluginsList.php
|
* pluginsList.php
|
||||||
*
|
*
|
||||||
@@ -12,142 +12,138 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
//G::header('location: ../login/login');
|
//G::header('location: ../login/login');
|
||||||
die;
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$G_MAIN_MENU = 'processmaker';
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$G_SUB_MENU = 'setup';
|
$G_SUB_MENU = 'setup';
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
$G_ID_MENU_SELECTED = 'SETUP';
|
||||||
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
|
$G_ID_SUB_MENU_SELECTED = 'CALENDAR';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
|
|
||||||
G::LoadClass('configuration');
|
G::LoadClass( 'configuration' );
|
||||||
$c = new Configurations();
|
$c = new Configurations();
|
||||||
$configPage = $c->getConfiguration('skinList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
$configPage = $c->getConfiguration( 'skinList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
|
||||||
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
|
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
|
||||||
|
|
||||||
$oHeadPublisher =& headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
$oHeadPublisher->addExtJsScript('setup/skinList', false); //adding a javascript file .js
|
$oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascript file .js
|
||||||
$oHeadPublisher->addContent('setup/skinList'); //adding a html file .html.
|
$oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html.
|
||||||
$oHeadPublisher->assign('CONFIG', $Config);
|
$oHeadPublisher->assign( 'CONFIG', $Config );
|
||||||
$oHeadPublisher->assign('SYS_SKIN', SYS_SKIN);
|
$oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN );
|
||||||
|
|
||||||
$oHeadPublisher->assign('FORMATS',$c->getFormats());
|
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
|
||||||
|
|
||||||
G::RenderPage('publish', 'extJs');
|
G::RenderPage( 'publish', 'extJs' );
|
||||||
die;
|
die();
|
||||||
|
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
$access = $RBAC->userCanAccess('PM_SETUP');
|
$access = $RBAC->userCanAccess( 'PM_SETUP' );
|
||||||
if( $access != 1 ){
|
if ($access != 1) {
|
||||||
switch ($access)
|
switch ($access) {
|
||||||
{
|
case - 1:
|
||||||
case -1:
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
G::header( 'location: ../login/login' );
|
||||||
G::header('location: ../login/login');
|
die();
|
||||||
die;
|
break;
|
||||||
break;
|
case - 2:
|
||||||
case -2:
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
G::header( 'location: ../login/login' );
|
||||||
G::header('location: ../login/login');
|
die();
|
||||||
die;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
G::header( 'location: ../login/login' );
|
||||||
G::header('location: ../login/login');
|
die();
|
||||||
die;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// lets display the items
|
// lets display the items
|
||||||
$items[] = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' ,
|
$items[] = array ('id' => 'char','title' => 'char','type' => 'char','creator' => 'char','modifiedBy' => 'char','filename' => 'char','size' => 'char','mime' => 'char'
|
||||||
'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char');
|
);
|
||||||
|
|
||||||
//***************** Skins **************************
|
//***************** Skins **************************
|
||||||
$aFiles = array ();
|
$aFiles = array ();
|
||||||
if ($handle = opendir( PATH_SKINS )) {
|
if ($handle = opendir( PATH_SKINS )) {
|
||||||
while ( false !== ($file = readdir($handle))) {
|
while (false !== ($file = readdir( $handle ))) {
|
||||||
G::pr($file);
|
G::pr( $file );
|
||||||
$filename = substr ( $file,0, strrpos($file, '.'));
|
$filename = substr( $file, 0, strrpos( $file, '.' ) );
|
||||||
|
|
||||||
// list of no complete skins
|
// 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 (! is_dir( PATH_SKINS . $file )) {
|
||||||
if ( !isset($aFiles[ $filename ]) ) $aFiles[$filename] = 0;
|
if (! in_array( $filename, $aFilterSkinsList ) /*&& /*/ && ! strpos( $file, '.tar', 1 )) {
|
||||||
if ( strpos($file, '.php', 1) ) $aFiles[ $filename ] += 1;
|
if (! isset( $aFiles[$filename] ))
|
||||||
if ( strpos($file, '.html',1) ) $aFiles[ $filename ] += 2;
|
$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
|
//now walk in the array to get the .cnf file and display properties
|
||||||
foreach ( $aFiles as $key => $val ) {
|
foreach ($aFiles as $key => $val) {
|
||||||
$description = '';
|
$description = '';
|
||||||
$version = '';
|
$version = '';
|
||||||
if ( file_exists ( PATH_SKINS . $key . '.cnf' ) ) {
|
if (file_exists( PATH_SKINS . $key . '.cnf' )) {
|
||||||
$serial = file_get_contents ( PATH_SKINS . $key . '.cnf' );
|
$serial = file_get_contents( PATH_SKINS . $key . '.cnf' );
|
||||||
$previousErrorRep = ini_get("error_reporting");
|
$previousErrorRep = ini_get( "error_reporting" );
|
||||||
error_reporting( E_ERROR ) ;
|
error_reporting( E_ERROR );
|
||||||
$prop = unserialize ( $serial );
|
$prop = unserialize( $serial );
|
||||||
error_reporting( $previousErrorRep );
|
error_reporting( $previousErrorRep );
|
||||||
if ( !is_object( $prop ) ) {
|
if (! is_object( $prop )) {
|
||||||
@unlink ( PATH_SKINS . $key . '.cnf');
|
@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;
|
$folders['items'] = $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_DBArray['plugins'] = $items;
|
|
||||||
$_SESSION['_DBArray'] = $_DBArray;
|
|
||||||
|
|
||||||
G::LoadClass( 'ArrayPeer');
|
$_DBArray['plugins'] = $items;
|
||||||
$c = new Criteria ('dbarray');
|
$_SESSION['_DBArray'] = $_DBArray;
|
||||||
$c->setDBArrayTable('plugins');
|
|
||||||
$c->addAscendingOrderByColumn ('id');
|
|
||||||
|
|
||||||
$G_MAIN_MENU = 'processmaker';
|
G::LoadClass( 'ArrayPeer' );
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
$c = new Criteria( 'dbarray' );
|
||||||
$G_SUB_MENU = 'setup';
|
$c->setDBArrayTable( 'plugins' );
|
||||||
$G_ID_SUB_MENU_SELECTED = 'SKINS';
|
$c->addAscendingOrderByColumn( 'id' );
|
||||||
|
|
||||||
$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( 'propeltable', 'paged-table', 'setup/skinsList', $c );
|
$G_PUBLISH = new Publisher();
|
||||||
|
|
||||||
G::RenderPage('publishBlank', 'blank');
|
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/skinsList', $c );
|
||||||
|
|
||||||
|
G::RenderPage( 'publishBlank', 'blank' );
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* holidayNew.php
|
* holidayNew.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
$access = $RBAC->userCanAccess( 'PM_SETUP' );
|
||||||
$access = $RBAC->userCanAccess('PM_SETUP');
|
if ($access != 1) {
|
||||||
if( $access != 1 ){
|
switch ($access) {
|
||||||
switch ($access)
|
case - 1:
|
||||||
{
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
case -1:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
case - 2:
|
||||||
break;
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||||
case -2:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
default:
|
||||||
break;
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
default:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
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();
|
||||||
$dbc = new DBConnection;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH = new Publisher;
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$G_MAIN_MENU = 'processmaker';
|
$G_ID_MENU_SELECTED = 'SETUP';
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
$G_SUB_MENU = 'setup';
|
||||||
$G_SUB_MENU = 'setup';
|
$G_ID_SUB_MENU_SELECTED = 'SKINS';
|
||||||
$G_ID_SUB_MENU_SELECTED = 'SKINS';
|
|
||||||
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave" );
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/skinsNew", '', null, "skinsSave");
|
G::RenderPage( 'publishBlank', 'blank' );
|
||||||
G::RenderPage( 'publishBlank', 'blank' );
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* skinsSave.php
|
* skinsSave.php
|
||||||
*
|
*
|
||||||
@@ -12,84 +13,76 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function xcopy ( $pathSource, $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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
global $RBAC;
|
|
||||||
switch ($RBAC->userCanAccess('PM_SETUP'))
|
|
||||||
{
|
{
|
||||||
case -2:
|
G::mk_dir( $pathTarget );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
if ($handle = opendir( $pathSource )) {
|
||||||
G::header('location: ../login/login');
|
while (false !== ($file = readdir( $handle ))) {
|
||||||
die;
|
if (substr( $file, 0, 1 ) != '.' && ! is_dir( $file )) {
|
||||||
break;
|
$content = file_get_contents( $pathSource . $file );
|
||||||
case -1:
|
$filename = $pathTarget . $file;
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
file_put_contents( $filename, $content );
|
||||||
G::header('location: ../login/login');
|
}
|
||||||
die;
|
}
|
||||||
break;
|
closedir( $handle );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
G::LoadClass("system");
|
global $RBAC;
|
||||||
|
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();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$id = strip_tags ( str_replace ( ' ', '_', trim ($_POST['form']['NAME']) ) );
|
G::LoadClass( "system" );
|
||||||
$desc = $_POST['form']['DESCRIPTION'];
|
|
||||||
|
$id = strip_tags( str_replace( ' ', '_', trim( $_POST['form']['NAME'] ) ) );
|
||||||
$fileObj = PATH_SKINS . $id . '.cnf';
|
$desc = $_POST['form']['DESCRIPTION'];
|
||||||
|
|
||||||
if ( !file_exists($fileObj) ) {
|
$fileObj = PATH_SKINS . $id . '.cnf';
|
||||||
|
|
||||||
|
if (! file_exists( $fileObj )) {
|
||||||
$oConf = new stdClass();
|
$oConf = new stdClass();
|
||||||
$oConf->name = $id;
|
$oConf->name = $id;
|
||||||
$oConf->description = $desc;
|
$oConf->description = $desc;
|
||||||
$oConf->version = 1;
|
$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 = file_get_contents( PATH_SKINS . 'green.php' );
|
||||||
$contentPHP = str_replace ( 'green.html', $id.'.html', $contentPHP );
|
$contentPHP = str_replace( 'green.html', $id . '.html', $contentPHP );
|
||||||
file_put_contents ( PATH_SKINS . $id . '.php', $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 );
|
|
||||||
|
|
||||||
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
|
$contentHTML = file_get_contents( PATH_SKINS . 'green.html' );
|
||||||
G::mk_dir ( $pathImages );
|
$contentHTML = str_replace( 'green', $id, $contentHTML );
|
||||||
|
file_put_contents( PATH_SKINS . $id . '.html', $contentHTML );
|
||||||
xcopy (
|
|
||||||
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP ,
|
|
||||||
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP
|
|
||||||
);
|
|
||||||
|
|
||||||
xcopy (
|
$pathImages = PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images' . PATH_SEP;
|
||||||
PATH_HTML . 'skins' . PATH_SEP . 'green' . PATH_SEP . 'images'. PATH_SEP,
|
G::mk_dir( $pathImages );
|
||||||
PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'images'. 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 );
|
||||||
|
|
||||||
|
G::Header( 'Location: ../../' . $id . '/setup/skinsList' );
|
||||||
|
|
||||||
G::Header ( 'Location: ../../' . $id . '/setup/skinsList' );
|
|
||||||
|
|||||||
@@ -1,74 +1,72 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* upgrade.php
|
* upgrade.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*/
|
||||||
*/
|
global $RBAC;
|
||||||
global $RBAC;
|
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
|
||||||
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
|
if ($access != 1) {
|
||||||
if( $access != 1 ){
|
switch ($access) {
|
||||||
switch ($access)
|
case - 1:
|
||||||
{
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
case -1:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
case - 2:
|
||||||
break;
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||||
case -2:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
default:
|
||||||
break;
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
default:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
}
|
||||||
break;
|
}
|
||||||
}
|
//calculating the max upload file size;
|
||||||
}
|
$POST_MAX_SIZE = ini_get( 'post_max_size' );
|
||||||
//calculating the max upload file size;
|
$mul = substr( $POST_MAX_SIZE, - 1 );
|
||||||
$POST_MAX_SIZE = ini_get('post_max_size');
|
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||||
$mul = substr($POST_MAX_SIZE, -1);
|
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
|
||||||
$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 );
|
||||||
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
|
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||||
$mul = substr($UPLOAD_MAX_SIZE, -1);
|
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||||
$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_MAIN_MENU = 'processmaker';
|
$G_ID_MENU_SELECTED = 'SETUP';
|
||||||
$G_SUB_MENU = 'setup';
|
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
|
||||||
$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_PUBLISH = new Publisher;
|
G::RenderPage( 'publishBlank', 'blank' );
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/upgrade', '', $Fields, 'upgrade_System');
|
|
||||||
G::RenderPage('publishBlank', 'blank');
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ $aRequiredPermissions = array('PM_LOGIN',
|
|||||||
'PM_FOLDERS_VIEW',
|
'PM_FOLDERS_VIEW',
|
||||||
'PM_FOLDERS_ADD_FOLDER',
|
'PM_FOLDERS_ADD_FOLDER',
|
||||||
'PM_FOLDERS_ADD_FILE'
|
'PM_FOLDERS_ADD_FILE'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,110 +1,108 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* upgrade_System.php
|
* upgrade_System.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.
|
* Copyright (C) 2004 - 2008 Colosa Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
/**
|
||||||
/**
|
* New System Upgrade controller
|
||||||
* New System Upgrade controller
|
*
|
||||||
*
|
* @author Erik A. O. <erik@colosa.com>
|
||||||
* @author Erik A. O. <erik@colosa.com>
|
* @date May 12th, 2010
|
||||||
* @date May 12th, 2010
|
*/
|
||||||
*/
|
global $RBAC;
|
||||||
global $RBAC;
|
switch ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' )) {
|
||||||
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
|
case - 2:
|
||||||
{
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
|
||||||
case -2:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
case - 1:
|
||||||
break;
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
case -1:
|
G::header( 'location: ../login/login' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
die();
|
||||||
G::header('location: ../login/login');
|
break;
|
||||||
die;
|
}
|
||||||
break;
|
set_time_limit( 0 );
|
||||||
}
|
|
||||||
set_time_limit(0);
|
$G_MAIN_MENU = 'processmaker';
|
||||||
|
$G_SUB_MENU = 'setup';
|
||||||
$G_MAIN_MENU = 'processmaker';
|
$G_ID_MENU_SELECTED = 'SETUP';
|
||||||
$G_SUB_MENU = 'setup';
|
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
|
||||||
$G_ID_SUB_MENU_SELECTED = 'UPGRADE';
|
require_once "classes/class.system.php";
|
||||||
|
$oSystem = new System();
|
||||||
require_once "classes/class.system.php";
|
|
||||||
$oSystem = new System();
|
try {
|
||||||
|
if (! $oSystem->verifyFileForUpgrade()) {
|
||||||
try {
|
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();
|
||||||
$oSystem->cleanupUpgradeDirectory();
|
|
||||||
$oSystem->getUpgradedFilesList();
|
$ver = $oSystem->upgrade();
|
||||||
|
$G_PUBLISH = new Publisher();
|
||||||
$ver = $oSystem->upgrade();
|
$aMessage['THEMESSAGE1'] = G::LoadTranslation( 'ID_UPGRADE_READY' ) . " <b>" . $ver[0] . "</b> " . G::LoadTranslation( 'ID_TO' ) . " <b>" . $ver[1] . "</b>";
|
||||||
$G_PUBLISH = new Publisher;
|
$aMessage['THEMESSAGE2'] = file_get_contents( $oSystem->sUpgradeFileList );
|
||||||
$aMessage['THEMESSAGE1'] = G::LoadTranslation('ID_UPGRADE_READY') ." <b>". $ver[0] ."</b> ". G::LoadTranslation('ID_TO') ." <b>". $ver[1] ."</b>";
|
$aMessage['THEMESSAGE3'] = '';
|
||||||
$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 )
|
else
|
||||||
$aMessage['THEMESSAGE4'] = G::LoadTranslation('ID_NONE');
|
$aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors );
|
||||||
else
|
|
||||||
$aMessage['THEMESSAGE4'] = implode( "\n", $oSystem->aErrors) ;
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
if (file_exists( PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js' )) {
|
||||||
$oHeadPublisher =& headPublisher::getSingleton();
|
$oHeadPublisher->addScriptFile( '/jscore/setup/upgrade_System.js' );
|
||||||
if( file_exists(PATH_CORE . 'js' . PATH_SEP . 'setup' . PATH_SEP . 'upgrade_System.js') ){
|
} else {
|
||||||
$oHeadPublisher->addScriptFile('/jscore/setup/upgrade_System.js');
|
$oHeadPublisher->addScriptCode( "function upgradeSystem(wsCount) {
|
||||||
} else {
|
document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.';
|
||||||
$oHeadPublisher->addScriptCode("function upgradeSystem(wsCount) {
|
document.getElementById('form[SUBTITLE4]').innerHTML = ' <img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...';
|
||||||
document.getElementById('form[THETITLE3]').innerHTML = wsCount + ' workspaces to update.';
|
updateWorkspace(wsCount);
|
||||||
document.getElementById('form[SUBTITLE4]').innerHTML = ' <img src='/images/alert.gif' width='13' height='13' border='0'> Please wait...';
|
};
|
||||||
updateWorkspace(wsCount);
|
function updateWorkspace(id) {
|
||||||
};
|
if(id < 0) return false;
|
||||||
function updateWorkspace(id) {
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
if(id < 0) return false;
|
async : true,
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
method: 'POST',
|
||||||
async : true,
|
url: '../setup/upgrade_SystemAjax',
|
||||||
method: 'POST',
|
args : 'id=' + id
|
||||||
url: '../setup/upgrade_SystemAjax',
|
});
|
||||||
args : 'id=' + id
|
oRPC.callback = function(rpc) {
|
||||||
});
|
document.getElementById('form[SUBTITLE4]').innerHTML = rpc.xmlhttp.responseText;
|
||||||
oRPC.callback = function(rpc) {
|
updateWorkspace(id-1);
|
||||||
document.getElementById('form[SUBTITLE4]').innerHTML = rpc.xmlhttp.responseText;
|
}.extend(this);
|
||||||
updateWorkspace(id-1);
|
oRPC.make();
|
||||||
}.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 ) . ')' );
|
||||||
G::RenderPage( 'publishBlank', 'blank' );
|
exit( 0 );
|
||||||
G::evalJScript('upgradeSystem('.count($oSystem->aWorkspaces).')');
|
} catch (Exception $e) {
|
||||||
exit(0);
|
$G_PUBLISH = new Publisher();
|
||||||
}
|
$aMessage['MESSAGE'] = $e->getMessage();
|
||||||
catch (Exception $e) {
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||||
$G_PUBLISH = new Publisher;
|
G::RenderPage( 'publishBlank', 'blank' );
|
||||||
$aMessage['MESSAGE'] = $e->getMessage();
|
exit( 0 );
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
}
|
||||||
G::RenderPage( 'publishBlank', 'blank' );
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,389 +1,396 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* upgrade_SystemAjax.php
|
* upgrade_SystemAjax.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2010 Colosa Inc.
|
* Copyright (C) 2004 - 2010 Colosa Inc.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*/
|
||||||
*/
|
global $DB_ADAPTER;
|
||||||
global $DB_ADAPTER;
|
global $DB_HOST;
|
||||||
global $DB_HOST;
|
global $DB_USER;
|
||||||
global $DB_USER;
|
global $DB_PASS;
|
||||||
global $DB_PASS;
|
global $DB_NAME;
|
||||||
global $DB_NAME;
|
set_time_limit( 0 );
|
||||||
set_time_limit (0);
|
|
||||||
|
$id = '';
|
||||||
$id = '';
|
if (isset( $_POST['id'] ))
|
||||||
if ( isset($_POST['id'] ) ) $id = $_POST['id'];
|
$id = $_POST['id'];
|
||||||
|
|
||||||
G::LoadClass('languages');
|
G::LoadClass( 'languages' );
|
||||||
G::LoadSystem('database_mysql');
|
G::LoadSystem( 'database_mysql' );
|
||||||
|
|
||||||
$aUpgradeData = unserialize( file_get_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" ));
|
$aUpgradeData = unserialize( file_get_contents( PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin" ) );
|
||||||
$aWorkspaces = $aUpgradeData['workspaces'];
|
$aWorkspaces = $aUpgradeData['workspaces'];
|
||||||
|
|
||||||
if ( is_array ( $aWorkspaces ) && count($aWorkspaces) > 0 ) {
|
if (is_array( $aWorkspaces ) && count( $aWorkspaces ) > 0) {
|
||||||
$workspace = array_shift ( $aUpgradeData['workspaces']);
|
$workspace = array_shift( $aUpgradeData['workspaces'] );
|
||||||
|
|
||||||
eval ( getDatabaseCredentials(PATH_DB . $workspace . PATH_SEP . 'db.php')) ;
|
eval( getDatabaseCredentials( PATH_DB . $workspace . PATH_SEP . 'db.php' ) );
|
||||||
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
|
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
|
||||||
$oDataBase->iFetchType = MYSQL_NUM;
|
$oDataBase->iFetchType = MYSQL_NUM;
|
||||||
|
|
||||||
//processing .po file
|
//processing .po file
|
||||||
if ( $aUpgradeData['sPoFile'] != '' ) {
|
if ($aUpgradeData['sPoFile'] != '') {
|
||||||
$oLanguages = new languages();
|
$oLanguages = new languages();
|
||||||
$oLanguages->importLanguage($aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] );
|
$oLanguages->importLanguage( $aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile'] );
|
||||||
$aUpgradeData['bForceXmlPoFile'] = false;
|
$aUpgradeData['bForceXmlPoFile'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aUpgradeData['sSchemaFile'] != '')
|
if ($aUpgradeData['sSchemaFile'] != '')
|
||||||
processMasterSchemaFile( $aUpgradeData['sSchemaFile'] );
|
processMasterSchemaFile( $aUpgradeData['sSchemaFile'] );
|
||||||
|
|
||||||
|
//draw a gauge control indicating the progress in workspaces
|
||||||
//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 "<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='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 "<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>";
|
||||||
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 ) );
|
||||||
file_put_contents (PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize($aUpgradeData) );
|
} else {
|
||||||
}
|
print "<table cellpadding=0><tr><td> </td><td>";
|
||||||
else {
|
print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
|
||||||
print "<table cellpadding=0><tr><td> </td><td>";
|
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 "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
|
print "</td><td> Finished! All workspaces were upgraded successfully.</td></tr></table>";
|
||||||
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 = file_get_contents( $dbFile );
|
$sContent = str_replace( '<?php', '', $sContent );
|
||||||
$sContent = str_replace('<?php', '', $sContent);
|
$sContent = str_replace( '<?', '', $sContent );
|
||||||
$sContent = str_replace('<?', '', $sContent);
|
$sContent = str_replace( '?>', '', $sContent );
|
||||||
$sContent = str_replace('?>', '', $sContent);
|
$sContent = str_replace( 'define', '', $sContent );
|
||||||
$sContent = str_replace('define', '', $sContent);
|
$sContent = str_replace( "('", '$', $sContent );
|
||||||
$sContent = str_replace("('", '$', $sContent);
|
$sContent = str_replace( "',", '=', $sContent );
|
||||||
$sContent = str_replace("',", '=', $sContent);
|
$sContent = str_replace( ");", ';', $sContent );
|
||||||
$sContent = str_replace(");", ';', $sContent);
|
return $sContent;
|
||||||
return $sContent;
|
}
|
||||||
}
|
|
||||||
|
function processMasterSchemaFile ($sSchemaFile)
|
||||||
function processMasterSchemaFile ( $sSchemaFile ) {
|
{
|
||||||
global $DB_ADAPTER;
|
global $DB_ADAPTER;
|
||||||
global $DB_HOST;
|
global $DB_HOST;
|
||||||
global $DB_USER;
|
global $DB_USER;
|
||||||
global $DB_PASS;
|
global $DB_PASS;
|
||||||
global $DB_NAME;
|
global $DB_NAME;
|
||||||
global $aUpgradeData;
|
global $aUpgradeData;
|
||||||
|
|
||||||
//convert newSchema to array
|
//convert newSchema to array
|
||||||
if ( isset($aUpgradeData['aNewSchema']) ) {
|
if (isset( $aUpgradeData['aNewSchema'] )) {
|
||||||
$aNewSchema = $aUpgradeData['aNewSchema'];
|
$aNewSchema = $aUpgradeData['aNewSchema'];
|
||||||
}
|
} else {
|
||||||
else {
|
$aNewSchema = schemaToArray( $sSchemaFile );
|
||||||
$aNewSchema = schemaToArray($sSchemaFile);
|
$aUpgradeData['aNewSchema'] = $aNewSchema;
|
||||||
$aUpgradeData['aNewSchema'] = $aNewSchema;
|
}
|
||||||
}
|
$aOldSchema = processSchemaFile();
|
||||||
$aOldSchema = processSchemaFile();
|
if (is_null( $aOldSchema )) {
|
||||||
if ( is_null($aOldSchema) ) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
$aChanges = obtainChanges( $aOldSchema, $aNewSchema );
|
||||||
$aChanges = obtainChanges($aOldSchema, $aNewSchema);
|
|
||||||
|
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
|
||||||
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
|
if (! $oDataBase->isConnected()) {
|
||||||
if ( !$oDataBase->isConnected() ) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
$oDataBase->iFetchType = MYSQL_NUM;
|
||||||
$oDataBase->iFetchType = MYSQL_NUM;
|
|
||||||
|
$oDataBase->logQuery( count( $aChanges ) );
|
||||||
$oDataBase->logQuery ( count ($aChanges ) );
|
|
||||||
|
foreach ($aChanges['tablesToAdd'] as $sTable => $aColumns) {
|
||||||
foreach ($aChanges['tablesToAdd'] as $sTable => $aColumns) {
|
$oDataBase->executeQuery( $oDataBase->generateCreateTableSQL( $sTable, $aColumns ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateCreateTableSQL($sTable, $aColumns));
|
if (isset( $aChanges['tablesToAdd'][$sTable]['INDEXES'] )) {
|
||||||
if (isset($aChanges['tablesToAdd'][$sTable]['INDEXES'])) {
|
foreach ($aChanges['tablesToAdd'][$sTable]['INDEXES'] as $indexName => $aIndex) {
|
||||||
foreach ($aChanges['tablesToAdd'][$sTable]['INDEXES'] as $indexName => $aIndex) {
|
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $indexName, $aIndex ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $indexName, $aIndex ) );
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach ($aChanges['tablesToAlter'] as $sTable => $aActions) {
|
||||||
foreach ($aChanges['tablesToAlter'] as $sTable => $aActions) {
|
foreach ($aActions as $sAction => $aAction) {
|
||||||
foreach ($aActions as $sAction => $aAction) {
|
foreach ($aAction as $sColumn => $vData) {
|
||||||
foreach ($aAction as $sColumn => $vData) {
|
switch ($sAction) {
|
||||||
switch ($sAction) {
|
case 'DROP':
|
||||||
case 'DROP':
|
$oDataBase->executeQuery( $oDataBase->generateDropColumnSQL( $sTable, $vData ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateDropColumnSQL($sTable, $vData));
|
break;
|
||||||
break;
|
case 'ADD':
|
||||||
case 'ADD':
|
$oDataBase->executeQuery( $oDataBase->generateAddColumnSQL( $sTable, $sColumn, $vData ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateAddColumnSQL($sTable, $sColumn, $vData));
|
break;
|
||||||
break;
|
case 'CHANGE':
|
||||||
case 'CHANGE':
|
$oDataBase->executeQuery( $oDataBase->generateChangeColumnSQL( $sTable, $sColumn, $vData ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateChangeColumnSQL($sTable, $sColumn, $vData));
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach ($aChanges['tablesWithNewIndex'] as $sTable => $aIndexes) {
|
||||||
foreach ($aChanges['tablesWithNewIndex'] as $sTable => $aIndexes) {
|
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
||||||
foreach ($aIndexes as $sIndexName => $aIndexFields ) {
|
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields ));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
foreach ($aChanges['tablesToAlterIndex'] as $sTable => $aIndexes) {
|
||||||
foreach ($aChanges['tablesToAlterIndex'] as $sTable => $aIndexes) {
|
foreach ($aIndexes as $sIndexName => $aIndexFields) {
|
||||||
foreach ($aIndexes as $sIndexName => $aIndexFields ) {
|
$oDataBase->executeQuery( $oDataBase->generateDropKeySQL( $sTable, $sIndexName ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateDropKeySQL($sTable, $sIndexName ));
|
$oDataBase->executeQuery( $oDataBase->generateAddKeysSQL( $sTable, $sIndexName, $aIndexFields ) );
|
||||||
$oDataBase->executeQuery($oDataBase->generateAddKeysSQL($sTable, $sIndexName, $aIndexFields ));
|
}
|
||||||
}
|
}
|
||||||
}
|
$oDataBase->close();
|
||||||
$oDataBase->close();
|
}
|
||||||
}
|
|
||||||
|
function processSchemaFile ()
|
||||||
|
{
|
||||||
function processSchemaFile( ) {
|
global $DB_ADAPTER;
|
||||||
global $DB_ADAPTER;
|
global $DB_HOST;
|
||||||
global $DB_HOST;
|
global $DB_USER;
|
||||||
global $DB_USER;
|
global $DB_PASS;
|
||||||
global $DB_PASS;
|
global $DB_NAME;
|
||||||
global $DB_NAME;
|
|
||||||
|
try {
|
||||||
try {
|
G::LoadSystem( 'database_' . strtolower( $DB_ADAPTER ) );
|
||||||
G::LoadSystem( 'database_' . strtolower($DB_ADAPTER));
|
|
||||||
|
$aOldSchema = array ();
|
||||||
$aOldSchema = array();
|
$oDataBase = new database( $DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME );
|
||||||
$oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
|
|
||||||
|
if (! $oDataBase->isConnected()) {
|
||||||
if ( !$oDataBase->isConnected() ) {
|
$oDataBase->logQuery( 'Does not exist an available connection!' );
|
||||||
$oDataBase->logQuery ('Does not exist an available connection!');
|
return null;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
$oDataBase->iFetchType = MYSQL_NUM;
|
||||||
$oDataBase->iFetchType = MYSQL_NUM;
|
$oDataset1 = $oDataBase->executeQuery( $oDataBase->generateShowTablesSQL() );
|
||||||
$oDataset1 = $oDataBase->executeQuery($oDataBase->generateShowTablesSQL());
|
|
||||||
|
} catch (Exception $e) {
|
||||||
} catch ( Exception $e ) {
|
$oDataBase->logQuery( $e->getmessage() );
|
||||||
$oDataBase->logQuery ( $e->getmessage() );
|
return null;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
//going thru all tables in current WF_ database
|
||||||
//going thru all tables in current WF_ database
|
while ($aRow1 = $oDataBase->getRegistry( $oDataset1 )) {
|
||||||
while ($aRow1 = $oDataBase->getRegistry( $oDataset1) ) {
|
$aPrimaryKeys = array ();
|
||||||
$aPrimaryKeys = array();
|
$sTable = strtoupper( $aRow1[0] );
|
||||||
$sTable = strtoupper($aRow1[0]);
|
|
||||||
|
//get description of each table, ( column and primary keys )
|
||||||
//get description of each table, ( column and primary keys )
|
//$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($aRow1[0]) );
|
||||||
//$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($aRow1[0]) );
|
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL( $sTable ) );
|
||||||
$oDataset2 = $oDataBase->executeQuery( $oDataBase->generateDescTableSQL($sTable ) );
|
$aOldSchema[$sTable] = array ();
|
||||||
$aOldSchema[ $sTable ] = array();
|
$oDataBase->iFetchType = MYSQL_ASSOC;
|
||||||
$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']]['Field'] = $aRow2['Field'];
|
$aOldSchema[$sTable][$aRow2['Field']]['Type'] = $aRow2['Type'];
|
||||||
$aOldSchema[$sTable][$aRow2['Field']]['Type'] = $aRow2['Type'];
|
$aOldSchema[$sTable][$aRow2['Field']]['Null'] = $aRow2['Null'];
|
||||||
$aOldSchema[$sTable][$aRow2['Field']]['Null'] = $aRow2['Null'];
|
$aOldSchema[$sTable][$aRow2['Field']]['Default'] = $aRow2['Default'];
|
||||||
$aOldSchema[$sTable][$aRow2['Field']]['Default'] = $aRow2['Default'];
|
}
|
||||||
}
|
|
||||||
|
//get indexes of each table SHOW INDEX FROM `ADDITIONAL_TABLES`; -- WHERE Key_name <> 'PRIMARY'
|
||||||
//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;
|
||||||
$oDataBase->iFetchType = MYSQL_ASSOC;
|
while ($aRow2 = $oDataBase->getRegistry( $oDataset2 )) {
|
||||||
while ($aRow2 = $oDataBase->getRegistry($oDataset2)) {
|
if (! isset( $aOldSchema[$sTable]['INDEXES'] )) {
|
||||||
if ( !isset($aOldSchema[$sTable]['INDEXES']) ) {
|
$aOldSchema[$sTable]['INDEXES'] = array ();
|
||||||
$aOldSchema[$sTable]['INDEXES'] = array();
|
}
|
||||||
}
|
if (! isset( $aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] )) {
|
||||||
if (!isset($aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] ) ) {
|
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array ();
|
||||||
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']] = array();
|
}
|
||||||
}
|
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']][] = $aRow2['Column_name'];
|
||||||
$aOldSchema[$sTable]['INDEXES'][$aRow2['Key_name']][] = $aRow2['Column_name'];
|
}
|
||||||
}
|
|
||||||
|
$oDataBase->iFetchType = MYSQL_NUM; //this line is neccesary because the next fetch needs to be with MYSQL_NUM
|
||||||
$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
|
||||||
//finally return the array with old schema obtained from the Database
|
if (count( $aOldSchema ) == 0)
|
||||||
if ( count($aOldSchema) == 0 ) $aOldSchema = null;
|
$aOldSchema = null;
|
||||||
return $aOldSchema;
|
return $aOldSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
//process the schema file in the patch file, and obtain an array
|
//process the schema file in the patch file, and obtain an array
|
||||||
function schemaToArray($sSchemaFile) {
|
function schemaToArray ($sSchemaFile)
|
||||||
try {
|
{
|
||||||
$aSchema = array();
|
try {
|
||||||
$oXml = new DomDocument();
|
$aSchema = array ();
|
||||||
$oXml->load($sSchemaFile);
|
$oXml = new DomDocument();
|
||||||
$aTables = $oXml->getElementsByTagName('table');
|
$oXml->load( $sSchemaFile );
|
||||||
foreach ($aTables as $oTable) {
|
$aTables = $oXml->getElementsByTagName( 'table' );
|
||||||
$aPrimaryKeys = array();
|
foreach ($aTables as $oTable) {
|
||||||
$sTableName = $oTable->getAttribute('name');
|
$aPrimaryKeys = array ();
|
||||||
$aSchema[$sTableName] = array();
|
$sTableName = $oTable->getAttribute( 'name' );
|
||||||
$aColumns = $oTable->getElementsByTagName('column');
|
$aSchema[$sTableName] = array ();
|
||||||
foreach ($aColumns as $oColumn) {
|
$aColumns = $oTable->getElementsByTagName( 'column' );
|
||||||
$sColumName = $oColumn->getAttribute('name');
|
foreach ($aColumns as $oColumn) {
|
||||||
$aSchema[$sTableName][$sColumName] = array();
|
$sColumName = $oColumn->getAttribute( 'name' );
|
||||||
$aVendors = $oColumn->getElementsByTagName('vendor');
|
$aSchema[$sTableName][$sColumName] = array ();
|
||||||
foreach ($aVendors as $oVendor) {
|
$aVendors = $oColumn->getElementsByTagName( 'vendor' );
|
||||||
if ($oVendor->getAttribute('type') == DB_ADAPTER) {
|
foreach ($aVendors as $oVendor) {
|
||||||
break;
|
if ($oVendor->getAttribute( 'type' ) == DB_ADAPTER) {
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
$aParameters = $oColumn->getElementsByTagName('parameter');
|
}
|
||||||
foreach ($aParameters as $oParameter) {
|
$aParameters = $oColumn->getElementsByTagName( 'parameter' );
|
||||||
$parameterName = ucwords($oParameter->getAttribute('name'));
|
foreach ($aParameters as $oParameter) {
|
||||||
if ( $parameterName == 'Key' && strtoupper($oParameter->getAttribute('value')) == 'PRI' ) {
|
$parameterName = ucwords( $oParameter->getAttribute( 'name' ) );
|
||||||
$aPrimaryKeys[] = $oColumn->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 ) {
|
}
|
||||||
$aSchema[$sTableName]['INDEXES']['PRIMARY'] = $aPrimaryKeys;
|
|
||||||
}
|
if (is_array( $aPrimaryKeys ) && count( $aPrimaryKeys ) > 0) {
|
||||||
$aIndexes = $oTable->getElementsByTagName('index');
|
$aSchema[$sTableName]['INDEXES']['PRIMARY'] = $aPrimaryKeys;
|
||||||
foreach ($aIndexes as $oIndex) {
|
}
|
||||||
$aIndex = array();
|
$aIndexes = $oTable->getElementsByTagName( 'index' );
|
||||||
$aIndexesColumns = $oIndex->getElementsByTagName('index-column');
|
foreach ($aIndexes as $oIndex) {
|
||||||
foreach ($aIndexesColumns as $oIndexColumn) {
|
$aIndex = array ();
|
||||||
$aIndex[] = $oIndexColumn->getAttribute('name');
|
$aIndexesColumns = $oIndex->getElementsByTagName( 'index-column' );
|
||||||
}
|
foreach ($aIndexesColumns as $oIndexColumn) {
|
||||||
$aSchema[$sTableName]['INDEXES'][ $oIndex->getAttribute('name') ] = $aIndex;
|
$aIndex[] = $oIndexColumn->getAttribute( 'name' );
|
||||||
}
|
}
|
||||||
}
|
$aSchema[$sTableName]['INDEXES'][$oIndex->getAttribute( 'name' )] = $aIndex;
|
||||||
return $aSchema;
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $oError) {
|
return $aSchema;
|
||||||
throw $oError;
|
} catch (Exception $oError) {
|
||||||
}
|
throw $oError;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function obtainChanges($aOldSchema, $aNewSchema) {
|
|
||||||
//$aChanges = array('tablesToDelete' => array(), 'tablesToAdd' => array(), 'tablesToAlter' => array());
|
function obtainChanges ($aOldSchema, $aNewSchema)
|
||||||
//Tables to delete, but this is disabled
|
{
|
||||||
//foreach ($aOldSchema as $sTableName => $aColumns) {
|
//$aChanges = array('tablesToDelete' => array(), 'tablesToAdd' => array(), 'tablesToAlter' => array());
|
||||||
// if ( !isset($aNewSchema[$sTableName])) {
|
//Tables to delete, but this is disabled
|
||||||
// if (!in_array($sTableName, array('KT_APPLICATION', 'KT_DOCUMENT', 'KT_PROCESS'))) {
|
//foreach ($aOldSchema as $sTableName => $aColumns) {
|
||||||
// $aChanges['tablesToDelete'][] = $sTableName;
|
// if ( !isset($aNewSchema[$sTableName])) {
|
||||||
// }
|
// if (!in_array($sTableName, array('KT_APPLICATION', 'KT_DOCUMENT', 'KT_PROCESS'))) {
|
||||||
// }
|
// $aChanges['tablesToDelete'][] = $sTableName;
|
||||||
//}
|
// }
|
||||||
|
// }
|
||||||
$aChanges = array('tablesToAdd' => array(), 'tablesToAlter' => array(), 'tablesWithNewIndex' => array(), 'tablesToAlterIndex'=> array());
|
//}
|
||||||
|
|
||||||
//new tables to create and alter
|
|
||||||
foreach ($aNewSchema as $sTableName => $aColumns) {
|
$aChanges = array ('tablesToAdd' => array (),'tablesToAlter' => array (),'tablesWithNewIndex' => array (),'tablesToAlterIndex' => array ()
|
||||||
if (!isset($aOldSchema[$sTableName])) {
|
);
|
||||||
$aChanges['tablesToAdd'][$sTableName] = $aColumns;
|
|
||||||
}
|
//new tables to create and alter
|
||||||
else {
|
foreach ($aNewSchema as $sTableName => $aColumns) {
|
||||||
//drop old columns
|
if (! isset( $aOldSchema[$sTableName] )) {
|
||||||
foreach ($aOldSchema[$sTableName] as $sColumName => $aParameters) {
|
$aChanges['tablesToAdd'][$sTableName] = $aColumns;
|
||||||
if (!isset($aNewSchema[$sTableName][$sColumName])) {
|
} else {
|
||||||
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
|
//drop old columns
|
||||||
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
|
foreach ($aOldSchema[$sTableName] as $sColumName => $aParameters) {
|
||||||
}
|
if (! isset( $aNewSchema[$sTableName][$sColumName] )) {
|
||||||
$aChanges['tablesToAlter'][$sTableName]['DROP'][$sColumName] = $sColumName;
|
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
|
||||||
}
|
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
|
||||||
}
|
);
|
||||||
|
}
|
||||||
//create new columns
|
$aChanges['tablesToAlter'][$sTableName]['DROP'][$sColumName] = $sColumName;
|
||||||
//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
|
//create new columns
|
||||||
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
|
//foreach ($aNewSchema[$sTableName] as $sColumName => $aParameters) {
|
||||||
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
|
foreach ($aColumns as $sColumName => $aParameters) {
|
||||||
}
|
if ($sColumName != 'INDEXES') {
|
||||||
$aChanges['tablesToAlter'][$sTableName]['ADD'][$sColumName] = $aParameters;
|
if (! isset( $aOldSchema[$sTableName][$sColumName] )) { //this column doesnt exist in oldschema
|
||||||
}
|
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
|
||||||
else { //the column exists
|
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
|
||||||
$newField = $aNewSchema[$sTableName][$sColumName];
|
);
|
||||||
$oldField = $aOldSchema[$sTableName][$sColumName];
|
}
|
||||||
//both are null, no change is required
|
$aChanges['tablesToAlter'][$sTableName]['ADD'][$sColumName] = $aParameters;
|
||||||
if ( !isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = false;
|
} else { //the column exists
|
||||||
//one of them is null, change IS required
|
$newField = $aNewSchema[$sTableName][$sColumName];
|
||||||
if ( !isset($newField['Default']) && isset($oldField['Default']) && $oldField['Default']!= '') $changeDefaultAttr = true;
|
$oldField = $aOldSchema[$sTableName][$sColumName];
|
||||||
if ( isset($newField['Default']) && !isset($oldField['Default'])) $changeDefaultAttr = true;
|
//both are null, no change is required
|
||||||
//both are defined and they are different.
|
if (! isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
|
||||||
if ( isset($newField['Default']) && isset($oldField['Default']) ) {
|
$changeDefaultAttr = false;
|
||||||
if ( $newField['Default'] != $oldField['Default'] )
|
//one of them is null, change IS required
|
||||||
$changeDefaultAttr = true;
|
if (! isset( $newField['Default'] ) && isset( $oldField['Default'] ) && $oldField['Default'] != '')
|
||||||
else
|
$changeDefaultAttr = true;
|
||||||
$changeDefaultAttr = false;
|
if (isset( $newField['Default'] ) && ! isset( $oldField['Default'] ))
|
||||||
}
|
$changeDefaultAttr = true;
|
||||||
//special cases
|
//both are defined and they are different.
|
||||||
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html
|
if (isset( $newField['Default'] ) && isset( $oldField['Default'] )) {
|
||||||
if ( in_array(strtolower($newField['Type']), array('text','mediumtext') ) )
|
if ($newField['Default'] != $oldField['Default'])
|
||||||
$changeDefaultAttr = false;
|
$changeDefaultAttr = true;
|
||||||
|
else
|
||||||
//#1067 - Invalid default value for datetime field
|
$changeDefaultAttr = false;
|
||||||
if ( in_array($newField['Type'], array('datetime')) && isset($newField['Default']) && $newField['Default']== '' )
|
}
|
||||||
$changeDefaultAttr = false;
|
//special cases
|
||||||
|
// BLOB and TEXT columns cannot have DEFAULT values. http://dev.mysql.com/doc/refman/5.0/en/blob.html
|
||||||
//#1067 - Invalid default value for int field
|
if (in_array( strtolower( $newField['Type'] ), array ('text','mediumtext'
|
||||||
if ( substr($newField['Type'], 0, 3 ) && isset($newField['Default']) && $newField['Default']== '' )
|
) ))
|
||||||
$changeDefaultAttr = false;
|
$changeDefaultAttr = false;
|
||||||
|
|
||||||
//if any difference exists, then insert the difference in aChanges
|
//#1067 - Invalid default value for datetime field
|
||||||
if ( $newField['Field'] != $oldField['Field'] ||
|
if (in_array( $newField['Type'], array ('datetime'
|
||||||
$newField['Type'] != $oldField['Type'] ||
|
) ) && isset( $newField['Default'] ) && $newField['Default'] == '')
|
||||||
$newField['Null'] != $oldField['Null'] ||
|
$changeDefaultAttr = false;
|
||||||
$changeDefaultAttr ) {
|
|
||||||
if (!isset($aChanges['tablesToAlter'][$sTableName])) {
|
//#1067 - Invalid default value for int field
|
||||||
$aChanges['tablesToAlter'][$sTableName] = array('DROP' => array(), 'ADD' => array(), 'CHANGE' => array());
|
if (substr( $newField['Type'], 0, 3 ) && isset( $newField['Default'] ) && $newField['Default'] == '')
|
||||||
}
|
$changeDefaultAttr = false;
|
||||||
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Field'] = $newField['Field'];
|
|
||||||
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Type'] = $newField['Type'];
|
//if any difference exists, then insert the difference in aChanges
|
||||||
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Null'] = $newField['Null'];
|
if ($newField['Field'] != $oldField['Field'] || $newField['Type'] != $oldField['Type'] || $newField['Null'] != $oldField['Null'] || $changeDefaultAttr) {
|
||||||
if ( isset($newField['Default']) )
|
if (! isset( $aChanges['tablesToAlter'][$sTableName] )) {
|
||||||
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = $newField['Default'];
|
$aChanges['tablesToAlter'][$sTableName] = array ('DROP' => array (),'ADD' => array (),'CHANGE' => array ()
|
||||||
else
|
);
|
||||||
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = null;
|
}
|
||||||
|
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Field'] = $newField['Field'];
|
||||||
}
|
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Type'] = $newField['Type'];
|
||||||
}
|
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Null'] = $newField['Null'];
|
||||||
} //only columns, no the indexes column
|
if (isset( $newField['Default'] ))
|
||||||
}//foreach $aColumns
|
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = $newField['Default'];
|
||||||
|
else
|
||||||
//now check the indexes of table
|
$aChanges['tablesToAlter'][$sTableName]['CHANGE'][$sColumName]['Default'] = null;
|
||||||
if ( isset($aNewSchema[$sTableName]['INDEXES']) ) {
|
|
||||||
foreach ( $aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields ) {
|
}
|
||||||
if (!isset( $aOldSchema[$sTableName]['INDEXES'][$indexName]) ) {
|
}
|
||||||
if (!isset($aChanges['tablesWithNewIndex'][$sTableName])) {
|
} //only columns, no the indexes column
|
||||||
$aChanges['tablesWithNewIndex'][$sTableName] = array();
|
} //foreach $aColumns
|
||||||
}
|
|
||||||
$aChanges['tablesWithNewIndex'][$sTableName][$indexName] = $indexFields;
|
|
||||||
}
|
//now check the indexes of table
|
||||||
else {
|
if (isset( $aNewSchema[$sTableName]['INDEXES'] )) {
|
||||||
if ( $aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields ) {
|
foreach ($aNewSchema[$sTableName]['INDEXES'] as $indexName => $indexFields) {
|
||||||
if (!isset($aChanges['tablesToAlterIndex'][$sTableName])) {
|
if (! isset( $aOldSchema[$sTableName]['INDEXES'][$indexName] )) {
|
||||||
$aChanges['tablesToAlterIndex'][$sTableName] = array();
|
if (! isset( $aChanges['tablesWithNewIndex'][$sTableName] )) {
|
||||||
}
|
$aChanges['tablesWithNewIndex'][$sTableName] = array ();
|
||||||
$aChanges['tablesToAlterIndex'][$sTableName][$indexName] = $indexFields;
|
}
|
||||||
}
|
$aChanges['tablesWithNewIndex'][$sTableName][$indexName] = $indexFields;
|
||||||
}
|
} else {
|
||||||
}
|
if ($aOldSchema[$sTableName]['INDEXES'][$indexName] != $indexFields) {
|
||||||
}
|
if (! isset( $aChanges['tablesToAlterIndex'][$sTableName] )) {
|
||||||
} //for-else table exists
|
$aChanges['tablesToAlterIndex'][$sTableName] = array ();
|
||||||
} //for new schema
|
}
|
||||||
return $aChanges;
|
$aChanges['tablesToAlterIndex'][$sTableName][$indexName] = $indexFields;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} //for-else table exists
|
||||||
|
} //for new schema
|
||||||
|
return $aChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,50 +12,50 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//calculating the max upload file size;
|
global $RBAC;
|
||||||
$POST_MAX_SIZE = ini_get('post_max_size');
|
G::LoadClass( 'replacementLogo' );
|
||||||
$mul = substr($POST_MAX_SIZE, -1);
|
|
||||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
|
||||||
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
|
|
||||||
|
|
||||||
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
|
|
||||||
$mul = substr($UPLOAD_MAX_SIZE, -1);
|
|
||||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
|
||||||
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
|
|
||||||
|
|
||||||
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
|
||||||
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
$G_MAIN_MENU = 'processmaker';
|
//calculating the max upload file size;
|
||||||
$G_SUB_MENU = 'setup';
|
$POST_MAX_SIZE = ini_get( 'post_max_size' );
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
$mul = substr( $POST_MAX_SIZE, - 1 );
|
||||||
$G_ID_SUB_MENU_SELECTED = 'LOGO';
|
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||||
|
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
|
||||||
$G_PUBLISH = new Publisher;
|
|
||||||
$oHeadPublisher =& headPublisher::getSingleton();
|
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/uplogo', '', $Fields );
|
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
|
||||||
|
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||||
$G_PUBLISH->AddContent('view', 'setup/uplogo' );
|
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||||
G::RenderPage( "publishBlank", "blank");
|
|
||||||
|
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_PUBLISH = new Publisher();
|
||||||
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/uplogo', '', $Fields );
|
||||||
|
|
||||||
|
$G_PUBLISH->AddContent( 'view', 'setup/uplogo' );
|
||||||
|
G::RenderPage( "publishBlank", "blank" );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
@@ -63,22 +63,22 @@
|
|||||||
* By krlos April 07, 2010
|
* By krlos April 07, 2010
|
||||||
* we're going to change to the logo choosed
|
* we're going to change to the logo choosed
|
||||||
* parameter logo name
|
* parameter logo name
|
||||||
*/
|
*/
|
||||||
var changeLogo= function (nameLogo){
|
var changeLogo= function (nameLogo){
|
||||||
new leimnud.module.app.confirm().make({
|
new leimnud.module.app.confirm().make({
|
||||||
label:G_STRINGS.ID_APPLY_LOGO,
|
label:G_STRINGS.ID_APPLY_LOGO,
|
||||||
action:function(){
|
action:function(){
|
||||||
ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ;
|
ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ;
|
||||||
parent.parent.window.location = 'main?s=LOGO';
|
parent.parent.window.location = 'main?s=LOGO';
|
||||||
}});
|
}});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By krlos April 07, 2010
|
* By krlos April 07, 2010
|
||||||
* to delete logo choosed
|
* to delete logo choosed
|
||||||
* parameter logo name
|
* parameter logo name
|
||||||
*/
|
*/
|
||||||
function deleteLogo(nameLogo) {
|
function deleteLogo(nameLogo) {
|
||||||
new leimnud.module.app.confirm().make({
|
new leimnud.module.app.confirm().make({
|
||||||
label:G_STRINGS.ID_REMOVE_LOGO,
|
label:G_STRINGS.ID_REMOVE_LOGO,
|
||||||
@@ -95,8 +95,9 @@
|
|||||||
* to put processmaker logo
|
* to put processmaker logo
|
||||||
* parameters file db and user id
|
* parameters file db and user id
|
||||||
*/
|
*/
|
||||||
var restoreLogo = function (optfiledb, usrUid){
|
var restoreLogo = function (optfiledb, usrUid){
|
||||||
ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ;
|
ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ;
|
||||||
window.location = 'uplogo';
|
window.location = 'uplogo';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,161 +1,158 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* control.php
|
* control.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY' ) != 1) {
|
||||||
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
//G::header('location: ../login/login');
|
||||||
//G::header('location: ../login/login');
|
die();
|
||||||
die;
|
}
|
||||||
}
|
|
||||||
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$G_MAIN_MENU = 'processmaker';
|
//$G_SUB_MENU = 'setup';
|
||||||
//$G_SUB_MENU = 'setup';
|
$G_ID_MENU_SELECTED = 'SETUP';
|
||||||
$G_ID_MENU_SELECTED = 'SETUP';
|
//$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
|
||||||
//$G_ID_SUB_MENU_SELECTED = 'WEBSERVICES';
|
|
||||||
|
|
||||||
if (!extension_loaded('soap')) {
|
if (! extension_loaded( 'soap' )) {
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/wsMessage');
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/wsMessage' );
|
||||||
G::RenderPage( "publish" );
|
G::RenderPage( "publish" );
|
||||||
}
|
} else {
|
||||||
else
|
$G_PUBLISH = new Publisher();
|
||||||
{
|
$G_PUBLISH->AddContent( 'view', 'setup/webServicesTree' );
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH->AddContent( 'smarty', 'groups/groups_usersList', '', '', array () );
|
||||||
$G_PUBLISH->AddContent('view', 'setup/webServicesTree' );
|
|
||||||
$G_PUBLISH->AddContent('smarty', 'groups/groups_usersList', '', '', array());
|
G::RenderPage( "publish-treeview", 'blank' );
|
||||||
|
}
|
||||||
G::RenderPage( "publish-treeview", 'blank');
|
|
||||||
}
|
$link_Edit = G::encryptlink( 'webServicesSetup' );
|
||||||
|
$link_List = G::encryptlink( 'webServicesList' );
|
||||||
$link_Edit = G::encryptlink('webServicesSetup');
|
|
||||||
$link_List = G::encryptlink('webServicesList');
|
?>
|
||||||
|
<script>
|
||||||
|
document.body.style.backgroundColor="#fff";
|
||||||
?>
|
var oAux = document.getElementById("publisherContent[0]");
|
||||||
<script>
|
oAux.id = "publisherContent[666]";
|
||||||
document.body.style.backgroundColor="#fff";
|
var currentGroup=false;
|
||||||
var oAux = document.getElementById("publisherContent[0]");
|
|
||||||
oAux.id = "publisherContent[666]";
|
function webServicesSetup(){
|
||||||
var currentGroup=false;
|
popupWindow('' , '<?php echo $link_Edit ?>' , 500 , 225 );
|
||||||
|
}
|
||||||
function webServicesSetup(){
|
|
||||||
popupWindow('' , '<?php echo $link_Edit ?>' , 500 , 225 );
|
function showFormWS( uid, element ){
|
||||||
}
|
|
||||||
|
currentGroup = uid;
|
||||||
function showFormWS( uid, element ){
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
|
url : '../setup/webServicesAjax',
|
||||||
currentGroup = uid;
|
async : false,
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
method: 'POST',
|
||||||
url : '../setup/webServicesAjax',
|
args : 'action=showForm&wsID=' + uid
|
||||||
async : false,
|
});
|
||||||
method: 'POST',
|
oRPC.make();
|
||||||
args : 'action=showForm&wsID=' + uid
|
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
||||||
});
|
if ((uid == 'NewCase') || (uid == 'NewCaseImpersonate')) {
|
||||||
oRPC.make();
|
var scs=oRPC.xmlhttp.responseText.extractScript();scs.evalScript();
|
||||||
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
}
|
||||||
if ((uid == 'NewCase') || (uid == 'NewCaseImpersonate')) {
|
}
|
||||||
var scs=oRPC.xmlhttp.responseText.extractScript();scs.evalScript();
|
function execWebService( uid) {
|
||||||
}
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
}
|
url : '../setup/webServicesAjax',
|
||||||
function execWebService( uid) {
|
async : true,
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
method: 'POST',
|
||||||
url : '../setup/webServicesAjax',
|
args : 'action=execWebService&wsID=' + uid
|
||||||
async : true,
|
});
|
||||||
method: 'POST',
|
|
||||||
args : 'action=execWebService&wsID=' + uid
|
oRPC.callback = function(rpc) {
|
||||||
});
|
|
||||||
|
var scs = rpc.xmlhttp.responseText.extractScript();
|
||||||
oRPC.callback = function(rpc) {
|
document.getElementById('spanUsersList').innerHTML = rpc.xmlhttp.responseText;
|
||||||
|
scs.evalScript();
|
||||||
var scs = rpc.xmlhttp.responseText.extractScript();
|
|
||||||
document.getElementById('spanUsersList').innerHTML = rpc.xmlhttp.responseText;
|
}.extend(this);
|
||||||
scs.evalScript();
|
|
||||||
|
oRPC.make();
|
||||||
}.extend(this);
|
|
||||||
|
}
|
||||||
oRPC.make();
|
|
||||||
|
submitThisForm = function(oForm) {
|
||||||
}
|
var oAux;
|
||||||
|
var bContinue = true;
|
||||||
submitThisForm = function(oForm) {
|
if(bContinue) {
|
||||||
var oAux;
|
result = ajax_post(oForm.action, oForm, 'POST', function(response){
|
||||||
var bContinue = true;
|
var scs = response.extractScript();
|
||||||
if(bContinue) {
|
document.getElementById('spanUsersList').innerHTML = response;
|
||||||
result = ajax_post(oForm.action, oForm, 'POST', function(response){
|
scs.evalScript();
|
||||||
var scs = response.extractScript();
|
});
|
||||||
document.getElementById('spanUsersList').innerHTML = response;
|
refreshTree();
|
||||||
scs.evalScript();
|
}
|
||||||
});
|
};
|
||||||
refreshTree();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
function callbackWebService( ) {
|
||||||
|
/*
|
||||||
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
function callbackWebService( ) {
|
url : '../setup/webServicesAjax',
|
||||||
/*
|
async : false,
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
method: 'POST',
|
||||||
url : '../setup/webServicesAjax',
|
args : 'action=execWebService&wsID=' + uid
|
||||||
async : false,
|
});
|
||||||
method: 'POST',
|
oRPC.make();
|
||||||
args : 'action=execWebService&wsID=' + uid
|
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
||||||
});
|
*/
|
||||||
oRPC.make();
|
document.getElementById('spanUsersList').innerHTML = 'hola';
|
||||||
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
}
|
||||||
*/
|
function saveGroup( form ) {
|
||||||
document.getElementById('spanUsersList').innerHTML = 'hola';
|
ajax_post( form.action, form, 'POST' );
|
||||||
}
|
currentPopupWindow.remove();
|
||||||
function saveGroup( form ) {
|
refreshTree();
|
||||||
ajax_post( form.action, form, 'POST' );
|
}
|
||||||
currentPopupWindow.remove();
|
|
||||||
refreshTree();
|
function refreshTree(){
|
||||||
}
|
tree.refresh( document.getElementById("publisherContent[666]") , '<?php echo $link_List ?>');
|
||||||
|
}
|
||||||
function refreshTree(){
|
|
||||||
tree.refresh( document.getElementById("publisherContent[666]") , '<?php echo $link_List ?>');
|
function showDetails(){
|
||||||
}
|
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||||
|
url : '../setup/webServicesAjax',
|
||||||
function showDetails(){
|
async : false,
|
||||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
method: 'POST',
|
||||||
url : '../setup/webServicesAjax',
|
args : 'action=showDetails'
|
||||||
async : false,
|
});
|
||||||
method: 'POST',
|
oRPC.make();
|
||||||
args : 'action=showDetails'
|
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
||||||
});
|
}
|
||||||
oRPC.make();
|
showDetails();
|
||||||
document.getElementById('spanUsersList').innerHTML = oRPC.xmlhttp.responseText;
|
|
||||||
}
|
function showUploadFilesForm(){
|
||||||
showDetails();
|
oIFrame = window.document.createElement('iframe');
|
||||||
|
oIFrame.style.border = '0';
|
||||||
function showUploadFilesForm(){
|
oIFrame.style.width = '700px';
|
||||||
oIFrame = window.document.createElement('iframe');
|
oIFrame.style.height = '400px';
|
||||||
oIFrame.style.border = '0';
|
oIFrame.src = 'webServicesAjax?action=showUploadFilesForm&';
|
||||||
oIFrame.style.width = '700px';
|
document.getElementById('spanUsersList').innerHTML = '';
|
||||||
oIFrame.style.height = '400px';
|
document.getElementById('spanUsersList').appendChild(oIFrame);
|
||||||
oIFrame.src = 'webServicesAjax?action=showUploadFilesForm&';
|
}
|
||||||
document.getElementById('spanUsersList').innerHTML = '';
|
|
||||||
document.getElementById('spanUsersList').appendChild(oIFrame);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* webServicesList.php
|
* webServicesList.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,25 +12,25 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_FACTORY') != 1){
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_FACTORY' ) != 1) {
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
//G::header('location: ../login/login');
|
//G::header('location: ../login/login');
|
||||||
die;
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
|
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher;
|
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
|
||||||
$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" );
|
||||||
|
|
||||||
|
|||||||
@@ -12,52 +12,52 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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();
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession($dbc);
|
$ses = new DBSession( $dbc );
|
||||||
|
|
||||||
if (!isset($_SESSION['END_POINT'])) {
|
if (! isset( $_SESSION['END_POINT'] )) {
|
||||||
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
|
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
|
||||||
$aFields['WS_WORKSPACE'] = SYS_SYS;
|
$aFields['WS_WORKSPACE'] = SYS_SYS;
|
||||||
}
|
} else {
|
||||||
else {
|
if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) {
|
||||||
if (strpos($_SESSION['END_POINT'], 'https') !== false) {
|
preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
|
||||||
preg_match('@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias);
|
} else {
|
||||||
|
preg_match( '@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
|
||||||
}
|
}
|
||||||
else {
|
$aAux = explode( ':', $coincidencias[1] );
|
||||||
preg_match('@^(?:http://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias);
|
$aFields['WS_HOST'] = $aAux[0];
|
||||||
}
|
$aFields['WS_PORT'] = (isset( $aAux[1] ) ? $aAux[1] : '');
|
||||||
$aAux = explode(':', $coincidencias[1]);
|
$aAux = explode( $aAux[0] . (isset( $aAux[1] ) ? ':' . $aAux[1] : ''), $_SESSION['END_POINT'] );
|
||||||
$aFields['WS_HOST'] = $aAux[0];
|
$aAux = explode( '/', $aAux[1] );
|
||||||
$aFields['WS_PORT'] = (isset($aAux[1]) ? $aAux[1] : '');
|
$aFields['WS_WORKSPACE'] = substr( $aAux[1], 3 );
|
||||||
$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' => 'char','name' => 'char','age' => 'integer','balance' => 'float'
|
||||||
$rows[] = array ( 'uid' => 'http', 'name' => 'http' );
|
);
|
||||||
$rows[] = array ( 'uid' => 'https', 'name' => 'https' );
|
$rows[] = array ('uid' => 'http','name' => 'http'
|
||||||
|
);
|
||||||
|
$rows[] = array ('uid' => 'https','name' => 'https'
|
||||||
|
);
|
||||||
|
|
||||||
$_DBArray['protocol'] = $rows;
|
$_DBArray['protocol'] = $rows;
|
||||||
$_SESSION['_DBArray'] = $_DBArray;
|
$_SESSION['_DBArray'] = $_DBArray;
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields , 'webServicesSetupSave');
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/webServicesSetup', '', $aFields, 'webServicesSetupSave' );
|
||||||
|
|
||||||
G::RenderPage( "publish" , "raw" );
|
G::RenderPage( "publish", "raw" );
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
unset($_SESSION['WS_SESSION_ID']);
|
unset( $_SESSION['WS_SESSION_ID'] );
|
||||||
|
|
||||||
if($_POST['form']['WS_PROTOCOL']!='' && $_POST['form']['WS_WORKSPACE']!='')
|
if ($_POST['form']['WS_PROTOCOL'] != '' && $_POST['form']['WS_WORKSPACE'] != '') {
|
||||||
{
|
if ($_POST['form']['WS_PORT'] != '') {
|
||||||
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' );
|
||||||
$_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] . ':' .$_POST['form']['WS_PORT'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2';
|
} else {
|
||||||
G::header('location: webServices?x=1');
|
$_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' );
|
||||||
else
|
}
|
||||||
{ $_SESSION['END_POINT']=$_POST['form']['WS_PROTOCOL'].'://' .$_POST['form']['WS_HOST'] .'/sys' .$_POST['form']['WS_WORKSPACE'].'/en/classic/services/wsdl2';
|
$_SESSION['WS_WORKSPACE'] = $_POST['form']['WS_WORKSPACE'];
|
||||||
G::header('location: webServices?x=1');
|
} else {
|
||||||
}
|
G::header( 'location: webServices?x=0' );
|
||||||
$_SESSION['WS_WORKSPACE']=$_POST['form']['WS_WORKSPACE'];
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
G::header('location: webServices?x=0');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* weekend.php
|
* weekend.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,40 +12,43 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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)
|
||||||
G::LoadInclude('ajax');
|
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[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['es'] = array ("Domingo?","Lunes?","Martes?","Miércoles?","Jueves?","Viernes?","Sábado?"
|
||||||
$ARR_WEEKDAYS['fa'] = array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه');
|
);
|
||||||
|
$ARR_WEEKDAYS['en'] = array ("Sunday?","Monday?","Tuesday?","Wednesday?","Thursday?","Friday?","Saturday?"
|
||||||
|
);
|
||||||
|
$ARR_WEEKDAYS['fa'] = array ('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه ','جمعه','آدینه'
|
||||||
|
);
|
||||||
|
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession($dbc);
|
$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();
|
$config = array ();
|
||||||
for($id=0;$id<7;$id++)
|
for ($id = 0; $id < 7; $id ++) {
|
||||||
{
|
$res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '" . $ARR_WEEKDAYS[0][$id] . "' AND LEX_TOPIC ='HOLIDAY' " );
|
||||||
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '".$ARR_WEEKDAYS[0][$id]."' AND LEX_TOPIC ='HOLIDAY' ");
|
$res = $res->read();
|
||||||
$res=$res->read();
|
$config[$ARR_WEEKDAYS[0][$id]] = $res['LEX_VALUE'];
|
||||||
$config[$ARR_WEEKDAYS[0][$id]]=$res['LEX_VALUE'];
|
|
||||||
}
|
}
|
||||||
$G_PUBLISH = new Publisher;
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/weekend', '',$config ,'' );
|
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/weekend', '', $config, '' );
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage( 'publish' );
|
||||||
?>
|
?>
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
@@ -77,14 +80,14 @@ function on_submit(myForm)
|
|||||||
}
|
}
|
||||||
function ajax_function(ajax_server, funcion, parameters)
|
function ajax_function(ajax_server, funcion, parameters)
|
||||||
{
|
{
|
||||||
objetus = get_xmlhttp();
|
objetus = get_xmlhttp();
|
||||||
var response;
|
var response;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (parameters) parameters = '&' + encodeURI(parameters);
|
if (parameters) parameters = '&' + encodeURI(parameters);
|
||||||
objetus.open("GET", ajax_server + "?function=" + funcion + parameters, false);
|
objetus.open("GET", ajax_server + "?function=" + funcion + parameters, false);
|
||||||
}catch(ss)
|
}catch(ss)
|
||||||
{
|
{
|
||||||
alert("error"+ss.message);
|
alert("error"+ss.message);
|
||||||
}
|
}
|
||||||
objetus.send(null);
|
objetus.send(null);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* weekendAjax.php
|
* weekendAjax.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,19 +12,19 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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::ForceLogin( 'WF_PROCESS' );
|
||||||
G::LoadInclude('ajax');
|
G::LoadInclude( 'ajax' );
|
||||||
|
|
||||||
$G_HELP_PAGE = "setup-environment-time-controls-weekend";
|
$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_SUB_MENU_SELECTED = "ENVIRONMENT";
|
||||||
$G_ID_THIRD_MENU_SELECTED = "WEEKEND";
|
$G_ID_THIRD_MENU_SELECTED = "WEEKEND";
|
||||||
|
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession($dbc);
|
$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'));
|
$funcion = strtolower( get_ajax_value( 'function' ) );
|
||||||
$funcions=get_defined_functions();
|
$funcions = get_defined_functions();
|
||||||
if (in_array($funcion,$funcions['user'])) eval($funcion.'();');
|
if (in_array( $funcion, $funcions['user'] ))
|
||||||
|
eval( $funcion . '();' );
|
||||||
|
|
||||||
function setDays()
|
function setDays ()
|
||||||
{
|
{
|
||||||
$days=get_ajax_value('days');
|
$days = get_ajax_value( 'days' );
|
||||||
$values=get_ajax_value('values');
|
$values = get_ajax_value( 'values' );
|
||||||
$days=explode(',',$days);
|
$days = explode( ',', $days );
|
||||||
$values=explode(',',$values);
|
$values = explode( ',', $values );
|
||||||
for($r=1;$r<sizeof($days);$r++)
|
for ($r = 1; $r < sizeof( $days ); $r ++)
|
||||||
setDay($days[$r],$values[$r]);
|
setDay( $days[$r], $values[$r] );
|
||||||
}
|
}
|
||||||
function setDay($day,$dayValue)
|
|
||||||
|
function setDay ($day, $dayValue)
|
||||||
{
|
{
|
||||||
global $ses;
|
global $ses;
|
||||||
$dayValue = (strcasecmp($dayValue,'true')==0)?1:0;
|
$dayValue = (strcasecmp( $dayValue, 'true' ) == 0) ? 1 : 0;
|
||||||
$res=$ses->execute(" SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' ");
|
$res = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
|
||||||
if ($res->count()==0)
|
if ($res->count() == 0)
|
||||||
$res=$ses->execute(" INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) ");
|
$res = $ses->execute( " INSERT INTO LEXICO (LEX_TOPIC, LEX_KEY, LEX_VALUE) VALUES ('HOLIDAY', '$day', $dayValue) " );
|
||||||
else
|
else
|
||||||
$res=$ses->execute(" UPDATE LEXICO SET LEX_VALUE = $dayValue WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' ");
|
$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 = $ses->execute( " SELECT * FROM LEXICO WHERE LEX_KEY = '$day' AND LEX_TOPIC ='HOLIDAY' " );
|
||||||
$res=$res->read();
|
$res = $res->read();
|
||||||
echo ($res['LEX_VALUE']=='1')?'true':'false';
|
echo ($res['LEX_VALUE'] == '1') ? 'true' : 'false';
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -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 ) {
|
// panel.clearContent();
|
||||||
/* commonDialog ( '', 'saved' , 'saved', {}, '' ) ;
|
// panel.addContent ( txt );
|
||||||
setTimeout ( leimnud.closure({instance:myDialog,method:function(panel){
|
return false;
|
||||||
|
|
||||||
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 );
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* workPeriod.php
|
* workPeriod.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,38 +12,38 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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)
|
||||||
$G_ENABLE_BLANK_SKIN = true;
|
return $RBAC_Response;
|
||||||
|
$G_ENABLE_BLANK_SKIN = true;
|
||||||
|
|
||||||
G::LoadClass( "workPeriod" );
|
G::LoadClass( "workPeriod" );
|
||||||
|
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession( $dbc );
|
$ses = new DBSession( $dbc );
|
||||||
$obj = new workPeriod( $dbc );
|
$obj = new workPeriod( $dbc );
|
||||||
|
|
||||||
$row = $obj->Load ();
|
|
||||||
|
|
||||||
$row['SUNDAY'] = $row['noWorkingDays'][0];
|
$row = $obj->Load();
|
||||||
$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;
|
$row['SUNDAY'] = $row['noWorkingDays'][0];
|
||||||
$G_PUBLISH->AddContent( "image", "image", "workPeriodGraph" );
|
$row['MONDAY'] = $row['noWorkingDays'][1];
|
||||||
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/workPeriod","", $row , "workPeriodSave" );
|
$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::RenderPage( 'publish' );
|
||||||
|
|
||||||
G::RenderPage( 'publish' );
|
|
||||||
?>
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* workPeriodGraph.php
|
* workPeriodGraph.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,91 +12,93 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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)
|
||||||
Header("Content-type: image/jpeg");
|
return $RBAC_Response;
|
||||||
|
Header( "Content-type: image/jpeg" );
|
||||||
|
|
||||||
G::LoadClass( "workPeriod" );
|
G::LoadClass( "workPeriod" );
|
||||||
|
|
||||||
$dbc = new DBConnection;
|
$dbc = new DBConnection();
|
||||||
$ses = new DBSession( $dbc );
|
$ses = new DBSession( $dbc );
|
||||||
$obj = new workPeriod( $dbc );
|
$obj = new workPeriod( $dbc );
|
||||||
|
|
||||||
$row = $obj->Load ();
|
|
||||||
|
|
||||||
$initPeriod1 = $row['initPeriod1']/ 60;
|
$row = $obj->Load();
|
||||||
$endPeriod1 = $row['endPeriod1'] / 60;
|
|
||||||
$initPeriod2 = $row['initPeriod2']/ 60;
|
|
||||||
$endPeriod2 = $row['endPeriod2'] / 60;
|
|
||||||
$noWorkingDays = $row['noWorkingDays'];
|
|
||||||
|
|
||||||
$cant = 7;
|
$initPeriod1 = $row['initPeriod1'] / 60;
|
||||||
|
$endPeriod1 = $row['endPeriod1'] / 60;
|
||||||
|
$initPeriod2 = $row['initPeriod2'] / 60;
|
||||||
|
$endPeriod2 = $row['endPeriod2'] / 60;
|
||||||
|
$noWorkingDays = $row['noWorkingDays'];
|
||||||
|
|
||||||
$w = 660;
|
$cant = 7;
|
||||||
$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);
|
|
||||||
|
|
||||||
|
$w = 660;
|
||||||
|
$h = $cant * 18 + 20;
|
||||||
|
$im = ImageCreate( $w, $h );
|
||||||
|
$width = $w;
|
||||||
|
$height = $h;
|
||||||
|
$center_x = intval( $width / 2 );
|
||||||
|
$center_y = intval( $height / 2 );
|
||||||
|
|
||||||
$x = 10; $y = 20;
|
$bgcolor = ImageColorAllocate( $im, 250, 250, 255 );
|
||||||
$x1 = 78;
|
$plomo = ImageColorAllocate( $im, 220, 220, 220 );
|
||||||
$x2 = $x1 + 2*6;
|
$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 );
|
||||||
|
|
||||||
$weekday[0] = 'Sunday';
|
$x = 10;
|
||||||
$weekday[1] = 'Monday';
|
$y = 20;
|
||||||
$weekday[2] = 'Tuesday';
|
$x1 = 78;
|
||||||
$weekday[3] = 'Wednesday';
|
$x2 = $x1 + 2 * 6;
|
||||||
$weekday[4] = 'Thursday';
|
|
||||||
$weekday[5] = 'Friday';
|
$weekday[0] = 'Sunday';
|
||||||
$weekday[6] = 'Saturday';
|
$weekday[1] = 'Monday';
|
||||||
|
$weekday[2] = 'Tuesday';
|
||||||
for ( $day = 0; $day < count ($weekday ); $day ++ ) {
|
$weekday[3] = 'Wednesday';
|
||||||
ImageString($im, 2, $x, $y, $weekday[$day], $black);
|
$weekday[4] = 'Thursday';
|
||||||
for ($i = 0; $i < 24*6; $i++) {
|
$weekday[5] = 'Friday';
|
||||||
ImageRectangle($im, $x1+$i* 4, $y, $x1+ ($i+1)*4, $y+12, $plomo );
|
$weekday[6] = 'Saturday';
|
||||||
if ( $i >= $initPeriod1 * 6 && $i < $endPeriod2 * 6 && ( $i < $endPeriod1 * 6 || $i >= $initPeriod2 * 6 ) )
|
|
||||||
$color = $orange;
|
for ($day = 0; $day < count( $weekday ); $day ++) {
|
||||||
else
|
ImageString( $im, 2, $x, $y, $weekday[$day], $black );
|
||||||
$color = $white;
|
for ($i = 0; $i < 24 * 6; $i ++) {
|
||||||
if ( isset ( $noWorkingDays[ $day ]) && $noWorkingDays[ $day ] ) $color = $white;
|
ImageRectangle( $im, $x1 + $i * 4, $y, $x1 + ($i + 1) * 4, $y + 12, $plomo );
|
||||||
ImageFillToBorder($im, $x1+$i*4+1, $y+1, $plomo, $color );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
$y+=18;
|
$y += 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
$y = 20;
|
$y = 20;
|
||||||
for ($i = 0; $i <= 24; $i++) {
|
for ($i = 0; $i <= 24; $i ++) {
|
||||||
ImageLine($im, $x1+$i* 4*6, $y-5, $x1+ $i*4*6, $y-5+18*$cant, $gris);
|
ImageLine( $im, $x1 + $i * 4 * 6, $y - 5, $x1 + $i * 4 * 6, $y - 5 + 18 * $cant, $gris );
|
||||||
if ( $i < 24 ) {
|
if ($i < 24) {
|
||||||
ImageLine($im, $x2+$i* 4*6, $y-5, $x2+ $i*4*6, $y-5+18*$cant, $plomo);
|
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, 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);
|
|
||||||
?>
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* workPeriodSave.php
|
* workPeriodSave.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
@@ -12,32 +12,32 @@
|
|||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* 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)
|
||||||
G::LoadClass( "workPeriod" );
|
return $RBAC_Response;
|
||||||
|
G::LoadClass( "workPeriod" );
|
||||||
|
|
||||||
$frm = $_POST['form'];
|
$frm = $_POST['form'];
|
||||||
$noWorkingDays[0] = isset ( $frm['SUNDAY'] ) && $frm['SUNDAY'] != '';
|
$noWorkingDays[0] = isset( $frm['SUNDAY'] ) && $frm['SUNDAY'] != '';
|
||||||
$noWorkingDays[1] = isset ( $frm['MONDAY'] ) && $frm['MONDAY'] != '';
|
$noWorkingDays[1] = isset( $frm['MONDAY'] ) && $frm['MONDAY'] != '';
|
||||||
$noWorkingDays[2] = isset ( $frm['TUESDAY'] ) && $frm['TUESDAY'] != '';
|
$noWorkingDays[2] = isset( $frm['TUESDAY'] ) && $frm['TUESDAY'] != '';
|
||||||
$noWorkingDays[3] = isset ( $frm['WEDNESDAY']) && $frm['WEDNESDAY'] != '';
|
$noWorkingDays[3] = isset( $frm['WEDNESDAY'] ) && $frm['WEDNESDAY'] != '';
|
||||||
$noWorkingDays[4] = isset ( $frm['THURSDAY'] ) && $frm['THURSDAY'] != '';
|
$noWorkingDays[4] = isset( $frm['THURSDAY'] ) && $frm['THURSDAY'] != '';
|
||||||
$noWorkingDays[5] = isset ( $frm['FRIDAY'] ) && $frm['FRIDAY'] != '';
|
$noWorkingDays[5] = isset( $frm['FRIDAY'] ) && $frm['FRIDAY'] != '';
|
||||||
$noWorkingDays[6] = isset ( $frm['SATURDAY'] ) && $frm['SATURDAY'] != '';
|
$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 );
|
||||||
|
|
||||||
|
print "ok";
|
||||||
|
die();
|
||||||
|
|
||||||
$dbc = new DBConnection();
|
|
||||||
$obj = new workPeriod( $dbc );
|
|
||||||
$obj->Save ( $frm['initPeriod1'], $frm['endPeriod1'], $frm['initPeriod2'], $frm['endPeriod2'], $noWorkingDays );
|
|
||||||
|
|
||||||
print "ok";
|
|
||||||
die;
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user