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

FILES:
holiday.php
holidayNew.php
index.php
jasper.php
language.php
language_Ajax.php
languages.php
languages_Delete.php
languages_Export.php
languages_Import.php
languages_ImportForm.php
location.php
loginSettings.php
loginSettingsAjax.php
logo_Delete.php
main.php
mainAjax.php
main_init.php
pluginsChange.php
pluginsImport.php
pluginsImportFile.php
pluginsList.php
pluginsMain.php
pluginsRemove.php
pluginsSetup.php
pluginsSetupSave.php
processHeartBeatAjax.php
processHeartBeatConfig.php
processHeartBeatSave.php
replacementLogo.php
This commit is contained in:
jennylee
2012-10-17 16:23:22 -04:00
parent b8e8120e8e
commit 4bd1ce1a41
30 changed files with 1581 additions and 1647 deletions

View File

@@ -1,10 +1,10 @@
<?php
/**
* holiday.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,24 +12,23 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', "setup/holidayList" );
G::RenderPage( 'publish' );
?>
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', "setup/holidayList" );
G::RenderPage( 'publish' );

View File

@@ -1,10 +1,10 @@
<?php
/**
* holidayNew.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,25 +12,24 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$fields['DATE'] = date('Y-m-d');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/holiday", '', $fields, "holidaySave");
G::RenderPage( 'publish' );
?>
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
$fields['DATE'] = date( 'Y-m-d' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', "setup/holiday", '', $fields, "holidaySave" );
G::RenderPage( 'publish' );

View File

@@ -1,10 +1,10 @@
<?php
/**
* index.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,17 +12,15 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$newFile = str_replace ( 'index.php', 'setup.php' , __FILE__ ) ;
return $newFile;
$newFile = str_replace( 'index.php', 'setup.php', __FILE__ );
return $newFile;

View File

@@ -1,139 +1,136 @@
<?php
G::LoadClass ( 'jasperReports' );
$oJasper = new jasperReports( '192.168.0.51', 8080, 'jasperadmin', 'jasperadmin' );
<?php
G::LoadClass( 'jasperReports' );
$oJasper = new jasperReports( '192.168.0.51', 8080, 'jasperadmin', 'jasperadmin' );
$response = $oJasper->ws_list("/");
$response = $oJasper->ws_list( "/" );
if (is_object($response) && get_class($response) == 'SOAP_Fault') {
if (is_object( $response ) && get_class( $response ) == 'SOAP_Fault') {
$errorMessage = $response->getFault()->faultstring;
}
else {
$folders = $oJasper->getResourceDescriptors($response);
}
} else {
$folders = $oJasper->getResourceDescriptors( $response );
}
//$result = $oJasper->ws_put();
krumo ($response);
//execute a report
$currentUri = "/reports/samples/Employees";
$result = $oJasper->ws_get($currentUri);
//$result = $oJasper->ws_put();
krumo( $response );
$folders = $oJasper->getResourceDescriptors($result);
if (count($folders) != 1 || $folders[0]['type'] != 'reportUnit')
{
echo "<H1>Invalid RU ($currentUri)</H1>";
echo "<pre>$result</pre>";
exit();
}
//execute a report
$reportUnit = $folders[0];
// 2. Prepare the parameters array looking in the $_GET for params
// starting with PARAM_ ...
//
$report_params = array();
$moveToPage = "jasper?uri=$currentUri";
foreach (array_keys($_GET) AS $param_name) {
if (strncmp("PARAM_", $param_name,6) == 0) {
$report_params[substr($param_name,6)] = $_GET[$param_name];
$currentUri = "/reports/samples/Employees";
$result = $oJasper->ws_get( $currentUri );
$folders = $oJasper->getResourceDescriptors( $result );
if (count( $folders ) != 1 || $folders[0]['type'] != 'reportUnit') {
echo "<H1>Invalid RU ($currentUri)</H1>";
echo "<pre>$result</pre>";
exit();
}
$reportUnit = $folders[0];
// 2. Prepare the parameters array looking in the $_GET for params
// starting with PARAM_ ...
//
$report_params = array ();
$moveToPage = "jasper?uri=$currentUri";
foreach (array_keys( $_GET ) as $param_name) {
if (strncmp( "PARAM_", $param_name, 6 ) == 0) {
$report_params[substr( $param_name, 6 )] = $_GET[$param_name];
}
// if ($param_name != "page" && $param_name != "uri") {
// $moveToPage .= "&".urlencode($param_name)."=". urlencode($_GET[$param_name]);
// }
}
$formatReport = RUN_OUTPUT_FORMAT_XML;
$formatReport = RUN_OUTPUT_FORMAT_CSV;
$formatReport = RUN_OUTPUT_FORMAT_RTF;
$formatReport = RUN_OUTPUT_FORMAT_PDF;
$formatReport = RUN_OUTPUT_FORMAT_HTML;
$moveToPage .="&page=";
// 3. Execute the report
$output_params = array();
$output_params[RUN_OUTPUT_FORMAT] = $formatReport;
if ( $formatReport == RUN_OUTPUT_FORMAT_HTML) {
// if ($param_name != "page" && $param_name != "uri") {
// $moveToPage .= "&".urlencode($param_name)."=". urlencode($_GET[$param_name]);
// }
}
$formatReport = RUN_OUTPUT_FORMAT_XML;
$formatReport = RUN_OUTPUT_FORMAT_CSV;
$formatReport = RUN_OUTPUT_FORMAT_RTF;
$formatReport = RUN_OUTPUT_FORMAT_PDF;
$formatReport = RUN_OUTPUT_FORMAT_HTML;
$moveToPage .= "&page=";
// 3. Execute the report
$output_params = array ();
$output_params[RUN_OUTPUT_FORMAT] = $formatReport;
if ($formatReport == RUN_OUTPUT_FORMAT_HTML) {
//$pageReport = isset ( $_GET['page'] ) ? $_GET['page'] : 1;
//$output_params[RUN_OUTPUT_PAGE] = $pageReport;
//$output_params[RUN_OUTPUT_IMAGES_URI] = '/sysos/'. SYS_LANG. '/classic';
}
$result = $oJasper->ws_runReport($currentUri, $report_params, $output_params, $attachments);
// 4.
if (is_object($result) && get_class($result) == 'SOAP_Fault') {
}
$result = $oJasper->ws_runReport( $currentUri, $report_params, $output_params, $attachments );
// 4.
if (is_object( $result ) && get_class( $result ) == 'SOAP_Fault') {
$errorMessage = $result->getFault()->faultstring;
echo $errorMessage;
exit();
}
$operationResult = $oJasper->getOperationResult($result);
if ($operationResult['returnCode'] != '0') {
echo "Error executing the report:<br><font color=\"red\">".$operationResult['returnMessage']."</font>";
}
$operationResult = $oJasper->getOperationResult( $result );
if ($operationResult['returnCode'] != '0') {
echo "Error executing the report:<br><font color=\"red\">" . $operationResult['returnMessage'] . "</font>";
exit();
}
if (is_array($attachments))
{
}
if (is_array( $attachments )) {
//krumo ($attachments);
switch ($formatReport) {
case RUN_OUTPUT_FORMAT_PDF :
header ( "Content-type: application/pdf" );
echo( $attachments["cid:report"]);
break;
case RUN_OUTPUT_FORMAT_HTML :
// 1. Save attachments....
// 2. Print the report....
header ( "Content-type: text/html");
foreach (array_keys($attachments) as $key) {
if ($key != "cid:report") {
$f = fopen("images/".substr($key,4),"w");
fwrite($f, $attachments[$key]);
fclose($f);
}
}
echo "<center>";
$prevpage = ($pageReport > 0) ? $pageReport - 1 : 0;
$nextpage = $pageReport + 1;
echo "<a href=\"".$moveToPage.$prevpage."\">Prev page</a> | <a href=\"".$moveToPage.$nextpage."\">Next page</a>";
echo "</center><hr>";
echo $attachments["cid:report"];
//print_r(array_keys($attachments));
break;
case RUN_OUTPUT_FORMAT_CSV :
case RUN_OUTPUT_FORMAT_XLS :
header ( 'Content-type: application/xls' );
header ( 'Content-Disposition: attachment; filename="report.xls"');
echo( $attachments["cid:report"]);
break;
case RUN_OUTPUT_FORMAT_RTF :
header ( 'Content-type: text/rtf' );
header ( 'Content-Disposition: attachment; filename="report.rtf"');
echo( $attachments["cid:report"]);
break;
switch ($formatReport) {
case RUN_OUTPUT_FORMAT_PDF:
header( "Content-type: application/pdf" );
echo ($attachments["cid:report"]);
break;
case RUN_OUTPUT_FORMAT_HTML:
// 1. Save attachments....
// 2. Print the report....
header( "Content-type: text/html" );
foreach (array_keys( $attachments ) as $key) {
if ($key != "cid:report") {
$f = fopen( "images/" . substr( $key, 4 ), "w" );
fwrite( $f, $attachments[$key] );
fclose( $f );
}
}
echo "<center>";
$prevpage = ($pageReport > 0) ? $pageReport - 1 : 0;
$nextpage = $pageReport + 1;
echo "<a href=\"" . $moveToPage . $prevpage . "\">Prev page</a> | <a href=\"" . $moveToPage . $nextpage . "\">Next page</a>";
echo "</center><hr>";
echo $attachments["cid:report"];
//print_r(array_keys($attachments));
break;
case RUN_OUTPUT_FORMAT_CSV:
case RUN_OUTPUT_FORMAT_XLS:
header( 'Content-type: application/xls' );
header( 'Content-Disposition: attachment; filename="report.xls"' );
echo ($attachments["cid:report"]);
break;
case RUN_OUTPUT_FORMAT_RTF:
header( 'Content-type: text/rtf' );
header( 'Content-Disposition: attachment; filename="report.rtf"' );
echo ($attachments["cid:report"]);
break;
default:
//header ( 'Content-type: application/xls' );
//header ( 'Content-Disposition: attachment; filename="report.xls"');
echo ($attachments["cid:report"]);
break;
}
exit();
} else
echo "No attachment found!";
default :
//header ( 'Content-type: application/xls' );
//header ( 'Content-Disposition: attachment; filename="report.xls"');
echo( $attachments["cid:report"]);
break;
}
exit();
}
else echo "No attachment found!";

View File

@@ -1,10 +1,10 @@
<?php
/**
* language.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,33 +12,33 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$dbc = new DBConnection;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/language","", "" , "language_save" );
$G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/language_table","","", "../setup/languageAjax.php" );
G::RenderPage( 'publish' );
$dbc = new DBConnection();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( "xmlform", "xmlform", "setup/language", "", "", "language_save" );
$G_PUBLISH->AddContent( "xmlform", "pagedTable", "setup/language_table", "", "", "../setup/languageAjax.php" );
G::RenderPage( 'publish' );
?>
<script language="JavaScript">
function btnClick(myForm) {
DESCRIPTION = myForm.elements ["form[LEX_VALUE]"];
if((DESCRIPTION.value == ""))
DESCRIPTION = myForm.elements ["form[LEX_VALUE]"];
if((DESCRIPTION.value == ""))
{
alert ("<?php echo G::LoadTranslation("ID_MSG_ERROR_LANGUAGE_DESCRIPTION")?>");
DESCRIPTION.focus();
@@ -56,3 +56,4 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
return false;
}
</script>

View File

@@ -1,173 +1,172 @@
<?php
/**
* language_Ajax.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
G::LoadInclude('ajax');
if(isset($_POST['form'])) {
$_POST = $_POST['form'];
}
$_POST['function'] = get_ajax_value('function');
switch($_POST['function']) {
case 'savePredetermined':
require_once "classes/model/Translation.php";
$tranlationsList = Translation::getTranslationEnvironments();
g::pr($tranlationsList); die;
if( isset($meta['LAN_ID']) && $meta['LAN_ID'] == $_POST['lang'] ){
echo 'The Setting was saved successfully!';
} else {
echo 'Some error occured while the setting was being save, try later please.';
}
break;
case 'languagesList':
require_once 'classes/model/Language.php';
require_once 'classes/model/IsoCountry.php';
require_once 'classes/model/Translation.php';
G::loadClass('configuration');
$isoCountry = new isoCountry();
$translationRow = new Translation();
$response = new stdClass();
$translationsEnvList = $translationRow->getTranslationEnvironments();
//print_r($translationsEnvList); die;
$i = 0;
foreach( $translationsEnvList as $locale=>$translationRow) {
$COUNTRY_ID = $translationRow['IC_UID'];
if( $COUNTRY_ID != '' ) {
$isoCountryRecord = $isoCountry->findById(strtoupper($COUNTRY_ID));
$flag = strtolower($isoCountryRecord['IC_UID']);
$countryName = $translationRow['HEADERS']['X-Poedit-Country'];
} else {
$flag = 'international';
$countryName = G::LoadTranslation('ID_INTERNATIONAL');
}
G::LoadClass ( 'configuration' );
$conf = new Configurations();
$confCasesList = $conf->getConfiguration('casesList','todo');
//echo date($confCasesList['dateformat'], '2010-01-01');
if( isset($confCasesList['dateformat']) ){
$datetime = explode(' ', $translationRow['DATE']);
$date = explode('-', $datetime[0]);
if( count($datetime) == 2 )
$time = explode(':', $datetime[1]);
if( count($date) == 3 ){
if( count($time) >= 2 ){
$DATE = date($confCasesList['dateformat'], mktime($time[0], $time[1], 0, $date[1], $date[2], $date[0]));
} else {
$DATE = date($confCasesList['dateformat'], mktime(0, 0, 0, $date[1], $date[2], $date[0]));
}
} else {
$DATE = $translationRow['DATE'];
}
$datetime = explode(' ', $translationRow['HEADERS']['PO-Revision-Date']);
$date = explode('-', $datetime[0]);
if( count($datetime) == 2 )
$time = explode(':', $datetime[1]);
if( count($date) == 3 ){
if( count($time) >= 2 ){
$REV_DATE = date($confCasesList['dateformat'], mktime($time[0], substr($time[1],0,2), 0, $date[1], $date[2], $date[0]));
} else {
$REV_DATE = date($confCasesList['dateformat'], mktime(0, 0, 0, $date[1], $date[2], $date[0]));
}
} else {
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
}
} else {
$DATE = $translationRow['DATE'];
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
}
$languagesList[$i]['LAN_ID'] = $translationRow['LAN_ID'];
$languagesList[$i]['LOCALE'] = $translationRow['LOCALE'];
$languagesList[$i]['LAN_FLAG'] = $flag;
$languagesList[$i]['NUM_RECORDS'] = $translationRow['NUM_RECORDS'];
$languagesList[$i]['DATE'] = $DATE;
$languagesList[$i]['LAN_NAME'] = $translationRow['HEADERS']['X-Poedit-Language'];
$languagesList[$i]['COUNTRY_NAME'] = $countryName;
$languagesList[$i]['TRANSLATOR'] = htmlentities($translationRow['HEADERS']['Last-Translator']);
$languagesList[$i]['REV_DATE'] = $REV_DATE;
$languagesList[$i]['VERSION'] = $translationRow['HEADERS']['Project-Id-Version'];
$i++;
}
$translationRow = new Translation();
$response->data = $languagesList;
print(G::json_encode($response));
break;
case 'delete':
include_once 'classes/model/Translation.php';
include_once 'classes/model/Content.php';
$locale = $_POST['LOCALE'];
$trn = new Translation();
if( strpos($locale, Translation::$localeSeparator) )
list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $locale);
else {
$LAN_ID = $locale;
$LAN_ID = '';
}
$oCriteria = new Criteria('workflow');
//$oCriteria->addSelectColumn('COUNT('.ContentPeer::CON_CATEGORY.')');
$oCriteria->addSelectColumn(ContentPeer::CON_CATEGORY);
$oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
$oCriteria->add(ContentPeer::CON_LANG, $locale);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
$oDataset = ContentPeer::doSelectRS($oCriteria);
$oDataset->next();
$oContent = new Content();
$aRow = $oDataset->getRow();
//THERE IS NO ANY CASE STARTED FROM THES LANGUAGE
if( $aRow[0] == 0 ) { //so we can delete this language
try{
Content::removeLanguageContent($locale);
$trn->removeTranslationEnvironment($locale);
echo G::LoadTranslation('ID_LANGUAGE_DELETED_SUCCESSFULLY');
} catch (Exception $e){
echo $e->getMessage();
}
} else {
echo str_replace('{0}', $aRow[0], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE'));
}
break;
}
} catch ( Exception $oException ) {
die($oException->getMessage());
}
?>
<?php
/**
* language_Ajax.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
try {
G::LoadInclude( 'ajax' );
if (isset( $_POST['form'] )) {
$_POST = $_POST['form'];
}
$_POST['function'] = get_ajax_value( 'function' );
switch ($_POST['function']) {
case 'savePredetermined':
require_once "classes/model/Translation.php";
$tranlationsList = Translation::getTranslationEnvironments();
g::pr( $tranlationsList );
die();
if (isset( $meta['LAN_ID'] ) && $meta['LAN_ID'] == $_POST['lang']) {
echo 'The Setting was saved successfully!';
} else {
echo 'Some error occured while the setting was being save, try later please.';
}
break;
case 'languagesList':
require_once 'classes/model/Language.php';
require_once 'classes/model/IsoCountry.php';
require_once 'classes/model/Translation.php';
G::loadClass( 'configuration' );
$isoCountry = new isoCountry();
$translationRow = new Translation();
$response = new stdClass();
$translationsEnvList = $translationRow->getTranslationEnvironments();
//print_r($translationsEnvList); die;
$i = 0;
foreach ($translationsEnvList as $locale => $translationRow) {
$COUNTRY_ID = $translationRow['IC_UID'];
if ($COUNTRY_ID != '') {
$isoCountryRecord = $isoCountry->findById( strtoupper( $COUNTRY_ID ) );
$flag = strtolower( $isoCountryRecord['IC_UID'] );
$countryName = $translationRow['HEADERS']['X-Poedit-Country'];
} else {
$flag = 'international';
$countryName = G::LoadTranslation( 'ID_INTERNATIONAL' );
}
G::LoadClass( 'configuration' );
$conf = new Configurations();
$confCasesList = $conf->getConfiguration( 'casesList', 'todo' );
//echo date($confCasesList['dateformat'], '2010-01-01');
if (isset( $confCasesList['dateformat'] )) {
$datetime = explode( ' ', $translationRow['DATE'] );
$date = explode( '-', $datetime[0] );
if (count( $datetime ) == 2)
$time = explode( ':', $datetime[1] );
if (count( $date ) == 3) {
if (count( $time ) >= 2) {
$DATE = date( $confCasesList['dateformat'], mktime( $time[0], $time[1], 0, $date[1], $date[2], $date[0] ) );
} else {
$DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) );
}
} else {
$DATE = $translationRow['DATE'];
}
$datetime = explode( ' ', $translationRow['HEADERS']['PO-Revision-Date'] );
$date = explode( '-', $datetime[0] );
if (count( $datetime ) == 2)
$time = explode( ':', $datetime[1] );
if (count( $date ) == 3) {
if (count( $time ) >= 2) {
$REV_DATE = date( $confCasesList['dateformat'], mktime( $time[0], substr( $time[1], 0, 2 ), 0, $date[1], $date[2], $date[0] ) );
} else {
$REV_DATE = date( $confCasesList['dateformat'], mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) );
}
} else {
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
}
} else {
$DATE = $translationRow['DATE'];
$REV_DATE = $translationRow['HEADERS']['PO-Revision-Date'];
}
$languagesList[$i]['LAN_ID'] = $translationRow['LAN_ID'];
$languagesList[$i]['LOCALE'] = $translationRow['LOCALE'];
$languagesList[$i]['LAN_FLAG'] = $flag;
$languagesList[$i]['NUM_RECORDS'] = $translationRow['NUM_RECORDS'];
$languagesList[$i]['DATE'] = $DATE;
$languagesList[$i]['LAN_NAME'] = $translationRow['HEADERS']['X-Poedit-Language'];
$languagesList[$i]['COUNTRY_NAME'] = $countryName;
$languagesList[$i]['TRANSLATOR'] = htmlentities( $translationRow['HEADERS']['Last-Translator'] );
$languagesList[$i]['REV_DATE'] = $REV_DATE;
$languagesList[$i]['VERSION'] = $translationRow['HEADERS']['Project-Id-Version'];
$i ++;
}
$translationRow = new Translation();
$response->data = $languagesList;
print (G::json_encode( $response )) ;
break;
case 'delete':
include_once 'classes/model/Translation.php';
include_once 'classes/model/Content.php';
$locale = $_POST['LOCALE'];
$trn = new Translation();
if (strpos( $locale, Translation::$localeSeparator ))
list ($LAN_ID, $IC_UID) = explode( Translation::$localeSeparator, $locale );
else {
$LAN_ID = $locale;
$LAN_ID = '';
}
$oCriteria = new Criteria( 'workflow' );
//$oCriteria->addSelectColumn('COUNT('.ContentPeer::CON_CATEGORY.')');
$oCriteria->addSelectColumn( ContentPeer::CON_CATEGORY );
$oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
$oCriteria->add( ContentPeer::CON_LANG, $locale );
$oCriteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
$oDataset = ContentPeer::doSelectRS( $oCriteria );
$oDataset->next();
$oContent = new Content();
$aRow = $oDataset->getRow();
//THERE IS NO ANY CASE STARTED FROM THES LANGUAGE
if ($aRow[0] == 0) { //so we can delete this language
try {
Content::removeLanguageContent( $locale );
$trn->removeTranslationEnvironment( $locale );
echo G::LoadTranslation( 'ID_LANGUAGE_DELETED_SUCCESSFULLY' );
} catch (Exception $e) {
echo $e->getMessage();
}
} else {
echo str_replace( '{0}', $aRow[0], G::LoadTranslation( 'ID_LANGUAGE_CANT_DELETE' ) );
}
break;
}
} catch (Exception $oException) {
die( $oException->getMessage() );
}

View File

@@ -1,38 +1,35 @@
<?php
/**
* languages.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$oHeadPublisher->addExtJsScript('setup/languages', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/languages'); //adding a html file .html.
$labels = G::getTranslations(Array(
'ID_LAN_PREDETERMINED', 'ID_LANG_INSTALL_UPDATE', 'ID_LAN_LANGUAGE', 'ID_LAN_COUNTRY', 'ID_LAN_UPDATE_DATE',
'ID_LAN_REV_DATE', 'ID_LAN_FILE', 'ID_LAN_REV_DATE', 'ID_LAN_VERSION', 'ID_LAN_GRID_TITLE', 'ID_LAN_UPLOAD_TITLE',
'ID_LAN_FILE_WATER_LABEL', 'ID_EXPORT', 'ID_UPLOAD', 'ID_CANCEL', 'ID_DELETE_LANGUAGE', 'ID_DELETE_LANGUAGE_CONFIRM',
'ID_DELETE_LANGUAGE_WARNING', 'ID_ACTIONS', 'ID_LAN_LOCALE', 'ID_LAN_TRANSLATOR', 'ID_LAN_NUM_RECORDS', 'ID_UPLOADING_TRANSLATION_FILE'
));
//$oHeadPublisher->assign('TRANSLATIONS', $labels);
G::RenderPage('publish', 'extJs');
<?php
/**
* languages.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
$oHeadPublisher->addExtJsScript( 'setup/languages', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/languages' ); //adding a html file .html.
$labels = G::getTranslations( Array ('ID_LAN_PREDETERMINED','ID_LANG_INSTALL_UPDATE','ID_LAN_LANGUAGE','ID_LAN_COUNTRY','ID_LAN_UPDATE_DATE','ID_LAN_REV_DATE','ID_LAN_FILE','ID_LAN_REV_DATE','ID_LAN_VERSION','ID_LAN_GRID_TITLE','ID_LAN_UPLOAD_TITLE','ID_LAN_FILE_WATER_LABEL','ID_EXPORT','ID_UPLOAD','ID_CANCEL','ID_DELETE_LANGUAGE','ID_DELETE_LANGUAGE_CONFIRM','ID_DELETE_LANGUAGE_WARNING','ID_ACTIONS','ID_LAN_LOCALE','ID_LAN_TRANSLATOR','ID_LAN_NUM_RECORDS','ID_UPLOADING_TRANSLATION_FILE'
) );
//$oHeadPublisher->assign('TRANSLATIONS', $labels);
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,73 +1,73 @@
<?php
/**
* languages_Delete.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//print_r($_GET['LAN_ID']);
require_once 'classes/model/Language.php';
require_once 'classes/model/Content.php';
$kk=new Criteria();
$kk->add(ContentPeer::CON_LANG, $_GET['LAN_ID']);
$oDataset=ContentPeer::doSelectRS($kk);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow1 = $oDataset->getRow();
if(is_array($aRow1)) {
$G_PUBLISH = new Publisher;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'LANGUAGES';
//$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use";
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage );
//G::RenderPage('publishBlank', 'blank');
G::SendTemporalMessage('CANT_DEL_LANGUAGE', 'error', 'labels');
G::header('location: languages');
}else {
/*the reason why comment it was because when delete some language,we're losing some labels about this language*/
$oCriteria = new Criteria('workflow');
$oCriteria->add(ContentPeer::CON_LANG, $_GET['LAN_ID']);
ContentPeer::doDelete($oCriteria);
/*
$oCriteria1 = new Criteria('workflow');
$oCriteria1->add(LanguagePeer::LAN_ENABLED, 0);
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']);
LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow'));
*/
$aLanguage['LAN_ID'] =$_GET['LAN_ID'];
$aLanguage['LAN_ENABLED']=0;
$oLanguage = new Language();
$oLanguage->update($aLanguage);
G::header('Location: languages');
}
<?php
/**
* languages_Delete.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//print_r($_GET['LAN_ID']);
require_once 'classes/model/Language.php';
require_once 'classes/model/Content.php';
$kk = new Criteria();
$kk->add( ContentPeer::CON_LANG, $_GET['LAN_ID'] );
$oDataset = ContentPeer::doSelectRS( $kk );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow1 = $oDataset->getRow();
if (is_array( $aRow1 )) {
$G_PUBLISH = new Publisher();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'LANGUAGES';
//$aMessage['MESSAGE'] = G::LoadTranslation('CANT_DEL_LANGUAGE');//"you can't delete this language is in use";
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/showMessage', '', $aMessage );
//G::RenderPage('publishBlank', 'blank');
G::SendTemporalMessage( 'CANT_DEL_LANGUAGE', 'error', 'labels' );
G::header( 'location: languages' );
} else {
/*the reason why comment it was because when delete some language,we're losing some labels about this language*/
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ContentPeer::CON_LANG, $_GET['LAN_ID'] );
ContentPeer::doDelete( $oCriteria );
/*
$oCriteria1 = new Criteria('workflow');
$oCriteria1->add(LanguagePeer::LAN_ENABLED, 0);
$oCriteria2 = new Criteria('workflow');
$oCriteria2->add(LanguagePeer::LAN_ID, $_GET['LAN_ID']);
LanguagePeer::doUpdate($oCriteria2, $oCriteria1, Propel::getConnection('workflow'));
*/
$aLanguage['LAN_ID'] = $_GET['LAN_ID'];
$aLanguage['LAN_ENABLED'] = 0;
$oLanguage = new Language();
$oLanguage->update( $aLanguage );
G::header( 'Location: languages' );
}

View File

@@ -12,23 +12,21 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once "classes/model/Language.php";
if( ! isset($_GET['LOCALE']) )
throw new Exception('Language Target ID was not set!');
if (! isset( $_GET['LOCALE'] ))
throw new Exception( 'Language Target ID was not set!' );
$language = new Language();
$language->export();

View File

@@ -1,113 +1,110 @@
<?php
/**
* languages_Import.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once "classes/model/Language.php";
global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
if( $access != 1 ) {
switch( $access ) {
case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); break;
case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); break;
default: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); break;
}
G::header('location: ../login/login');
exit(0);
}
$result = new stdClass();
try {
//if the xmlform path is writeable
if( ! is_writable(PATH_XMLFORM) )
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE'));
//if all xml files within the xmlform directory are writeable
if( ! G::is_rwritable(PATH_XMLFORM) )
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2'));
$sMaxExecutionTime = ini_get('max_execution_time');
ini_set('max_execution_time', '0');
G::LoadClass('configuration');
$languageFile = $_FILES['form']['tmp_name']['LANGUAGE_FILENAME'];
$languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME'];
if (substr_compare($languageFilename, ".gz", -3, 3, true) == 0) {
$zp = gzopen($languageFile, "r");
$languageFile = tempnam(__FILE__, '');
$handle = fopen($languageFile, "w");
while (!gzeof($zp)) {
$data = gzread($zp, 1024);
fwrite($handle, $data);
}
gzclose($zp);
fclose($handle);
}
$language = new Language();
$configuration = new Configurations;
$importResults = $language->import($languageFile);
G::LoadClass("wsTools");
$renegerateContent = new workspaceTools(SYS_SYS);
$messs = $renegerateContent->upgradeContent();
$result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n";
$result->msg .= "PO File num. records: " . $importResults->recordsCount . "\n";
$result->msg .= "Success Records: " . $importResults->recordsCountSuccess . "\n";
$result->msg .= "Failed Records: " . ($importResults->recordsCount-$importResults->recordsCountSuccess) . "\n";
if( $importResults->errMsg != '' ){
$result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n";
}
//$result->msg = htmlentities($result->msg);
$result->success = true;
//saving metadata
$configuration->aConfig = Array(
'headers' => $importResults->headers,
'language' => $importResults->lang,
'import-date' => date('Y-m-d H:i:s'),
'user' => '',
'version' => '1.0'
);
$configuration->saveConfig('LANGUAGE_META', $importResults->lang);
ini_set('max_execution_time', $sMaxExecutionTime);
} catch (Exception $oError) {
$result->msg = $oError->getMessage();
//print_r($oError->getTrace());
$result->success = false;
//G::SendTemporalMessage($oError->getMessage(), 'error', 'string');
//G::header('location: languages_ImportForm');
}
echo G::json_encode($result);
<?php
/**
* languages_Import.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
require_once "classes/model/Language.php";
global $RBAC;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
break;
}
G::header( 'location: ../login/login' );
exit( 0 );
}
$result = new stdClass();
try {
//if the xmlform path is writeable
if (! is_writable( PATH_XMLFORM ))
throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_WRITABLE' ) );
//if all xml files within the xmlform directory are writeable
if (! G::is_rwritable( PATH_XMLFORM ))
throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_WRITABLE2' ) );
$sMaxExecutionTime = ini_get( 'max_execution_time' );
ini_set( 'max_execution_time', '0' );
G::LoadClass( 'configuration' );
$languageFile = $_FILES['form']['tmp_name']['LANGUAGE_FILENAME'];
$languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME'];
if (substr_compare( $languageFilename, ".gz", - 3, 3, true ) == 0) {
$zp = gzopen( $languageFile, "r" );
$languageFile = tempnam( __FILE__, '' );
$handle = fopen( $languageFile, "w" );
while (! gzeof( $zp )) {
$data = gzread( $zp, 1024 );
fwrite( $handle, $data );
}
gzclose( $zp );
fclose( $handle );
}
$language = new Language();
$configuration = new Configurations();
$importResults = $language->import( $languageFile );
G::LoadClass( "wsTools" );
$renegerateContent = new workspaceTools( SYS_SYS );
$messs = $renegerateContent->upgradeContent();
$result->msg = G::LoadTranslation( 'IMPORT_LANGUAGE_SUCCESS' ) . "\n";
$result->msg .= "PO File num. records: " . $importResults->recordsCount . "\n";
$result->msg .= "Success Records: " . $importResults->recordsCountSuccess . "\n";
$result->msg .= "Failed Records: " . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n";
if ($importResults->errMsg != '') {
$result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n";
}
//$result->msg = htmlentities($result->msg);
$result->success = true;
//saving metadata
$configuration->aConfig = Array ('headers' => $importResults->headers,'language' => $importResults->lang,'import-date' => date( 'Y-m-d H:i:s' ),'user' => '','version' => '1.0'
);
$configuration->saveConfig( 'LANGUAGE_META', $importResults->lang );
ini_set( 'max_execution_time', $sMaxExecutionTime );
} catch (Exception $oError) {
$result->msg = $oError->getMessage();
//print_r($oError->getTrace());
$result->success = false;
//G::SendTemporalMessage($oError->getMessage(), 'error', 'string');
//G::header('location: languages_ImportForm');
}
echo G::json_encode( $result );

View File

@@ -1,66 +1,60 @@
<?php
/**
* languages_ImportForm.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'LANGUAGES';
/*
$oForm = new Form('setup/languages_ImportForm', '', SYS_LANG);
$oForm->action = 'languages_Import';
echo '<link rel="stylesheet" type="text/css" href="/skins/' . SYS_SKIN . '/style.css"/>' .
$oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = '');
*/
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'setup/languages_ImportForm', '', '', 'languages_Import');
G::RenderPage('publishBlank', 'blank');
<?php
/**
* languages_ImportForm.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'setup';
$G_ID_MENU_SELECTED = 'SETUP';
$G_ID_SUB_MENU_SELECTED = 'LANGUAGES';
/*
$oForm = new Form('setup/languages_ImportForm', '', SYS_LANG);
$oForm->action = 'languages_Import';
echo '<link rel="stylesheet" type="text/css" href="/skins/' . SYS_SKIN . '/style.css"/>' .
$oForm->render(PATH_CORE . 'templates/xmlform.html', $scriptCode = '');
*/
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/languages_ImportForm', '', '', 'languages_Import' );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,10 +1,10 @@
<?php
/**
* location.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,39 +12,39 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_SETUP"))!=1) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_SETUP" )) != 1)
return $RBAC_Response;
$G_ENABLE_BLANK_SKIN = true;
$G_ENABLE_BLANK_SKIN = true;
$uid = $_SESSION['USER_LOGGED'];
$uid = $_SESSION['USER_LOGGED'];
$dbc = new DBConnection;
$ses = new DBSession($dbc);
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
G::LoadClass ( 'templateTable' );
G::LoadClass( 'templateTable' );
$query=$ses->execute('select USR_COUNTRY ,USR_CITY ,USR_LOCATION from USER where UID = "'.$uid.'"');
$param=$query->read();
$query = $ses->execute( 'select USR_COUNTRY ,USR_CITY ,USR_LOCATION from USER where UID = "' . $uid . '"' );
$param = $query->read();
$city=$param['USR_CITY'];
$query=$ses->execute('SELECT UID,CAPTION FROM TERRITORY WHERE TERRITORY="LOCATION" AND RELATION="'.$city.'"');
/*
$city = $param['USR_CITY'];
$query = $ses->execute( 'SELECT UID,CAPTION FROM TERRITORY WHERE TERRITORY="LOCATION" AND RELATION="' . $city . '"' );
/*
$table=new templateTable('list_template.html','DIV_LOCATIONS');
$table->formatTitleCol(0,'width="80%"');
$table->formatTitleCol(1,'align="center"');
$table->formatCol(0,'width="80%" ');
$table->formatCol(1,'align="center"');
$table->addTitle(array(G::LoadTranslation('ID_LOCATION'),''));
for($r=0;$r<$query->count();$r++)
{
@@ -61,10 +61,11 @@ $table->addRowTag($r,'lastRow','','');
));
*/
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/location', '', $param );
//$G_PUBLISH->AddContent('template', '', '', '', $table->tpl);
G::RenderPage( 'publish' );
?>
@@ -160,3 +161,4 @@ function ajax_function(ajax_server, funcion, parameters)
return objetus.responseText;
}
</script>

View File

@@ -12,35 +12,34 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
G::loadClass('configuration');
$oConf = new Configurations;
$oHeadPublisher =& headPublisher::getSingleton();
$oServerConf =& serverConf::getSingleton();
$oHeadPublisher->addExtJsScript('setup/loginSettings', true ); //adding a javascript file .js
$oHeadPublisher->addContent('setup/loginSettings'); //adding a html file .html.
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
$forgotPasswd = isset($oConf->aConfig['login_enableForgotPassword'])? $oConf->aConfig['login_enableForgotPassword']: false;
$virtualKeyboad = isset($oConf->aConfig['login_enableVirtualKeyboard'])? $oConf->aConfig['login_enableVirtualKeyboard']: false;
$defaultLanguaje = isset($oConf->aConfig['login_defaultLanguage'])? $oConf->aConfig['login_defaultLanguage']: 'en';
$oHeadPublisher->assign('currentLang', $defaultLanguaje);
$oHeadPublisher->assign('forgotPasswd', $forgotPasswd);
$oHeadPublisher->assign('virtualKeyboad',$virtualKeyboad);
G::RenderPage('publish', 'extJs');
G::loadClass( 'configuration' );
$oConf = new Configurations();
$oHeadPublisher = & headPublisher::getSingleton();
$oServerConf = & serverConf::getSingleton();
$oHeadPublisher->addExtJsScript( 'setup/loginSettings', true ); //adding a javascript file .js
$oHeadPublisher->addContent( 'setup/loginSettings' ); //adding a html file .html.
$oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$forgotPasswd = isset( $oConf->aConfig['login_enableForgotPassword'] ) ? $oConf->aConfig['login_enableForgotPassword'] : false;
$virtualKeyboad = isset( $oConf->aConfig['login_enableVirtualKeyboard'] ) ? $oConf->aConfig['login_enableVirtualKeyboard'] : false;
$defaultLanguaje = isset( $oConf->aConfig['login_defaultLanguage'] ) ? $oConf->aConfig['login_defaultLanguage'] : 'en';
$oHeadPublisher->assign( 'currentLang', $defaultLanguaje );
$oHeadPublisher->assign( 'forgotPasswd', $forgotPasswd );
$oHeadPublisher->assign( 'virtualKeyboad', $virtualKeyboad );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,38 +1,39 @@
<?php
$request = isset($_REQUEST['request'])? $_REQUEST['request'] : null ;
switch($request){
case 'getLangList':
$request = isset( $_REQUEST['request'] ) ? $_REQUEST['request'] : null;
$Translations = G::getModel('Translation');
$result = new stdClass();
$result->rows = Array();
$langs = $Translations->getTranslationEnvironments();
foreach($langs as $lang){
$result->rows[] = Array('LAN_ID'=>$lang['LOCALE'], 'LAN_NAME'=>$lang['LANGUAGE']);
}
print(G::json_encode($result));
break;
switch ($request) {
case 'getLangList':
$Translations = G::getModel( 'Translation' );
$result = new stdClass();
$result->rows = Array ();
$langs = $Translations->getTranslationEnvironments();
foreach ($langs as $lang) {
$result->rows[] = Array ('LAN_ID' => $lang['LOCALE'],'LAN_NAME' => $lang['LANGUAGE']
);
}
print (G::json_encode( $result )) ;
break;
case 'saveSettings':
$memcache = & PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : '');
G::LoadClass('configuration');
$conf = new Configurations;
$conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS','');
$memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' );
G::LoadClass( 'configuration' );
$conf = new Configurations();
$conf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );
$conf->aConfig['login_enableForgotPassword'] = isset($_REQUEST['forgotPasswd']);
$conf->aConfig['login_enableVirtualKeyboard'] = isset($_REQUEST['virtualKeyboad']);
$conf->aConfig['login_defaultLanguage'] = isset($_REQUEST['lang'])? $_REQUEST['lang'] : 'en';
$conf->aConfig['login_enableForgotPassword'] = isset( $_REQUEST['forgotPasswd'] );
$conf->aConfig['login_enableVirtualKeyboard'] = isset( $_REQUEST['virtualKeyboad'] );
$conf->aConfig['login_defaultLanguage'] = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : 'en';
$conf->saveConfig('ENVIRONMENT_SETTINGS', '');
//remove from memcache when this value is updated/created
$memcache->delete('flagForgotPassword') ;
$response->success = true;
echo G::json_encode($response);
$conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' );
//remove from memcache when this value is updated/created
$memcache->delete( 'flagForgotPassword' );
$response->success = true;
echo G::json_encode( $response );
break;
}
break;
}

View File

@@ -1,5 +1,5 @@
<?php
/**
<?php
/**
* logo_Delete.php
*
* ProcessMaker Open Source Edition
@@ -12,40 +12,39 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {
global $RBAC;
switch ($RBAC->userCanAccess('PM_FACTORY'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_FACTORY' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$snameLogo = trim( $_GET['NAMELOGO'] );
$ainfoSite = explode( "/", $_SERVER["REQUEST_URI"] );
$dir = PATH_DATA . "sites" . PATH_SEP . str_replace( "sys", "", $ainfoSite[1] ) . PATH_SEP . "files/logos";
$sfileDir = $dir . PATH_SEP . $snameLogo;
unlink( $sfileDir );
//header('location: uplogo.php');
$snameLogo =trim($_GET['NAMELOGO']);
$ainfoSite = explode("/",$_SERVER["REQUEST_URI"]);
$dir=PATH_DATA."sites".PATH_SEP.str_replace("sys","",$ainfoSite[1]).PATH_SEP."files/logos";
$sfileDir=$dir.PATH_SEP.$snameLogo;
unlink($sfileDir);
//header('location: uplogo.php');
} catch (Exception $oException) {
die($oException->getMessage());
die( $oException->getMessage() );
}
?>

View File

@@ -12,36 +12,35 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$RBAC->requirePermissions('PM_SETUP', 'PM_USERS');
$RBAC->requirePermissions( 'PM_SETUP', 'PM_USERS' );
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_PUBLISH = new Publisher;
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_PUBLISH = new Publisher();
if( isset($_GET['i18']) )
$_SESSION['DEV_FLAG'] = $_SESSION['TOOLS_VIEWTYPE'] = isset($_GET['i18']);
if (isset( $_GET['i18'] ))
$_SESSION['DEV_FLAG'] = $_SESSION['TOOLS_VIEWTYPE'] = isset( $_GET['i18'] );
else {
unset($_SESSION['DEV_FLAG']);
unset($_SESSION['TOOLS_VIEWTYPE']);
unset( $_SESSION['DEV_FLAG'] );
unset( $_SESSION['TOOLS_VIEWTYPE'] );
}
if( isset($_GET['s']) )
$_SESSION['ADMIN_SELECTED'] = $_GET['s'];
if (isset( $_GET['s'] ))
$_SESSION['ADMIN_SELECTED'] = $_GET['s'];
else {
unset($_SESSION['ADMIN_SELECTED']);
unset( $_SESSION['ADMIN_SELECTED'] );
}
$G_PUBLISH->AddContent('view', 'setup/main_Load');
G::RenderPage('publish');
$G_PUBLISH->AddContent( 'view', 'setup/main_Load' );
G::RenderPage( 'publish' );

View File

@@ -1,84 +1,69 @@
<?php
ob_start();
$request = isset($_POST['request'])? $_POST['request'] : (isset($_GET['request'])? $_GET['request'] : null);
$request = isset( $_POST['request'] ) ? $_POST['request'] : (isset( $_GET['request'] ) ? $_GET['request'] : null);
switch ($request) {
case 'loadMenu':
if (!isset($_GET['menu'])) {
exit(0);
}
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('setup');
$items = array();
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Types[$i] == $_GET['menu']) {
$items[] = array(
'id' => $oMenu->Id[$i],
'url' => ($oMenu->Options[$i] != '')? $oMenu->Options[$i] : '#',
//'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
'text' => $oMenu->Labels[$i],
//'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
//'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
'loaded' => true,
'leaf' => true,
'cls' => 'pm-tree-node',
'iconCls' => 'ICON_' . $oMenu->Id[$i]
);
} else if (in_array($oMenu->Types[$i], array('', 'admToolsContent')) && $_GET['menu'] == 'plugins') {
$items[] = array(
'id' => $oMenu->Id[$i],
'url' => ($oMenu->Options[$i] != '')? $oMenu->Options[$i] : '#',
//'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
'text' => $oMenu->Labels[$i],
//'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
//'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
'loaded' => true,
'leaf' => true,
'cls' => 'pm-tree-node',
'iconCls' => 'ICON_'.$oMenu->Id[$i]
);
}
}
if (isset($_SESSION['DEV_FLAG']) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings') {
unset($_SESSION['DEV_FLAG']);
$items[] = array(
'id' => 'translations',
'url' => '../tools/main',
'text' => 'Translations',
'loaded' => true,
'leaf' => true,
'cls' => 'pm-tree-node',
'iconCls' => 'ICON_'
);
}
$x = ob_get_contents();
ob_end_clean();
///////
if ($_GET["menu"] == "plugins") {
$i = 0;
foreach ($items as $index => $value) {
if ($items[$index]["id"] == "PMENTERPRISE") {
$i = $index;
break;
case 'loadMenu':
if (! isset( $_GET['menu'] )) {
exit( 0 );
}
}
$itemAux = $items[$i];
array_splice($items, $i, 1);
array_unshift($items, $itemAux);
}
///////
echo G::json_encode($items);
break;
}
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load( 'setup' );
$items = array ();
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Types[$i] == $_GET['menu']) {
$items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#',
//'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
'text' => $oMenu->Labels[$i],
//'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
//'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i]
);
} else if (in_array( $oMenu->Types[$i], array ('','admToolsContent'
) ) && $_GET['menu'] == 'plugins') {
$items[] = array ('id' => $oMenu->Id[$i],'url' => ($oMenu->Options[$i] != '') ? $oMenu->Options[$i] : '#',
//'onclick' => ($oMenu->JS[$i] != '')? $oMenu->JS[$i] : '',
'text' => $oMenu->Labels[$i],
//'icon' => ($oMenu->Icons[$i] != '')? $oMenu->Icons[$i] : 'icon-pmlogo.png',
//'target'=> ($oMenu->Types[$i] == 'admToolsContent')? 'admToolsContent' : ''
'loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_' . $oMenu->Id[$i]
);
}
}
if (isset( $_SESSION['DEV_FLAG'] ) && $_SESSION['DEV_FLAG'] && $_GET['menu'] == 'settings') {
unset( $_SESSION['DEV_FLAG'] );
$items[] = array ('id' => 'translations','url' => '../tools/main','text' => 'Translations','loaded' => true,'leaf' => true,'cls' => 'pm-tree-node','iconCls' => 'ICON_'
);
}
$x = ob_get_contents();
ob_end_clean();
///////
if ($_GET["menu"] == "plugins") {
$i = 0;
foreach ($items as $index => $value) {
if ($items[$index]["id"] == "PMENTERPRISE") {
$i = $index;
break;
}
}
$itemAux = $items[$i];
array_splice( $items, $i, 1 );
array_unshift( $items, $itemAux );
}
///////
echo G::json_encode( $items );
break;
}

View File

@@ -1,105 +1,105 @@
<?php
/**
* main.php Cases List main processor
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$RBAC->requirePermissions("PM_SETUP", "PM_USERS");
///////
$adminSelected = null;
if (isset($_REQUEST["s"])) {
$adminSelected = $_REQUEST["s"];
}
else {
if (isset($_SESSION["ADMIN_SELECTED"])) {
$adminSelected = $_SESSION["ADMIN_SELECTED"];
}
}
///////
$oHeadPublisher = &headPublisher::getSingleton();
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load("setup");
$items = array();
$menuTypes = array_unique($oMenu->Types);
foreach ($menuTypes as $i => $v) {
if ($v == "admToolsContent") {
unset($menuTypes[$i]);
break;
}
}
//sort($menuTypes);
$tabItems = array();
$i = 0;
foreach ($menuTypes as $menuType) {
$tabItems[$i]->id = $menuType;
$LABEL_TRANSLATION = G::LoadTranslation("ID_" . strtoupper($menuType));
if (substr($LABEL_TRANSLATION, 0, 2) !== "**") {
$title = $LABEL_TRANSLATION;
}
else {
$title = str_replace("_", " ", ucwords($menuType));
}
$tabItems[$i]->title = $title;
$i++;
}
///////
$tabActive = "";
if ($adminSelected != null) {
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Id[$i] == $adminSelected) {
$tabActive = (in_array($oMenu->Types[$i], array("", "admToolsContent")))? "plugins" : $oMenu->Types[$i];
break;
}
}
}
///////
$oHeadPublisher->addExtJsScript("setup/main", true); //adding a javascript file .js
$oHeadPublisher->addContent("setup/main"); //adding a html file .html.
$oHeadPublisher->assign("tabActive", $tabActive);
$oHeadPublisher->assign("tabItems", $tabItems);
$oHeadPublisher->assign("_item_selected", (($adminSelected != null)? $adminSelected : ""));
G::RenderPage("publish", "extJs");
//this patch enables the load of the plugin list panel inside de main admin panel iframe
if (isset($_GET["action"]) && $_GET["action"] == "pluginsList") {
echo "
<script type=\"text/javascript\">
document.getElementById(\"setup-frame\").src = \"pluginsList\";
</script>
";
}
<?php
/**
* main.php Cases List main processor
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$RBAC->requirePermissions( "PM_SETUP", "PM_USERS" );
///////
$adminSelected = null;
if (isset( $_REQUEST["s"] )) {
$adminSelected = $_REQUEST["s"];
} else {
if (isset( $_SESSION["ADMIN_SELECTED"] )) {
$adminSelected = $_SESSION["ADMIN_SELECTED"];
}
}
///////
$oHeadPublisher = &headPublisher::getSingleton();
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load( "setup" );
$items = array ();
$menuTypes = array_unique( $oMenu->Types );
foreach ($menuTypes as $i => $v) {
if ($v == "admToolsContent") {
unset( $menuTypes[$i] );
break;
}
}
//sort($menuTypes);
$tabItems = array ();
$i = 0;
foreach ($menuTypes as $menuType) {
$tabItems[$i]->id = $menuType;
$LABEL_TRANSLATION = G::LoadTranslation( "ID_" . strtoupper( $menuType ) );
if (substr( $LABEL_TRANSLATION, 0, 2 ) !== "**") {
$title = $LABEL_TRANSLATION;
} else {
$title = str_replace( "_", " ", ucwords( $menuType ) );
}
$tabItems[$i]->title = $title;
$i ++;
}
///////
$tabActive = "";
if ($adminSelected != null) {
foreach ($oMenu->Options as $i => $option) {
if ($oMenu->Id[$i] == $adminSelected) {
$tabActive = (in_array( $oMenu->Types[$i], array ("","admToolsContent"
) )) ? "plugins" : $oMenu->Types[$i];
break;
}
}
}
///////
$oHeadPublisher->addExtJsScript( "setup/main", true ); //adding a javascript file .js
$oHeadPublisher->addContent( "setup/main" ); //adding a html file .html.
$oHeadPublisher->assign( "tabActive", $tabActive );
$oHeadPublisher->assign( "tabItems", $tabItems );
$oHeadPublisher->assign( "_item_selected", (($adminSelected != null) ? $adminSelected : "") );
G::RenderPage( "publish", "extJs" );
//this patch enables the load of the plugin list panel inside de main admin panel iframe
if (isset( $_GET["action"] ) && $_GET["action"] == "pluginsList") {
echo "
<script type=\"text/javascript\">
document.getElementById(\"setup-frame\").src = \"pluginsList\";
</script>
";
}

View File

@@ -12,50 +12,50 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
// lets display the items
$pluginFile = $_GET['id'];
$pluginStatus = $_GET['status'];
$pluginFile = $_GET['id'];
$pluginStatus = $_GET['status'];
$items = array ();
G::LoadClass('plugin');
//here we are enabling or disabling the plugin and all related options registered.
$items = array ();
G::LoadClass( 'plugin' );
//here we are enabling or disabling the plugin and all related options registered.
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while ( false !== ($file = readdir($handle))) {
if ( strpos($file, '.php', 1 ) && $file == $pluginFile) {
if ( $pluginStatus == '1' ) {
//print "change to disable";
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->disablePlugin( $details->sNamespace );
$size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
print "size saved : $size <br>";
} else {
//print "change to ENABLED";
require_once ( PATH_PLUGINS . $pluginFile );
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->enablePlugin( $details->sNamespace);
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
print "size saved : $size <br>";
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while (false !== ($file = readdir( $handle ))) {
if (strpos( $file, '.php', 1 ) && $file == $pluginFile) {
if ($pluginStatus == '1') {
//print "change to disable";
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->disablePlugin( $details->sNamespace );
$size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
print "size saved : $size <br>";
} else {
//print "change to ENABLED";
require_once (PATH_PLUGINS . $pluginFile);
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->enablePlugin( $details->sNamespace );
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
print "size saved : $size <br>";
}
}
}
}
closedir($handle);
}
closedir( $handle );
}
//$oPluginRegistry->showArrays();
//G::Header('location: pluginsList');

View File

@@ -1,78 +1,76 @@
<?php
/**
* pluginsImport.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
if( $access != 1 ){
switch ($access)
{
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
default:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
}
G::LoadClass('plugin');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_PUBLISH = new Publisher;
try {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/pluginImport', '',$Fields ,'pluginsImportFile' );
}
catch ( Exception $e ){
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
}
G::RenderPage('publishBlank', 'blank');
<?php
/**
* pluginsImport.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
}
G::LoadClass( 'plugin' );
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize)
$uploadMaxSize = $postMaxSize;
$Fields['MAX_FILE_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
$G_PUBLISH = new Publisher();
try {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'setup/pluginImport', '', $Fields, 'pluginsImportFile' );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
}
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,166 +1,169 @@
<?php
/**
* processes_ImportFile.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $RBAC;
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
try {
//load the variables
G::LoadClass('plugin');
if ( ! isset($_FILES['form']['error']['PLUGIN_FILENAME'] ) || $_FILES['form']['error']['PLUGIN_FILENAME'] == 1 ) {
throw ( new Exception (G::loadTranslation('ID_ERROR_UPLOADING_PLUGIN_FILENAME') ) );
}
//save the file
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP ;
$tempName = $_FILES['form']['tmp_name']['PLUGIN_FILENAME'];
G::uploadFile($tempName, $path, $filename );
}
if ( ! $_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') {
$pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME'];
throw ( new Exception ( G::loadTranslation('ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array("pluginFilename"=>$pluginFilename)) ));
}
G::LoadThirdParty( 'pear/Archive','Tar');
$tar = new Archive_Tar ( $path. $filename);
$sFileName = substr($filename,0,strrpos($filename, '.' ));
$sClassName = substr($filename,0,strpos($filename, '-' ));
$aFiles = $tar->listContent();
$bMainFile = false;
$bClassFile = false;
if(!is_array($aFiles)){
throw ( new Exception (G::loadTranslation('ID_FAILED_IMPORT_PLUGINS', SYS_LANG, array("filename"=>$filename)) ) ) ;
}
foreach ( $aFiles as $key => $val ) {
if ( $val['filename'] == $sClassName . '.php' ) $bMainFile = true;
if ( $val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php' ) $bClassFile = true;
}
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$pluginFile = $sClassName . '.php';
if ( $bMainFile && $bClassFile ) {
$sAux = $sClassName . 'Plugin';
$fVersionOld = 0.0;
if (file_exists(PATH_PLUGINS . $pluginFile)) {
if (!class_exists($sAux) && !class_exists($sClassName . 'plugin')) {
include PATH_PLUGINS . $pluginFile;
}
if (!class_exists($sAux)) {
$sAux = $sClassName . 'plugin';
}
$oClass = new $sAux($sClassName);
$fVersionOld = $oClass->iVersion;
unset($oClass);
}
$res = $tar->extract ( $path );
$sContent = file_get_contents($path . $pluginFile);
$chain = preg_quote('extends enterprisePlugin');
if(strpos($sContent,$chain)){
throw ( new Exception ('The plugin '.$filename.' is a Enterprise Edition Plugin, please install the Enterprise Plugins Manager to use this plugin.'));
}
$sContent = str_ireplace($sAux, $sAux . '_', $sContent);
$sContent = str_ireplace('PATH_PLUGINS', "'".$path."'", $sContent);
$sContent = preg_replace("/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent);
$sContent = preg_replace("/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent);
//header('Content-Type: text/plain');var_dump($sClassName, $sContent);die;
file_put_contents($path . $pluginFile, $sContent);
$sAux = $sAux . '_';
include ($path . $pluginFile);
$oClass = new $sAux($sClassName);
$fVersionNew = $oClass->iVersion;
if (!isset($oClass->iPMVersion)) {
$oClass->iPMVersion = 0;
}
if ($oClass->iPMVersion > 0) {
G::LoadClass("system");
if (System::getVersion() > 0) {
if ($oClass->iPMVersion > System::getVersion()) {
//throw new Exception('This plugin needs version ' . $oClass->iPMVersion . ' or higher of ProcessMaker');
}
}
}
if (!isset($oClass->aDependences)) {
$oClass->aDependences = null;
}
if (!empty($oClass->aDependences)) {
foreach ($oClass->aDependences as $aDependence) {
if (file_exists(PATH_PLUGINS . $aDependence['sClassName'] . '.php')) {
require_once PATH_PLUGINS . $aDependence['sClassName'] . '.php';
if (!$oPluginRegistry->getPluginDetails($aDependence['sClassName'] . '.php')) {
$sDependence = $aDependence['sClassName'];
throw new Exception( G::loadTranslation('ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array("Dependence"=>$sDependence )) );
}
}
else {
$sDependence = $aDependence['sClassName'];
throw new Exception( G::loadTranslation('ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array("Dependence"=>$sDependence )) );
}
}
}
unset($oClass);
if ($fVersionOld > $fVersionNew) {
throw new Exception(G::loadTranslation('ID_RECENT_VERSION_PLUGIN'));
}
$res = $tar->extract ( PATH_PLUGINS );
}
else {
throw ( new Exception ( G::loadTranslation('ID_FILE_CONTAIN_CLASS_PLUGIN', SYS_LANG, array("filename"=>$filename, "className"=>$sClassName )) ) ) ;
}
if ( !file_exists ( PATH_PLUGINS . $sClassName . '.php' ) ) {
throw ( new Exception( G::loadTranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array("pluginFile"=>$pluginFile )) ) );
}
require_once (PATH_PLUGINS . $pluginFile);
$oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php");
$size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
$details = $oPluginRegistry->getPluginDetails($pluginFile);
$oPluginRegistry->installPlugin($details->sNamespace);
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
G::header("Location: pluginsMain");
die;
}
catch (Exception $e) {
$_SESSION['__PLUGIN_ERROR__'] = $e->getMessage();
G::header('Location: pluginsMain');
die();
}
<?php
/**
* processes_ImportFile.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
try {
//load the variables
G::LoadClass( 'plugin' );
if (! isset( $_FILES['form']['error']['PLUGIN_FILENAME'] ) || $_FILES['form']['error']['PLUGIN_FILENAME'] == 1) {
throw (new Exception( G::loadTranslation( 'ID_ERROR_UPLOADING_PLUGIN_FILENAME' ) ));
}
//save the file
if ($_FILES['form']['error']['PLUGIN_FILENAME'] == 0) {
$filename = $_FILES['form']['name']['PLUGIN_FILENAME'];
$path = PATH_DOCUMENT . 'input' . PATH_SEP;
$tempName = $_FILES['form']['tmp_name']['PLUGIN_FILENAME'];
G::uploadFile( $tempName, $path, $filename );
}
if (! $_FILES['form']['type']['PLUGIN_FILENAME'] == 'application/octet-stream') {
$pluginFilename = $_FILES['form']['type']['PLUGIN_FILENAME'];
throw (new Exception( G::loadTranslation( 'ID_FILES_INVALID_PLUGIN_FILENAME', SYS_LANG, array ("pluginFilename" => $pluginFilename
) ) ));
}
G::LoadThirdParty( 'pear/Archive', 'Tar' );
$tar = new Archive_Tar( $path . $filename );
$sFileName = substr( $filename, 0, strrpos( $filename, '.' ) );
$sClassName = substr( $filename, 0, strpos( $filename, '-' ) );
$aFiles = $tar->listContent();
$bMainFile = false;
$bClassFile = false;
if (! is_array( $aFiles )) {
throw (new Exception( G::loadTranslation( 'ID_FAILED_IMPORT_PLUGINS', SYS_LANG, array ("filename" => $filename
) ) ));
}
foreach ($aFiles as $key => $val) {
if ($val['filename'] == $sClassName . '.php')
$bMainFile = true;
if ($val['filename'] == $sClassName . PATH_SEP . 'class.' . $sClassName . '.php')
$bClassFile = true;
}
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
$sAux = $sClassName . 'Plugin';
$fVersionOld = 0.0;
if (file_exists( PATH_PLUGINS . $pluginFile )) {
if (! class_exists( $sAux ) && ! class_exists( $sClassName . 'plugin' )) {
include PATH_PLUGINS . $pluginFile;
}
if (! class_exists( $sAux )) {
$sAux = $sClassName . 'plugin';
}
$oClass = new $sAux( $sClassName );
$fVersionOld = $oClass->iVersion;
unset( $oClass );
}
$res = $tar->extract( $path );
$sContent = file_get_contents( $path . $pluginFile );
$chain = preg_quote( 'extends enterprisePlugin' );
if (strpos( $sContent, $chain )) {
throw (new Exception( 'The plugin ' . $filename . ' is a Enterprise Edition Plugin, please install the Enterprise Plugins Manager to use this plugin.' ));
}
$sContent = str_ireplace( $sAux, $sAux . '_', $sContent );
$sContent = str_ireplace( 'PATH_PLUGINS', "'" . $path . "'", $sContent );
$sContent = preg_replace( "/\\\$oPluginRegistry\s*=\s*&\s*PMPluginRegistry::getSingleton\s*\(\s*\)\s*;/i", null, $sContent );
$sContent = preg_replace( "/\\\$oPluginRegistry->registerPlugin\s*\(\s*[\"\']" . $sClassName . "[\"\']\s*,\s*__FILE__\s*\)\s*;/i", null, $sContent );
//header('Content-Type: text/plain');var_dump($sClassName, $sContent);die;
file_put_contents( $path . $pluginFile, $sContent );
$sAux = $sAux . '_';
include ($path . $pluginFile);
$oClass = new $sAux( $sClassName );
$fVersionNew = $oClass->iVersion;
if (! isset( $oClass->iPMVersion )) {
$oClass->iPMVersion = 0;
}
if ($oClass->iPMVersion > 0) {
G::LoadClass( "system" );
if (System::getVersion() > 0) {
if ($oClass->iPMVersion > System::getVersion()) {
//throw new Exception('This plugin needs version ' . $oClass->iPMVersion . ' or higher of ProcessMaker');
}
}
}
if (! isset( $oClass->aDependences )) {
$oClass->aDependences = null;
}
if (! empty( $oClass->aDependences )) {
foreach ($oClass->aDependences as $aDependence) {
if (file_exists( PATH_PLUGINS . $aDependence['sClassName'] . '.php' )) {
require_once PATH_PLUGINS . $aDependence['sClassName'] . '.php';
if (! $oPluginRegistry->getPluginDetails( $aDependence['sClassName'] . '.php' )) {
$sDependence = $aDependence['sClassName'];
throw new Exception( G::loadTranslation( 'ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array ("Dependence" => $sDependence
) ) );
}
} else {
$sDependence = $aDependence['sClassName'];
throw new Exception( G::loadTranslation( 'ID_PLUGIN_DEPENDENCE_PLUGIN', SYS_LANG, array ("Dependence" => $sDependence
) ) );
}
}
}
unset( $oClass );
if ($fVersionOld > $fVersionNew) {
throw new Exception( G::loadTranslation( 'ID_RECENT_VERSION_PLUGIN' ) );
}
$res = $tar->extract( PATH_PLUGINS );
} else {
throw (new Exception( G::loadTranslation( 'ID_FILE_CONTAIN_CLASS_PLUGIN', SYS_LANG, array ("filename" => $filename,"className" => $sClassName
) ) ));
}
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {
throw (new Exception( G::loadTranslation( 'ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array ("pluginFile" => $pluginFile
) ) ));
}
require_once (PATH_PLUGINS . $pluginFile);
$oPluginRegistry->registerPlugin( $sClassName, PATH_PLUGINS . $sClassName . ".php" );
$size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() );
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$oPluginRegistry->installPlugin( $details->sNamespace );
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() );
G::header( "Location: pluginsMain" );
die();
} catch (Exception $e) {
$_SESSION['__PLUGIN_ERROR__'] = $e->getMessage();
G::header( 'Location: pluginsMain' );
die();
}

View File

@@ -1,125 +1,114 @@
<?php
/**
* pluginsList.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
// lets display the items
//$items = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , 'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char');
$items = Array();
//***************** Plugins **************************
G::LoadClass('plugin');
//here we are loading all plugins registered
//krumo ($items); die;
$aPluginsPP = array();
if (is_file(PATH_PLUGINS . 'enterprise/data/data')) {
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
foreach ($aPlugins as $aPlugin) {
$aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php';
}
}
$oPluginRegistry =& PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while ( false !== ($file = readdir($handle))) {
if (in_array($file, $aPluginsPP)) {
continue;
}
if ( strpos($file, '.php',1) && is_file(PATH_PLUGINS . $file) ) {
include_once ( PATH_PLUGINS . $file );
$pluginDetail = $oPluginRegistry->getPluginDetails ( $file );
//print_R ($pluginDetail );
//die;
//$status = $pluginDetail->enabled ? 'Enabled' : 'Disabled';
if($pluginDetail==NULL) continue; //When for some reason we gen NULL plugin
$status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$status = $pluginDetail->enabled ? 1: 0;
if ( isset ($pluginDetail->aWorkspaces ) ) {
if ( ! in_array ( SYS_SYS, $pluginDetail->aWorkspaces) )
continue;
}
$linkEditValue = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? G::LoadTranslation('ID_SETUP') : ' ';
//g::pr($pluginDetail->sSetupPage);
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
$link = 'pluginsChange?id=' . $file . '&status=' . $pluginDetail->enabled;
$linkEdit = 'pluginsSetup?id=' . $file ;
$pluginName = $pluginDetail->sFriendlyName;
$pluginId = $pluginDetail->sNamespace;
$removePluginMsg = str_replace("\r\n","<br>",G::LoadTranslation('ID_MSG_REMOVE_PLUGIN'));
$linkRemove = 'javascript:showMessage(\''.$removePluginMsg .'<br>'.$pluginName.' \',\''.$pluginId.'\')';
// $linkRemove = 'pluginsRemove?id='.$pluginId.'.php&status=1';
if ( isset ($pluginDetail) ){
if(!$pluginDetail->bPrivate){
$items[] = array (
'id' => (count($items) + 1),
'namespace'=>$pluginDetail->sNamespace,
'title'=>$pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)',
'className' => $pluginDetail->sNamespace,
'description' => $pluginDetail->sDescription,
'version' => $pluginDetail->iVersion,
'setupPage' => $pluginDetail->sSetupPage,
'status_label'=> $status_label,
'status'=> $status,
'setup'=>$setup,
'sFile' => $file,
'sStatusFile' => $pluginDetail->enabled
);
}
}
}
}
closedir($handle);
}
$folders['items'] = $items;
//g::pr($items);
echo G::json_encode($items);
die;
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer');
$c = new Criteria ('dbarray');
$c->setDBArrayTable('plugins');
//$c->addAscendingOrderByColumn ('id');
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/setup/pluginList.js');
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/pluginList', $c );
G::RenderPage('publishBlank', 'blank');
?>
<?php
/**
* pluginsList.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
// lets display the items
//$items = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , 'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char');
$items = Array ();
//***************** Plugins **************************
G::LoadClass( 'plugin' );
//here we are loading all plugins registered
//krumo ($items); die;
$aPluginsPP = array ();
if (is_file( PATH_PLUGINS . 'enterprise/data/data' )) {
$aPlugins = unserialize( trim( file_get_contents( PATH_PLUGINS . 'enterprise/data/data' ) ) );
foreach ($aPlugins as $aPlugin) {
$aPluginsPP[] = substr( $aPlugin['sFilename'], 0, strpos( $aPlugin['sFilename'], '-' ) ) . '.php';
}
}
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while (false !== ($file = readdir( $handle ))) {
if (in_array( $file, $aPluginsPP )) {
continue;
}
if (strpos( $file, '.php', 1 ) && is_file( PATH_PLUGINS . $file )) {
include_once (PATH_PLUGINS . $file);
$pluginDetail = $oPluginRegistry->getPluginDetails( $file );
//print_R ($pluginDetail );
//die;
//$status = $pluginDetail->enabled ? 'Enabled' : 'Disabled';
if ($pluginDetail == null)
continue; //When for some reason we gen NULL plugin
$status_label = $pluginDetail->enabled ? G::LoadTranslation( 'ID_ENABLED' ) : G::LoadTranslation( 'ID_DISABLED' );
$status = $pluginDetail->enabled ? 1 : 0;
if (isset( $pluginDetail->aWorkspaces )) {
if (! in_array( SYS_SYS, $pluginDetail->aWorkspaces ))
continue;
}
$linkEditValue = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? G::LoadTranslation( 'ID_SETUP' ) : ' ';
//g::pr($pluginDetail->sSetupPage);
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
$link = 'pluginsChange?id=' . $file . '&status=' . $pluginDetail->enabled;
$linkEdit = 'pluginsSetup?id=' . $file;
$pluginName = $pluginDetail->sFriendlyName;
$pluginId = $pluginDetail->sNamespace;
$removePluginMsg = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_REMOVE_PLUGIN' ) );
$linkRemove = 'javascript:showMessage(\'' . $removePluginMsg . '<br>' . $pluginName . ' \',\'' . $pluginId . '\')';
// $linkRemove = 'pluginsRemove?id='.$pluginId.'.php&status=1';
if (isset( $pluginDetail )) {
if (! $pluginDetail->bPrivate) {
$items[] = array ('id' => (count( $items ) + 1),'namespace' => $pluginDetail->sNamespace,'title' => $pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)','className' => $pluginDetail->sNamespace,'description' => $pluginDetail->sDescription,'version' => $pluginDetail->iVersion,'setupPage' => $pluginDetail->sSetupPage,'status_label' => $status_label,'status' => $status,'setup' => $setup,
'sFile' => $file,'sStatusFile' => $pluginDetail->enabled
);
}
}
}
}
closedir( $handle );
}
$folders['items'] = $items;
//g::pr($items);
echo G::json_encode( $items );
die();
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer' );
$c = new Criteria( 'dbarray' );
$c->setDBArrayTable( 'plugins' );
//$c->addAscendingOrderByColumn ('id');
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/setup/pluginList.js' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/pluginList', $c );
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -12,32 +12,26 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$headPublisher =& headPublisher::getSingleton();
$headPublisher->addExtJsScript('setup/pluginsMain', false);
$headPublisher->assign("PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign("SYS_SKIN", SYS_SKIN);
$translations = G::getTranslations(array(
'ID_CONFIGURE', 'ID_STATUS', 'ID_DELETE', 'ID_IMPORT', 'ID_SELECT',
'ID_STATUS', 'ID_ACTIVATE', 'ID_DEACTIVATE', 'ID_PLUGINS',
'ID_SELECT', 'ID_NO_SELECTION_WARNING', 'ID_MSG_REMOVE_PLUGIN',
'ID_TITLE', 'ID_VERSION', 'ID_STATUS', 'ID_TITLE', 'ID_VERSION', 'ID_DESCRIPTION',
'ID_STATUS', 'ID_PLUGIN_CANT_DELETE', 'ID_XPDL_IMPORT', 'ID_DISABLE', 'ID_ENABLE', 'ID_CONFIRM'
));
$headPublisher->assign('TRANSLATIONS', $translations);
if (isset($_SESSION['__PLUGIN_ERROR__'])) {
$headPublisher->assign('__PLUGIN_ERROR__', $_SESSION['__PLUGIN_ERROR__']);
unset($_SESSION['__PLUGIN_ERROR__']);
$headPublisher = & headPublisher::getSingleton();
$headPublisher->addExtJsScript( 'setup/pluginsMain', false );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "SYS_SKIN", SYS_SKIN );
$translations = G::getTranslations( array ('ID_CONFIGURE','ID_STATUS','ID_DELETE','ID_IMPORT','ID_SELECT','ID_STATUS','ID_ACTIVATE','ID_DEACTIVATE','ID_PLUGINS','ID_SELECT','ID_NO_SELECTION_WARNING','ID_MSG_REMOVE_PLUGIN','ID_TITLE','ID_VERSION','ID_STATUS','ID_TITLE','ID_VERSION','ID_DESCRIPTION','ID_STATUS','ID_PLUGIN_CANT_DELETE','ID_XPDL_IMPORT','ID_DISABLE','ID_ENABLE','ID_CONFIRM'
) );
$headPublisher->assign( 'TRANSLATIONS', $translations );
if (isset( $_SESSION['__PLUGIN_ERROR__'] )) {
$headPublisher->assign( '__PLUGIN_ERROR__', $_SESSION['__PLUGIN_ERROR__'] );
unset( $_SESSION['__PLUGIN_ERROR__'] );
}
G::RenderPage('publish', 'extJs');
G::RenderPage( 'publish', 'extJs' );

View File

@@ -12,15 +12,14 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
@@ -39,20 +38,17 @@ switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
break;
}*/
G::LoadClass("plugin");
G::LoadClass( "plugin" );
$pluginName = $_REQUEST["pluginUid"];
if (file_exists(PATH_PLUGINS . $pluginName . ".php")) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry->uninstallPlugin($pluginName);
$pluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . "plugin.singleton"));
if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$pluginRegistry->uninstallPlugin( $pluginName );
$pluginRegistry->unSerializeInstance( file_get_contents( PATH_DATA_SITE . "plugin.singleton" ) );
}
echo $pluginName . " " . nl2br(G::LoadTranslation("ID_MSG_REMOVE_PLUGIN_SUCCESS"));
echo $pluginName . " " . nl2br( G::LoadTranslation( "ID_MSG_REMOVE_PLUGIN_SUCCESS" ) );

View File

@@ -1,10 +1,10 @@
<?php
/**
* pluginsSetup.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,47 +12,46 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$pluginFile = $_GET['id'];
$pluginFile = $_GET['id'];
G::LoadClass('plugin');
G::LoadClass( 'plugin' );
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$xmlform = isset($details->sPluginFolder) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher;
try {
//the setup page is a special page
if ( substr($xmlform,-4) == '.php' && file_exists ( PATH_PLUGINS . $xmlform ) ) {
require_once ( PATH_PLUGINS . $xmlform );
die;
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
$xmlform = isset( $details->sPluginFolder ) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher();
try {
//the setup page is a special page
if (substr( $xmlform, - 4 ) == '.php' && file_exists( PATH_PLUGINS . $xmlform )) {
require_once (PATH_PLUGINS . $xmlform);
die();
}
//the setup page is a xmlform and using the default showform and saveform function to serialize data
if ( !file_exists ( PATH_PLUGINS.$xmlform.'.xml' ) ) throw ( new Exception ('setup .xml file is not defined for this plugin') );
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '',$Fields ,'pluginsSetupSave?id='.$pluginFile );
}
catch ( Exception $e ){
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
}
G::RenderPage('publishBlank', 'blank');
if (! file_exists( PATH_PLUGINS . $xmlform . '.xml' ))
throw (new Exception( 'setup .xml file is not defined for this plugin' ));
$Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $Fields, 'pluginsSetupSave?id=' . $pluginFile );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
}
G::RenderPage( 'publishBlank', 'blank' );

View File

@@ -1,10 +1,10 @@
<?php
/**
* pluginsSetupSave.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
@@ -12,37 +12,36 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$pluginFile = $_GET['id'];
G::LoadClass('plugin');
$pluginFile = $_GET['id'];
G::LoadClass( 'plugin' );
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
try {
$Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST );
$str = "$Fields fields saved successfully!";
G::SendTemporalMessage($str, 'info', 'string', 3, 100);
G::Header("location: pluginsSetup?id=$pluginFile");
} catch ( Exception $e ){
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
try {
$Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST );
$str = "$Fields fields saved successfully!";
G::SendTemporalMessage( $str, 'info', 'string', 3, 100 );
G::Header( "location: pluginsSetup?id=$pluginFile" );
} catch (Exception $e) {
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage('publish');
}
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish' );
}

View File

@@ -1,30 +1,30 @@
<?php
switch($_GET['action']){
case 'saveOption':
try {
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
$oServerConf->unsetHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF');
if (isset($_POST['acceptHB'])) {
$oServerConf->setHeartbeatProperty('HB_OPTION', 1, 'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
$response->enable = true;
}
else {
$oServerConf->setHeartbeatProperty('HB_OPTION', 0, 'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
$oServerConf->setHeartbeatProperty('HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF');
$response->enable = false;
}
$response->success = true;
} catch ( Exception $e ) {
$response->success = false;
$response->msg = $e->getMessage();
}
echo G::json_encode($response);
break;
switch ($_GET['action']) {
case 'saveOption':
try {
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
$oServerConf->unsetHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' );
if (isset( $_POST['acceptHB'] )) {
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
$response->enable = true;
} else {
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
$oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF' );
$response->enable = false;
}
$response->success = true;
} catch (Exception $e) {
$response->success = false;
$response->msg = $e->getMessage();
}
echo G::json_encode( $response );
break;
}

View File

@@ -1,38 +1,37 @@
<?php
/**
* main.php Cases List main processor
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$oHeadPublisher =& headPublisher::getSingleton();
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
//you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace
$sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF');
$heartBeatChecked = $sflag == 1? true: false;
$oHeadPublisher->addExtJsScript('setup/processHeartBeatConfig', true ); //adding a javascript file .js
$oHeadPublisher->assign('heartBeatChecked', $heartBeatChecked);
G::RenderPage('publish', 'extJs');
<?php
/**
* main.php Cases List main processor
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2010 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$oHeadPublisher = & headPublisher::getSingleton();
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
//you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace
$sflag = $oServerConf->getHeartbeatProperty( 'HB_OPTION', 'HEART_BEAT_CONF' );
$heartBeatChecked = $sflag == 1 ? true : false;
$oHeadPublisher->addExtJsScript( 'setup/processHeartBeatConfig', true ); //adding a javascript file .js
$oHeadPublisher->assign( 'heartBeatChecked', $heartBeatChecked );
G::RenderPage( 'publish', 'extJs' );

View File

@@ -1,35 +1,35 @@
<?php
if($RBAC->userCanAccess('PM_SETUP') != 1 && $RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1){
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
//G::header('location: ../login/login');
die;
}
try {
G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
$sflag = $_POST['HB_OPTION'];
$oServerConf->unsetHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF');
if($sflag){
$oServerConf->setHeartbeatProperty('HB_OPTION',1,'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
echo "active";
}else{
$oServerConf->setHeartbeatProperty('HB_OPTION',0,'HEART_BEAT_CONF');
$oServerConf->unsetHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
$oServerConf->setHeartbeatProperty('HB_BEAT_TYPE','endbeat','HEART_BEAT_CONF');
echo "inactive";
}
//$oServerConf->setHeartbeatProperty('HB_OPTION',$_POST['HB_OPTION'],'HEART_BEAT_CONF');
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publishBlank', 'blank' );
}
<?php
if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1 && $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
//G::header('location: ../login/login');
die();
}
try {
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
/*you can use SYS_TEMP or SYS_SYS ON HEAR_BEAT_CONF to save for each workspace*/
$sflag = $_POST['HB_OPTION'];
$oServerConf->unsetHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' );
if ($sflag) {
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
echo "active";
} else {
$oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' );
$oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
$oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF' );
echo "inactive";
}
//$oServerConf->setHeartbeatProperty('HB_OPTION',$_POST['HB_OPTION'],'HEART_BEAT_CONF');
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publishBlank', 'blank' );
}

View File

@@ -12,101 +12,94 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
try {//ini_set('display_errors','1');
global $RBAC;
switch ($RBAC->userCanAccess('PM_LOGIN'))
{
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
function changeNamelogo($snameLogo)
{
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $snameLogo = ereg_replace("[áàâãª]","a",$snameLogo);
// $snameLogo = ereg_replace("[ÁÀÂÃ]","A",$snameLogo);
// $snameLogo = ereg_replace("[ÍÌÎ]","I",$snameLogo);
// $snameLogo = ereg_replace("[íìî]","i",$snameLogo);
// $snameLogo = ereg_replace("[éèê]","e",$snameLogo);
// $snameLogo = ereg_replace("[ÉÈÊ]","E",$snameLogo);
// $snameLogo = ereg_replace("[óòôõº]","o",$snameLogo);
// $snameLogo = ereg_replace("[ÓÒÔÕ]","O",$snameLogo);
// $snameLogo = ereg_replace("[úùû]","u",$snameLogo);
// $snameLogo = ereg_replace("[ÚÙÛ]","U",$snameLogo);
$snameLogo = preg_replace("/[áàâãª]/", "a", $snameLogo);
$snameLogo = preg_replace("/[ÁÀÂÃ]/", "A", $snameLogo);
$snameLogo = preg_replace("/[ÍÌÎ]/", "I", $snameLogo);
$snameLogo = preg_replace("/[íìî]/", "i", $snameLogo);
$snameLogo = preg_replace("/[éèê]/", "e", $snameLogo);
$snameLogo = preg_replace("/[ÉÈÊ]/", "E", $snameLogo);
$snameLogo = preg_replace("/[óòôõº]/", "o", $snameLogo);
$snameLogo = preg_replace("/[ÓÒÔÕ]/", "O", $snameLogo);
$snameLogo = preg_replace("/[úùû]/", "u", $snameLogo);
$snameLogo = preg_replace("/[ÚÙÛ]/", "U", $snameLogo);
$snameLogo = str_replace("ç","c",$snameLogo);
$snameLogo = str_replace("Ç","C",$snameLogo);
$snameLogo = str_replace("[ñ]","n",$snameLogo);
$snameLogo = str_replace("[Ñ]","N",$snameLogo);
return ($snameLogo);
}
try { //ini_set('display_errors','1');
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_LOGIN' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$sfunction =$_GET['function'];
switch($sfunction){
case 'replacementLogo':
$snameLogo=urldecode($_GET['NAMELOGO']);
$snameLogo=trim($snameLogo);
$snameLogo=changeNamelogo($snameLogo);
G::loadClass('configuration');
$oConf = new Configurations;
$aConf = Array(
'WORKSPACE_LOGO_NAME' => SYS_SYS,
'DEFAULT_LOGO_NAME' => $snameLogo
);
$oConf->aConfig = $aConf;
$oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '','');
G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
//header('location: uplogo.php');
//G::header('location: uplogo');
break;
case 'restoreLogo':
$snameLogo=$_GET['NAMELOGO'];
G::loadClass('configuration');
$oConf = new Configurations;
$aConf = Array(
'WORKSPACE_LOGO_NAME' => '',
'DEFAULT_LOGO_NAME' => ''
);
$oConf->aConfig = $aConf;
$oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '','');
G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels');
break;
function changeNamelogo ($snameLogo)
{
// The ereg_replace function has been DEPRECATED as of PHP 5.3.0.
// $snameLogo = ereg_replace("[áàâãª]","a",$snameLogo);
// $snameLogo = ereg_replace("[Ã<>ÀÃÃ]","A",$snameLogo);
// $snameLogo = ereg_replace("[Ã<>ÌÎ]","I",$snameLogo);
// $snameLogo = ereg_replace("[íìî]","i",$snameLogo);
// $snameLogo = ereg_replace("[éèê]","e",$snameLogo);
// $snameLogo = ereg_replace("[ÉÈÊ]","E",$snameLogo);
// $snameLogo = ereg_replace("[óòôõº]","o",$snameLogo);
// $snameLogo = ereg_replace("[ÓÒÔÕ]","O",$snameLogo);
// $snameLogo = ereg_replace("[úùû]","u",$snameLogo);
// $snameLogo = ereg_replace("[ÚÙÛ]","U",$snameLogo);
$snameLogo = preg_replace( "/[áàâãª]/", "a", $snameLogo );
$snameLogo = preg_replace( "/[Ã<>ÀÃÃ]/", "A", $snameLogo );
$snameLogo = preg_replace( "/[Ã<>ÌÎ]/", "I", $snameLogo );
$snameLogo = preg_replace( "/[íìî]/", "i", $snameLogo );
$snameLogo = preg_replace( "/[éèê]/", "e", $snameLogo );
$snameLogo = preg_replace( "/[ÉÈÊ]/", "E", $snameLogo );
$snameLogo = preg_replace( "/[óòôõº]/", "o", $snameLogo );
$snameLogo = preg_replace( "/[ÓÒÔÕ]/", "O", $snameLogo );
$snameLogo = preg_replace( "/[úùû]/", "u", $snameLogo );
$snameLogo = preg_replace( "/[ÚÙÛ]/", "U", $snameLogo );
$snameLogo = str_replace( "ç", "c", $snameLogo );
$snameLogo = str_replace( "Ç", "C", $snameLogo );
$snameLogo = str_replace( "[ñ]", "n", $snameLogo );
$snameLogo = str_replace( "[Ñ]", "N", $snameLogo );
return ($snameLogo);
}
}
$sfunction = $_GET['function'];
switch ($sfunction) {
case 'replacementLogo':
$snameLogo = urldecode( $_GET['NAMELOGO'] );
$snameLogo = trim( $snameLogo );
$snameLogo = changeNamelogo( $snameLogo );
G::loadClass( 'configuration' );
$oConf = new Configurations();
$aConf = Array ('WORKSPACE_LOGO_NAME' => SYS_SYS,'DEFAULT_LOGO_NAME' => $snameLogo
);
$oConf->aConfig = $aConf;
$oConf->saveConfig( 'USER_LOGO_REPLACEMENT', '', '', '' );
G::SendTemporalMessage( 'ID_REPLACED_LOGO', 'tmp-info', 'labels' );
//header('location: uplogo.php');
//G::header('location: uplogo');
break;
case 'restoreLogo':
$snameLogo = $_GET['NAMELOGO'];
G::loadClass( 'configuration' );
$oConf = new Configurations();
$aConf = Array ('WORKSPACE_LOGO_NAME' => '','DEFAULT_LOGO_NAME' => ''
);
$oConf->aConfig = $aConf;
$oConf->saveConfig( 'USER_LOGO_REPLACEMENT', '', '', '' );
G::SendTemporalMessage( 'ID_REPLACED_LOGO', 'tmp-info', 'labels' );
break;
}
} catch (Exception $oException) {
die( $oException->getMessage() );
}
catch (Exception $oException) {
die($oException->getMessage());
}
?>