Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -174,14 +174,16 @@ printf ( "mafe-{$hashVendors}.js file has %d bytes\n", filesize("{$rootPath}/wor
|
|||||||
out("=> compresing and combining css files", 'info');
|
out("=> compresing and combining css files", 'info');
|
||||||
|
|
||||||
$cssFiles = array (
|
$cssFiles = array (
|
||||||
"workflow/public_html/lib/pmUI/pmui.min.css",
|
|
||||||
"workflow/public_html/lib/mafe/mafe.min.css",
|
|
||||||
"gulliver/js/codemirror/lib/codemirror.css",
|
"gulliver/js/codemirror/lib/codemirror.css",
|
||||||
|
|
||||||
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css",
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css",
|
||||||
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css",
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css",
|
||||||
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css",
|
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css",
|
||||||
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css"
|
"gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/content.css",
|
||||||
|
|
||||||
|
"workflow/public_html/lib/pmUI/pmui.min.css",
|
||||||
|
"workflow/public_html/lib/mafe/mafe.min.css"
|
||||||
|
|
||||||
);
|
);
|
||||||
$bigHandler = fopen ("{$rootPath}/workflow/public_html/lib/css/mafe-{$hashVendors}.css", "w");
|
$bigHandler = fopen ("{$rootPath}/workflow/public_html/lib/css/mafe-{$hashVendors}.css", "w");
|
||||||
foreach ($cssFiles as $cssFile) {
|
foreach ($cssFiles as $cssFile) {
|
||||||
|
|||||||
@@ -20,17 +20,18 @@ Background:
|
|||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the response charset is "UTF-8"
|
And the response charset is "UTF-8"
|
||||||
And the type is "object"
|
And the type is "object"
|
||||||
|
And the "dep_uid" property equals "12921473252d567506e6e63079240767"
|
||||||
And the "dep_parent" property equals ""
|
And the "dep_parent" property equals ""
|
||||||
And the "dep_title" property equals "Sales Division"
|
And the "dep_title" property equals "Sales Division"
|
||||||
And the "dep_status" property equals "ACTIVE"
|
And the "dep_status" property equals "ACTIVE"
|
||||||
And the "dep_manager" property equals ""
|
And the "dep_manager" property equals "38102442252d5671a629009013495090"
|
||||||
And the "dep_ldap_dn" property equals ""
|
And the "dep_ldap_dn" property equals ""
|
||||||
And the "dep_last" property equals "0"
|
And the "dep_last" property equals "0"
|
||||||
And the "dep_manager_username" property equals ""
|
And the "dep_manager_username" property equals "dylan"
|
||||||
And the "dep_manager_lastname" property equals ""
|
And the "dep_manager_firstname" property equals "Dylan"
|
||||||
|
And the "dep_manager_lastname" property equals "Burns"
|
||||||
And the "has_children" property equals "0"
|
And the "has_children" property equals "0"
|
||||||
|
|
||||||
|
|
||||||
Scenario: Create a new department in the workspace
|
Scenario: Create a new department in the workspace
|
||||||
Given POST this data:
|
Given POST this data:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -20,14 +20,16 @@ Background:
|
|||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the response charset is "UTF-8"
|
And the response charset is "UTF-8"
|
||||||
And the type is "object"
|
And the type is "object"
|
||||||
|
And the "dep_uid" property equals "12921473252d567506e6e63079240767"
|
||||||
And the "dep_parent" property equals ""
|
And the "dep_parent" property equals ""
|
||||||
And the "dep_title" property equals "Sales Division"
|
And the "dep_title" property equals "Sales Division"
|
||||||
And the "dep_status" property equals "ACTIVE"
|
And the "dep_status" property equals "ACTIVE"
|
||||||
And the "dep_manager" property equals ""
|
And the "dep_manager" property equals "38102442252d5671a629009013495090"
|
||||||
And the "dep_ldap_dn" property equals ""
|
And the "dep_ldap_dn" property equals ""
|
||||||
And the "dep_last" property equals "0"
|
And the "dep_last" property equals "0"
|
||||||
And the "dep_manager_username" property equals ""
|
And the "dep_manager_username" property equals "dylan"
|
||||||
And the "dep_manager_lastname" property equals ""
|
And the "dep_manager_firstname" property equals "Dylan"
|
||||||
|
And the "dep_manager_lastname" property equals "Burns"
|
||||||
And the "has_children" property equals "0"
|
And the "has_children" property equals "0"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,3 +26,12 @@ Scenario Outline: Create a new departments in the workspace with bad parameters
|
|||||||
| without dep_title | | | ACTIVE | 400 | dep_title |
|
| without dep_title | | | ACTIVE | 400 | dep_title |
|
||||||
| Invalid dep_parent | Department 2 | 28036030000000000000005009591640 | ACTIVE | 400 | dep_parent |
|
| Invalid dep_parent | Department 2 | 28036030000000000000005009591640 | ACTIVE | 400 | dep_parent |
|
||||||
| Invalid dep_status | Department 3 | | TRIGGER | 400 | dep_status |
|
| Invalid dep_status | Department 3 | | TRIGGER | 400 | dep_status |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Delete a department when have asigned user (negative tests)
|
||||||
|
Given that I want to delete a resource with the key "15978182252d5674d210310076985235"
|
||||||
|
And I request "department/15978182252d5674d210310076985235"
|
||||||
|
Then the response status code should be 400
|
||||||
|
And the response status message should have the following text "<cannot be deleted>"
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ Scenario Outline: Create a new case in workspace with process "Derivation rules
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Create a new case Impersonate in workspace with process "Derivation rules - sequential"
|
Scenario Outline: Create a new case Impersonate in workspace with process "Derivation rules - sequential"
|
||||||
Given POST this data:
|
Given POST this data:
|
||||||
"""
|
"""
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,13 @@ Scenario: Create a new case Impersonate in workspace with process "Derivation ru
|
|||||||
And the response charset is "UTF-8"
|
And the response charset is "UTF-8"
|
||||||
And the content type is "application/json"
|
And the content type is "application/json"
|
||||||
And the type is "object"
|
And the type is "object"
|
||||||
And store "caseId" in session array as variable "case1"
|
And store "caseId" in session array as variable "caseId_<case_number>"
|
||||||
|
And store "caseNumber" in session array as variable "caseNumber_<case_number>"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| case_number |
|
||||||
|
| 1 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Reassigns a case to a different user
|
Scenario: Reassigns a case to a different user
|
||||||
@@ -127,6 +133,8 @@ Scenario: Reassigns a case to a different user
|
|||||||
And the type is "object"
|
And the type is "object"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scenario: Autoderivate a case to the next task in the process
|
Scenario: Autoderivate a case to the next task in the process
|
||||||
Given PUT this data:
|
Given PUT this data:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -142,45 +142,11 @@ Scenario Outline: Create new Trigger: createDWS
|
|||||||
And store "tri_uid" in session array as variable "tri_uid<i>"
|
And store "tri_uid" in session array as variable "tri_uid<i>"
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
| i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer |
|
| i | Description | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer |
|
||||||
| 1 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta |
|
| 1 | Create pmTrSharpoint | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta |
|
||||||
|
| 2 | Create a trigger without sending fields not required | pmTrSharepoint | createDWS | Sharepoint 2 | | SCRIPT | @@SERVER | username:password | Test DWS 1 | @@users | Test DWS | /files/test.doc | |
|
||||||
|
|
||||||
|
|
||||||
Scenario Outline: Create new Trigger: createDWS (no enviar campos no requeridos)
|
|
||||||
Given POST this data:
|
|
||||||
"""
|
|
||||||
{
|
|
||||||
"tri_title": "<tri_title>",
|
|
||||||
"tri_description": "<tri_description>",
|
|
||||||
"tri_type": "<tri_type>",
|
|
||||||
"tri_params": {
|
|
||||||
"input": {
|
|
||||||
|
|
||||||
"sharepointServer": "<tri_params.input.sharepointServer>",
|
|
||||||
"auth": "<tri_params.input.auth>",
|
|
||||||
"name": "<tri_params.input.name>",
|
|
||||||
"users": "<tri_params.input.users>",
|
|
||||||
"title": "<tri_params.input.title>",
|
|
||||||
"documents": "<tri_params.input.documents>"
|
|
||||||
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"tri_answer": "<tri_params.output.tri_answer>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
|
|
||||||
And the content type is "application/json"
|
|
||||||
Then the response status code should be 201
|
|
||||||
And the response charset is "UTF-8"
|
|
||||||
And the type is "object"
|
|
||||||
And store "tri_uid" in session array as variable "tri_uid<i>"
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
| i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer |
|
|
||||||
| 2 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta |
|
|
||||||
|
|
||||||
|
|
||||||
Scenario Outline: Update Trigger
|
Scenario Outline: Update Trigger
|
||||||
Given PUT this data:
|
Given PUT this data:
|
||||||
@@ -280,6 +246,7 @@ Scenario Outline: Create new Trigger: createDWS
|
|||||||
| i |
|
| i |
|
||||||
| 0 |
|
| 0 |
|
||||||
| 1 |
|
| 1 |
|
||||||
|
| 2 |
|
||||||
|
|
||||||
|
|
||||||
Scenario: Get a List of triggers of a project
|
Scenario: Get a List of triggers of a project
|
||||||
|
|||||||
@@ -344,8 +344,8 @@ class WebApplication
|
|||||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);
|
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);
|
||||||
|
|
||||||
// smarty constants
|
// smarty constants
|
||||||
// define( "PATH_SMARTY_C", PATH_C . "smarty" . PATH_SEP . "c" );
|
define( "PATH_SMARTY_C", PATH_C . "smarty" . PATH_SEP . "c" );
|
||||||
// define( "PATH_SMARTY_CACHE", PATH_C . "smarty" . PATH_SEP . "cache" );
|
define( "PATH_SMARTY_CACHE", PATH_C . "smarty" . PATH_SEP . "cache" );
|
||||||
|
|
||||||
define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/");
|
define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/");
|
||||||
define("PATH_DOCUMENT", PATH_DATA_SITE . "files/");
|
define("PATH_DOCUMENT", PATH_DATA_SITE . "files/");
|
||||||
@@ -366,6 +366,33 @@ class WebApplication
|
|||||||
echo "WARNING! No server info found!";
|
echo "WARNING! No server info found!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global definitions, before it was the defines.php file
|
||||||
|
*/
|
||||||
|
|
||||||
|
// URL Key
|
||||||
|
define( "URL_KEY", 'c0l0s40pt1mu59r1m3' );
|
||||||
|
|
||||||
|
// Other definitions
|
||||||
|
define( 'TIMEOUT_RESPONSE', 100 ); //web service timeout
|
||||||
|
define( 'APPLICATION_CODE', 'ProcessMaker' ); //to login like workflow system
|
||||||
|
define( 'MAIN_POFILE', 'processmaker' );
|
||||||
|
define( 'PO_SYSTEM_VERSION', 'PM 4.0.1' );
|
||||||
|
|
||||||
|
// Environment definitions
|
||||||
|
define( 'G_PRO_ENV', 'PRODUCTION' );
|
||||||
|
define( 'G_DEV_ENV', 'DEVELOPMENT' );
|
||||||
|
define( 'G_TEST_ENV', 'TEST' );
|
||||||
|
|
||||||
|
// Number of files per folder at PATH_UPLOAD (cases documents)
|
||||||
|
define( 'APPLICATION_DOCUMENTS_PER_FOLDER', 1000 );
|
||||||
|
|
||||||
|
// Server of ProcessMaker Library
|
||||||
|
define( 'PML_SERVER', 'http://library.processmaker.com' );
|
||||||
|
define( 'PML_WSDL_URL', PML_SERVER . '/syspmLibrary/en/green/services/wsdl' );
|
||||||
|
define( 'PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess' );
|
||||||
|
define( 'PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/download' );
|
||||||
|
|
||||||
// create memcached singleton
|
// create memcached singleton
|
||||||
//\Bootstrap::LoadClass("memcached");
|
//\Bootstrap::LoadClass("memcached");
|
||||||
//$memcache = PMmemcached::getSingleton( SYS_SYS );
|
//$memcache = PMmemcached::getSingleton( SYS_SYS );
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ class Bootstrap
|
|||||||
self::registerClass("XmlForm_Field_cellMark", PATH_GULLIVER . "class.xmlformExtension.php");
|
self::registerClass("XmlForm_Field_cellMark", PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
self::registerClass("XmlForm_Field_DVEditor", PATH_GULLIVER . "class.xmlformExtension.php");
|
self::registerClass("XmlForm_Field_DVEditor", PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
self::registerClass("XmlForm_Field_FastSearch", PATH_GULLIVER . "class.xmlformExtension.php");
|
self::registerClass("XmlForm_Field_FastSearch", PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
|
self::registerClass("xmlformTemplate", PATH_GULLIVER . "class.xmlformTemplate.php");
|
||||||
self::registerClass("ymlDomain", PATH_GULLIVER . "class.ymlDomain.php");
|
self::registerClass("ymlDomain", PATH_GULLIVER . "class.ymlDomain.php");
|
||||||
self::registerClass("ymlTestCases", PATH_GULLIVER . "class.ymlTestCases.php");
|
self::registerClass("ymlTestCases", PATH_GULLIVER . "class.ymlTestCases.php");
|
||||||
|
|
||||||
@@ -743,7 +744,7 @@ class Bootstrap
|
|||||||
* @param array list plugins active
|
* @param array list plugins active
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function LoadTranslationPlugins ($lang = SYS_LANG, $listPluginsActive)
|
public static function LoadTranslationPlugins ($lang = SYS_LANG, $listPluginsActive)
|
||||||
{
|
{
|
||||||
if ( ! ( is_array ( $listPluginsActive ) ) ) {
|
if ( ! ( is_array ( $listPluginsActive ) ) ) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -5463,417 +5463,7 @@ class XmlForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Class xmlformTemplate
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @package gulliver.system
|
|
||||||
* @access public
|
|
||||||
*/
|
|
||||||
class xmlformTemplate extends Smarty
|
|
||||||
{
|
|
||||||
public $template;
|
|
||||||
public $templateFile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function xmlformTemplate
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @param string templateFile
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function xmlformTemplate (&$form, $templateFile)
|
|
||||||
{
|
|
||||||
$this->template_dir = PATH_XMLFORM;
|
|
||||||
$this->compile_dir = PATH_SMARTY_C;
|
|
||||||
$this->cache_dir = PATH_SMARTY_CACHE;
|
|
||||||
$this->config_dir = PATH_THIRDPARTY . 'smarty/configs';
|
|
||||||
$this->caching = false;
|
|
||||||
|
|
||||||
// register the resource name "db"
|
|
||||||
$this->templateFile = $templateFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function printTemplate
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @param string target
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function printTemplate (&$form, $target = 'smarty')
|
|
||||||
{
|
|
||||||
if (strcasecmp( $target, 'smarty' ) === 0) {
|
|
||||||
$varPrefix = '$';
|
|
||||||
}
|
|
||||||
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
|
||||||
$varPrefix = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$ft = new StdClass();
|
|
||||||
foreach ($form as $name => $value) {
|
|
||||||
if (($name !== 'fields') && ($value !== '')) {
|
|
||||||
$ft->{$name} = '{$form_' . $name . '}';
|
|
||||||
}
|
|
||||||
if ($name === 'cols') {
|
|
||||||
$ft->{$name} = $value;
|
|
||||||
}
|
|
||||||
if ($name === 'owner') {
|
|
||||||
$ft->owner = & $form->owner;
|
|
||||||
}
|
|
||||||
if ($name === 'deleteRow') {
|
|
||||||
$ft->deleteRow = $form->deleteRow;
|
|
||||||
}
|
|
||||||
if ($name === 'addRow') {
|
|
||||||
$ft->addRow = $form->addRow;
|
|
||||||
}
|
|
||||||
if ($name === 'editRow') {
|
|
||||||
$ft->editRow = $form->editRow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! isset( $ft->action )) {
|
|
||||||
$ft->action = '{$form_action}';
|
|
||||||
}
|
|
||||||
$hasRequiredFields = false;
|
|
||||||
|
|
||||||
foreach ($form->fields as $k => $v) {
|
|
||||||
$ft->fields[$k] = $v->cloneObject();
|
|
||||||
$ft->fields[$k]->label = '{' . $varPrefix . $k . '}';
|
|
||||||
|
|
||||||
if ($form->type === 'grid') {
|
|
||||||
if (strcasecmp( $target, 'smarty' ) === 0) {
|
|
||||||
$ft->fields[$k]->field = '{' . $varPrefix . 'form.' . $k . '[row]}';
|
|
||||||
}
|
|
||||||
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
|
||||||
$ft->fields[$k]->field = '{' . $varPrefix . 'form[' . $k . '][row]}';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (strcasecmp( $target, 'smarty' ) === 0) {
|
|
||||||
$ft->fields[$k]->field = '{' . $varPrefix . 'form.' . $k . '}';
|
|
||||||
}
|
|
||||||
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
|
||||||
$ft->fields[$k]->field = '{' . $varPrefix . 'form[' . $k . ']}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$hasRequiredFields = $hasRequiredFields | (isset( $v->required ) && ($v->required == '1') && ($v->mode == 'edit'));
|
|
||||||
|
|
||||||
if ($v->type == 'xmlmenu') {
|
|
||||||
$menu = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset( $menu )) {
|
|
||||||
if (isset( $menu->owner->values['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] )) {
|
|
||||||
$prevStep_url = $menu->owner->values['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'];
|
|
||||||
|
|
||||||
$this->assign( 'prevStep_url', $prevStep_url );
|
|
||||||
$this->assign( 'prevStep_label', G::loadTranslation( 'ID_BACK' ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assign( 'hasRequiredFields', $hasRequiredFields );
|
|
||||||
$this->assign( 'form', $ft );
|
|
||||||
$this->assign( 'printTemplate', true );
|
|
||||||
$this->assign( 'printJSFile', false );
|
|
||||||
$this->assign( 'printJavaScript', false );
|
|
||||||
//$this->assign ( 'dynaformSetFocus', "try {literal}{{/literal} dynaformSetFocus();}catch(e){literal}{{/literal}}" );
|
|
||||||
return $this->fetch( $this->templateFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function printJavaScript
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function printJavaScript (&$form)
|
|
||||||
{
|
|
||||||
$this->assign( 'form', $form );
|
|
||||||
$this->assign( 'printTemplate', false );
|
|
||||||
$this->assign( 'printJSFile', false );
|
|
||||||
$this->assign( 'printJavaScript', true );
|
|
||||||
return $this->fetch( $this->templateFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function printJSFile
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function printJSFile (&$form)
|
|
||||||
{
|
|
||||||
//JS designer>preview
|
|
||||||
if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms_Editor\?.*PRO_UID=.*DYN_UID=.*$/", $_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms\/dynaforms_Ajax.*$/", $_SERVER["REQUEST_URI"])) {
|
|
||||||
$js = null;
|
|
||||||
|
|
||||||
foreach ($form->fields as $index => $value) {
|
|
||||||
$field = $value;
|
|
||||||
|
|
||||||
if ($field->type == "javascript" && !empty($field->code)) {
|
|
||||||
$js = $js . " " . $field->code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($js != null) {
|
|
||||||
$form->jsDesignerPreview = "
|
|
||||||
//JS designer>preview
|
|
||||||
$js
|
|
||||||
|
|
||||||
loadForm_" . $form->id . "(\"../gulliver/defaultAjaxDynaform\");
|
|
||||||
|
|
||||||
if (typeof(dynaformOnload) != \"undefined\") {
|
|
||||||
dynaformOnload();
|
|
||||||
}
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assign( 'form', $form );
|
|
||||||
$this->assign( 'printTemplate', false );
|
|
||||||
$this->assign( 'printJSFile', true );
|
|
||||||
$this->assign( 'printJavaScript', false );
|
|
||||||
return $this->fetch( $this->templateFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function getFields
|
|
||||||
*
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getFields (&$form, $therow = -1)
|
|
||||||
{
|
|
||||||
$result = array ();
|
|
||||||
|
|
||||||
foreach ($form->fields as $k => $v) {
|
|
||||||
$field = $v;
|
|
||||||
|
|
||||||
if ($form->mode != '') {
|
|
||||||
#@ last modification: erik
|
|
||||||
$field->mode = $form->mode; #@
|
|
||||||
} #@
|
|
||||||
|
|
||||||
//if (isset($form->fields[$k]->sql)) $form->fields[$k]->executeSQL( $form );
|
|
||||||
$value = (isset( $form->values[$k] )) ? $form->values[$k] : null;
|
|
||||||
$result[$k] = G::replaceDataField( $form->fields[$k]->label, $form->values );
|
|
||||||
|
|
||||||
if ($form->type == 'xmlform') {
|
|
||||||
if (in_array($field->type, array("text", "currency", "percentage", "password", "suggest", "textarea", "dropdown", "yesno", "listbox", "checkbox", "date", "link", "file"))) {
|
|
||||||
$result[$k] = '<label for="form[' . $k . ']">' . $result[$k] . '</label>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! is_array( $value )) {
|
|
||||||
if ($form->type == 'grid') {
|
|
||||||
$aAux = array ();
|
|
||||||
if (!isset($form->values[$form->name])) {
|
|
||||||
$form->values[$form->name] = array();
|
|
||||||
}
|
|
||||||
if ($therow == - 1) {
|
|
||||||
for ($i = 0; $i < count( $form->values[$form->name] ); $i ++) {
|
|
||||||
$aAux[] = '';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for ($i = 0; $i < $therow; $i ++) {
|
|
||||||
$aAux[] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($field->type) {
|
|
||||||
case "link":
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid($aAux, array(), $form);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid($aAux, $form);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch ($field->type) {
|
|
||||||
case "link":
|
|
||||||
$result["form"][$k] = $form->fields[$k]->render(
|
|
||||||
$value,
|
|
||||||
(isset($form->values[$k . "_label"]))? $form->values[$k . "_label"] : null,
|
|
||||||
$form
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$result["form"][$k] = $form->fields[$k]->render($value, $form);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/*if (isset ( $form->owner )) {
|
|
||||||
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
|
|
||||||
$i = count ( $value );
|
|
||||||
$j = count ( $form->owner->values [$form->name] );
|
|
||||||
|
|
||||||
for($i; $i < $j; $i ++) {
|
|
||||||
$value [] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if ($field->type == "grid") {
|
|
||||||
// Fix data for grids
|
|
||||||
if (is_array($form->fields[$k]->fields)) {
|
|
||||||
foreach ($form->fields[$k]->fields as $gridFieldName => $gridField) {
|
|
||||||
$valueLength = count($value);
|
|
||||||
for ($i = 1; $i <= $valueLength; $i++) {
|
|
||||||
if (!isset($value[$i][$gridFieldName])) {
|
|
||||||
switch ($gridField->type) {
|
|
||||||
case 'checkbox':
|
|
||||||
$defaultAttribute = 'falseValue';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$defaultAttribute = 'defaultValue';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$value[$i][$gridFieldName] = isset($gridField->$defaultAttribute) ? $gridField->$defaultAttribute : '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$form->fields[$k]->setScrollStyle( $form );
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, $therow );
|
|
||||||
} else {
|
|
||||||
switch ($field->type) {
|
|
||||||
case "dropdown":
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, false, $therow );
|
|
||||||
break;
|
|
||||||
case "file":
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, $therow );
|
|
||||||
break;
|
|
||||||
case "link":
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid(
|
|
||||||
$value,
|
|
||||||
(isset($form->values[$k . "_label"]))? $form->values[$k . "_label"] : array(),
|
|
||||||
$form
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($form as $name => $value) {
|
|
||||||
if ($name !== 'fields') {
|
|
||||||
$result['form_' . $name] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function printObject
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string form
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function printObject(&$form, $therow = -1)
|
|
||||||
{
|
|
||||||
//to do: generate the template for templatePower.
|
|
||||||
//DONE: The template was generated in printTemplate, to use it
|
|
||||||
// is necesary to load the file with templatePower and send the array
|
|
||||||
//result
|
|
||||||
$this->register_resource ( 'mem', array (array (&$this, '_get_template' ), array ($this, '_get_timestamp' ), array ($this, '_get_secure' ), array ($this, '_get_trusted' ) ) );
|
|
||||||
$result = $this->getFields ( $form, $therow );
|
|
||||||
|
|
||||||
$this->assign ( array ('PATH_TPL' => PATH_TPL ) );
|
|
||||||
$this->assign ( $result );
|
|
||||||
if ( defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R' ) {
|
|
||||||
switch( $form->type ){
|
|
||||||
case 'toolbar':
|
|
||||||
$form->align = 'right';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assign ( array ('_form' => $form ) );
|
|
||||||
//'mem:defaultTemplate'.$form->name obtains the template generated for the
|
|
||||||
//current "form" object, then this resource y saved by Smarty in the
|
|
||||||
//cache_dir. To avoiding troubles when two forms with the same id are being
|
|
||||||
//drawed in a same page with different templates, add an . rand(1,1000)
|
|
||||||
//to the resource name. This is because the process of creating templates
|
|
||||||
//(with the method "printTemplate") and painting takes less than 1 second
|
|
||||||
//so the new template resource generally will had the same timestamp.
|
|
||||||
$output = $this->fetch ( 'mem:defaultTemplate' . $form->name );
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty plugin
|
|
||||||
* -------------------------------------------------------------
|
|
||||||
* Type: resource
|
|
||||||
* Name: mem
|
|
||||||
* Purpose: Fetches templates from this object
|
|
||||||
* -------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
public function _get_template($tpl_name, &$tpl_source, &$smarty_obj)
|
|
||||||
{
|
|
||||||
$tpl_source = $this->template;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function _get_timestamp
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string tpl_name
|
|
||||||
* @param string tpl_timestamp
|
|
||||||
* @param string smarty_obj
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function _get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
|
|
||||||
{
|
|
||||||
//NOTE: +1 prevents to load the smarty cache instead of this resource
|
|
||||||
$tpl_timestamp = time () + 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function _get_secure
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string tpl_name
|
|
||||||
* @param string smarty_obj
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function _get_secure($tpl_name, &$smarty_obj)
|
|
||||||
{
|
|
||||||
// assume all templates are secure
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function _get_trusted
|
|
||||||
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
||||||
* @access public
|
|
||||||
* @param string tpl_name
|
|
||||||
* @param string smarty_obj
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function _get_trusted($tpl_name, &$smarty_obj)
|
|
||||||
{
|
|
||||||
// not used for templates
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package gulliver.system
|
* @package gulliver.system
|
||||||
|
|||||||
412
gulliver/system/class.xmlformTemplate.php
Normal file
412
gulliver/system/class.xmlformTemplate.php
Normal file
@@ -0,0 +1,412 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Class xmlformTemplate
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @package gulliver.system
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
class xmlformTemplate extends Smarty
|
||||||
|
{
|
||||||
|
public $template;
|
||||||
|
public $templateFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function xmlformTemplate
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @param string templateFile
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function xmlformTemplate (&$form, $templateFile)
|
||||||
|
{
|
||||||
|
$this->template_dir = PATH_XMLFORM;
|
||||||
|
$this->compile_dir = PATH_SMARTY_C;
|
||||||
|
$this->cache_dir = PATH_SMARTY_CACHE;
|
||||||
|
$this->config_dir = PATH_THIRDPARTY . 'smarty/configs';
|
||||||
|
$this->caching = false;
|
||||||
|
|
||||||
|
// register the resource name "db"
|
||||||
|
$this->templateFile = $templateFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function printTemplate
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @param string target
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function printTemplate (&$form, $target = 'smarty')
|
||||||
|
{
|
||||||
|
if (strcasecmp( $target, 'smarty' ) === 0) {
|
||||||
|
$varPrefix = '$';
|
||||||
|
}
|
||||||
|
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
||||||
|
$varPrefix = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ft = new StdClass();
|
||||||
|
foreach ($form as $name => $value) {
|
||||||
|
if (($name !== 'fields') && ($value !== '')) {
|
||||||
|
$ft->{$name} = '{$form_' . $name . '}';
|
||||||
|
}
|
||||||
|
if ($name === 'cols') {
|
||||||
|
$ft->{$name} = $value;
|
||||||
|
}
|
||||||
|
if ($name === 'owner') {
|
||||||
|
$ft->owner = & $form->owner;
|
||||||
|
}
|
||||||
|
if ($name === 'deleteRow') {
|
||||||
|
$ft->deleteRow = $form->deleteRow;
|
||||||
|
}
|
||||||
|
if ($name === 'addRow') {
|
||||||
|
$ft->addRow = $form->addRow;
|
||||||
|
}
|
||||||
|
if ($name === 'editRow') {
|
||||||
|
$ft->editRow = $form->editRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (! isset( $ft->action )) {
|
||||||
|
$ft->action = '{$form_action}';
|
||||||
|
}
|
||||||
|
$hasRequiredFields = false;
|
||||||
|
|
||||||
|
foreach ($form->fields as $k => $v) {
|
||||||
|
$ft->fields[$k] = $v->cloneObject();
|
||||||
|
$ft->fields[$k]->label = '{' . $varPrefix . $k . '}';
|
||||||
|
|
||||||
|
if ($form->type === 'grid') {
|
||||||
|
if (strcasecmp( $target, 'smarty' ) === 0) {
|
||||||
|
$ft->fields[$k]->field = '{' . $varPrefix . 'form.' . $k . '[row]}';
|
||||||
|
}
|
||||||
|
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
||||||
|
$ft->fields[$k]->field = '{' . $varPrefix . 'form[' . $k . '][row]}';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strcasecmp( $target, 'smarty' ) === 0) {
|
||||||
|
$ft->fields[$k]->field = '{' . $varPrefix . 'form.' . $k . '}';
|
||||||
|
}
|
||||||
|
if (strcasecmp( $target, 'templatePower' ) === 0) {
|
||||||
|
$ft->fields[$k]->field = '{' . $varPrefix . 'form[' . $k . ']}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hasRequiredFields = $hasRequiredFields | (isset( $v->required ) && ($v->required == '1') && ($v->mode == 'edit'));
|
||||||
|
|
||||||
|
if ($v->type == 'xmlmenu') {
|
||||||
|
$menu = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset( $menu )) {
|
||||||
|
if (isset( $menu->owner->values['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'] )) {
|
||||||
|
$prevStep_url = $menu->owner->values['__DYNAFORM_OPTIONS']['PREVIOUS_STEP'];
|
||||||
|
|
||||||
|
$this->assign( 'prevStep_url', $prevStep_url );
|
||||||
|
$this->assign( 'prevStep_label', G::loadTranslation( 'ID_BACK' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign( 'hasRequiredFields', $hasRequiredFields );
|
||||||
|
$this->assign( 'form', $ft );
|
||||||
|
$this->assign( 'printTemplate', true );
|
||||||
|
$this->assign( 'printJSFile', false );
|
||||||
|
$this->assign( 'printJavaScript', false );
|
||||||
|
//$this->assign ( 'dynaformSetFocus', "try {literal}{{/literal} dynaformSetFocus();}catch(e){literal}{{/literal}}" );
|
||||||
|
return $this->fetch( $this->templateFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function printJavaScript
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function printJavaScript (&$form)
|
||||||
|
{
|
||||||
|
$this->assign( 'form', $form );
|
||||||
|
$this->assign( 'printTemplate', false );
|
||||||
|
$this->assign( 'printJSFile', false );
|
||||||
|
$this->assign( 'printJavaScript', true );
|
||||||
|
return $this->fetch( $this->templateFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function printJSFile
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function printJSFile (&$form)
|
||||||
|
{
|
||||||
|
//JS designer>preview
|
||||||
|
if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms_Editor\?.*PRO_UID=.*DYN_UID=.*$/", $_SERVER["HTTP_REFERER"]) && preg_match("/^.*dynaforms\/dynaforms_Ajax.*$/", $_SERVER["REQUEST_URI"])) {
|
||||||
|
$js = null;
|
||||||
|
|
||||||
|
foreach ($form->fields as $index => $value) {
|
||||||
|
$field = $value;
|
||||||
|
|
||||||
|
if ($field->type == "javascript" && !empty($field->code)) {
|
||||||
|
$js = $js . " " . $field->code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($js != null) {
|
||||||
|
$form->jsDesignerPreview = "
|
||||||
|
//JS designer>preview
|
||||||
|
$js
|
||||||
|
|
||||||
|
loadForm_" . $form->id . "(\"../gulliver/defaultAjaxDynaform\");
|
||||||
|
|
||||||
|
if (typeof(dynaformOnload) != \"undefined\") {
|
||||||
|
dynaformOnload();
|
||||||
|
}
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign( 'form', $form );
|
||||||
|
$this->assign( 'printTemplate', false );
|
||||||
|
$this->assign( 'printJSFile', true );
|
||||||
|
$this->assign( 'printJavaScript', false );
|
||||||
|
return $this->fetch( $this->templateFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function getFields
|
||||||
|
*
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getFields (&$form, $therow = -1)
|
||||||
|
{
|
||||||
|
$result = array ();
|
||||||
|
|
||||||
|
foreach ($form->fields as $k => $v) {
|
||||||
|
$field = $v;
|
||||||
|
|
||||||
|
if ($form->mode != '') {
|
||||||
|
#@ last modification: erik
|
||||||
|
$field->mode = $form->mode; #@
|
||||||
|
} #@
|
||||||
|
|
||||||
|
//if (isset($form->fields[$k]->sql)) $form->fields[$k]->executeSQL( $form );
|
||||||
|
$value = (isset( $form->values[$k] )) ? $form->values[$k] : null;
|
||||||
|
$result[$k] = G::replaceDataField( $form->fields[$k]->label, $form->values );
|
||||||
|
|
||||||
|
if ($form->type == 'xmlform') {
|
||||||
|
if (in_array($field->type, array("text", "currency", "percentage", "password", "suggest", "textarea", "dropdown", "yesno", "listbox", "checkbox", "date", "link", "file"))) {
|
||||||
|
$result[$k] = '<label for="form[' . $k . ']">' . $result[$k] . '</label>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_array( $value )) {
|
||||||
|
if ($form->type == 'grid') {
|
||||||
|
$aAux = array ();
|
||||||
|
if (!isset($form->values[$form->name])) {
|
||||||
|
$form->values[$form->name] = array();
|
||||||
|
}
|
||||||
|
if ($therow == - 1) {
|
||||||
|
for ($i = 0; $i < count( $form->values[$form->name] ); $i ++) {
|
||||||
|
$aAux[] = '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for ($i = 0; $i < $therow; $i ++) {
|
||||||
|
$aAux[] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($field->type) {
|
||||||
|
case "link":
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid($aAux, array(), $form);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid($aAux, $form);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch ($field->type) {
|
||||||
|
case "link":
|
||||||
|
$result["form"][$k] = $form->fields[$k]->render(
|
||||||
|
$value,
|
||||||
|
(isset($form->values[$k . "_label"]))? $form->values[$k . "_label"] : null,
|
||||||
|
$form
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result["form"][$k] = $form->fields[$k]->render($value, $form);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*if (isset ( $form->owner )) {
|
||||||
|
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
|
||||||
|
$i = count ( $value );
|
||||||
|
$j = count ( $form->owner->values [$form->name] );
|
||||||
|
|
||||||
|
for($i; $i < $j; $i ++) {
|
||||||
|
$value [] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if ($field->type == "grid") {
|
||||||
|
// Fix data for grids
|
||||||
|
if (is_array($form->fields[$k]->fields)) {
|
||||||
|
foreach ($form->fields[$k]->fields as $gridFieldName => $gridField) {
|
||||||
|
$valueLength = count($value);
|
||||||
|
for ($i = 1; $i <= $valueLength; $i++) {
|
||||||
|
if (!isset($value[$i][$gridFieldName])) {
|
||||||
|
switch ($gridField->type) {
|
||||||
|
case 'checkbox':
|
||||||
|
$defaultAttribute = 'falseValue';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$defaultAttribute = 'defaultValue';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$value[$i][$gridFieldName] = isset($gridField->$defaultAttribute) ? $gridField->$defaultAttribute : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$form->fields[$k]->setScrollStyle( $form );
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, $therow );
|
||||||
|
} else {
|
||||||
|
switch ($field->type) {
|
||||||
|
case "dropdown":
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, false, $therow );
|
||||||
|
break;
|
||||||
|
case "file":
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form, $therow );
|
||||||
|
break;
|
||||||
|
case "link":
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid(
|
||||||
|
$value,
|
||||||
|
(isset($form->values[$k . "_label"]))? $form->values[$k . "_label"] : array(),
|
||||||
|
$form
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result["form"][$k] = $form->fields[$k]->renderGrid( $value, $form );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($form as $name => $value) {
|
||||||
|
if ($name !== 'fields') {
|
||||||
|
$result['form_' . $name] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function printObject
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string form
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function printObject(&$form, $therow = -1)
|
||||||
|
{
|
||||||
|
//to do: generate the template for templatePower.
|
||||||
|
//DONE: The template was generated in printTemplate, to use it
|
||||||
|
// is necesary to load the file with templatePower and send the array
|
||||||
|
//result
|
||||||
|
$this->register_resource ( 'mem', array (array (&$this, '_get_template' ), array ($this, '_get_timestamp' ), array ($this, '_get_secure' ), array ($this, '_get_trusted' ) ) );
|
||||||
|
$result = $this->getFields ( $form, $therow );
|
||||||
|
|
||||||
|
$this->assign ( array ('PATH_TPL' => PATH_TPL ) );
|
||||||
|
$this->assign ( $result );
|
||||||
|
if ( defined('SYS_LANG_DIRECTION') && SYS_LANG_DIRECTION == 'R' ) {
|
||||||
|
switch( $form->type ){
|
||||||
|
case 'toolbar':
|
||||||
|
$form->align = 'right';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assign ( array ('_form' => $form ) );
|
||||||
|
//'mem:defaultTemplate'.$form->name obtains the template generated for the
|
||||||
|
//current "form" object, then this resource y saved by Smarty in the
|
||||||
|
//cache_dir. To avoiding troubles when two forms with the same id are being
|
||||||
|
//drawed in a same page with different templates, add an . rand(1,1000)
|
||||||
|
//to the resource name. This is because the process of creating templates
|
||||||
|
//(with the method "printTemplate") and painting takes less than 1 second
|
||||||
|
//so the new template resource generally will had the same timestamp.
|
||||||
|
$output = $this->fetch ( 'mem:defaultTemplate' . $form->name );
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* Type: resource
|
||||||
|
* Name: mem
|
||||||
|
* Purpose: Fetches templates from this object
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public function _get_template($tpl_name, &$tpl_source, &$smarty_obj)
|
||||||
|
{
|
||||||
|
$tpl_source = $this->template;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function _get_timestamp
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string tpl_name
|
||||||
|
* @param string tpl_timestamp
|
||||||
|
* @param string smarty_obj
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function _get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
|
||||||
|
{
|
||||||
|
//NOTE: +1 prevents to load the smarty cache instead of this resource
|
||||||
|
$tpl_timestamp = time () + 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function _get_secure
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string tpl_name
|
||||||
|
* @param string smarty_obj
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function _get_secure($tpl_name, &$smarty_obj)
|
||||||
|
{
|
||||||
|
// assume all templates are secure
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function _get_trusted
|
||||||
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
||||||
|
* @access public
|
||||||
|
* @param string tpl_name
|
||||||
|
* @param string smarty_obj
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function _get_trusted($tpl_name, &$smarty_obj)
|
||||||
|
{
|
||||||
|
// not used for templates
|
||||||
|
}
|
||||||
|
}
|
||||||
220
gulliver/thirdparty/pear/Archive/Tar.php
vendored
220
gulliver/thirdparty/pear/Archive/Tar.php
vendored
@@ -30,30 +30,28 @@
|
|||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @category File_Formats
|
* @category File_Formats
|
||||||
* @package Archive_Tar
|
* @package Archive_Tar
|
||||||
* @author Vincent Blavet <vincent@phpconcept.net>
|
* @author Vincent Blavet <vincent@phpconcept.net>
|
||||||
* @copyright 1997-2008 The Authors
|
* @copyright 1997-2010 The Authors
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @version CVS: $Id: Tar.php 295988 2010-03-09 08:39:37Z mrook $
|
* @version CVS: $Id$
|
||||||
* @link http://pear.php.net/package/Archive_Tar
|
* @link http://pear.php.net/package/Archive_Tar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'PEAR.php';
|
require_once 'PEAR.php';
|
||||||
|
|
||||||
|
define('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
|
||||||
define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
|
define('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
|
||||||
define ('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a (compressed) Tar archive
|
* Creates a (compressed) Tar archive
|
||||||
*
|
*
|
||||||
* @author Vincent Blavet <vincent@phpconcept.net>
|
* @package Archive_Tar
|
||||||
* @version $Revision: 295988 $
|
* @author Vincent Blavet <vincent@phpconcept.net>
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @package Archive_Tar
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
class Archive_Tar extends PEAR
|
class Archive_Tar extends PEAR
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +89,11 @@ class Archive_Tar extends PEAR
|
|||||||
*/
|
*/
|
||||||
var $_ignore_regexp='';
|
var $_ignore_regexp='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var object PEAR_Error object
|
||||||
|
*/
|
||||||
|
var $error_object=null;
|
||||||
|
|
||||||
// {{{ constructor
|
// {{{ constructor
|
||||||
/**
|
/**
|
||||||
* Archive_Tar Class constructor. This flavour of the constructor only
|
* Archive_Tar Class constructor. This flavour of the constructor only
|
||||||
@@ -104,6 +107,7 @@ class Archive_Tar extends PEAR
|
|||||||
* parameter indicates if gzip or bz2 compression
|
* parameter indicates if gzip or bz2 compression
|
||||||
* is required. For compatibility reason the
|
* is required. For compatibility reason the
|
||||||
* boolean value 'true' means 'gz'.
|
* boolean value 'true' means 'gz'.
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function Archive_Tar($p_tarname, $p_compress = null)
|
function Archive_Tar($p_tarname, $p_compress = null)
|
||||||
@@ -200,6 +204,7 @@ class Archive_Tar extends PEAR
|
|||||||
* @param array $p_filelist An array of filenames and directory names, or a
|
* @param array $p_filelist An array of filenames and directory names, or a
|
||||||
* single string with names separated by a single
|
* single string with names separated by a single
|
||||||
* blank space.
|
* blank space.
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @see createModify()
|
* @see createModify()
|
||||||
* @access public
|
* @access public
|
||||||
@@ -222,6 +227,7 @@ class Archive_Tar extends PEAR
|
|||||||
* @param array $p_filelist An array of filenames and directory names, or a
|
* @param array $p_filelist An array of filenames and directory names, or a
|
||||||
* single string with names separated by a single
|
* single string with names separated by a single
|
||||||
* blank space.
|
* blank space.
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @see createModify()
|
* @see createModify()
|
||||||
* @access public
|
* @access public
|
||||||
@@ -233,9 +239,9 @@ class Archive_Tar extends PEAR
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ extract()
|
// {{{ extract()
|
||||||
function extract($p_path='')
|
function extract($p_path='', $p_preserve=false)
|
||||||
{
|
{
|
||||||
return $this->extractModify($p_path, '');
|
return $this->extractModify($p_path, '', $p_preserve);
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
@@ -288,6 +294,7 @@ class Archive_Tar extends PEAR
|
|||||||
* @param string $p_remove_dir A string which contains a path to be
|
* @param string $p_remove_dir A string which contains a path to be
|
||||||
* removed from the memorized path of each
|
* removed from the memorized path of each
|
||||||
* element in the list, when relevant.
|
* element in the list, when relevant.
|
||||||
|
*
|
||||||
* @return boolean true on success, false on error.
|
* @return boolean true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see addModify()
|
* @see addModify()
|
||||||
@@ -361,6 +368,7 @@ class Archive_Tar extends PEAR
|
|||||||
* removed from the memorized path of
|
* removed from the memorized path of
|
||||||
* each element in the list, when
|
* each element in the list, when
|
||||||
* relevant.
|
* relevant.
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
@@ -399,10 +407,13 @@ class Archive_Tar extends PEAR
|
|||||||
* with the string.
|
* with the string.
|
||||||
* @param string $p_string The content of the file added in
|
* @param string $p_string The content of the file added in
|
||||||
* the archive.
|
* the archive.
|
||||||
|
* @param int $p_datetime A custom date/time (unix timestamp)
|
||||||
|
* for the file (optional).
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function addString($p_filename, $p_string)
|
function addString($p_filename, $p_string, $p_datetime = false)
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = true;
|
||||||
|
|
||||||
@@ -417,7 +428,7 @@ class Archive_Tar extends PEAR
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Need to check the get back to the temporary file ? ....
|
// Need to check the get back to the temporary file ? ....
|
||||||
$v_result = $this->_addString($p_filename, $p_string);
|
$v_result = $this->_addString($p_filename, $p_string, $p_datetime);
|
||||||
|
|
||||||
$this->_writeFooter();
|
$this->_writeFooter();
|
||||||
|
|
||||||
@@ -457,18 +468,20 @@ class Archive_Tar extends PEAR
|
|||||||
* @param string $p_remove_path Part of the memorized path that can be
|
* @param string $p_remove_path Part of the memorized path that can be
|
||||||
* removed if present at the beginning of
|
* removed if present at the beginning of
|
||||||
* the file/dir path.
|
* the file/dir path.
|
||||||
|
* @param boolean $p_preserve Preserve user/group ownership of files
|
||||||
|
*
|
||||||
* @return boolean true on success, false on error.
|
* @return boolean true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see extractList()
|
* @see extractList()
|
||||||
*/
|
*/
|
||||||
function extractModify($p_path, $p_remove_path)
|
function extractModify($p_path, $p_remove_path, $p_preserve=false)
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = true;
|
||||||
$v_list_detail = array();
|
$v_list_detail = array();
|
||||||
|
|
||||||
if ($v_result = $this->_openRead()) {
|
if ($v_result = $this->_openRead()) {
|
||||||
$v_result = $this->_extractList($p_path, $v_list_detail,
|
$v_result = $this->_extractList($p_path, $v_list_detail,
|
||||||
"complete", 0, $p_remove_path);
|
"complete", 0, $p_remove_path, $p_preserve);
|
||||||
$this->_close();
|
$this->_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +493,9 @@ class Archive_Tar extends PEAR
|
|||||||
/**
|
/**
|
||||||
* This method extract from the archive one file identified by $p_filename.
|
* This method extract from the archive one file identified by $p_filename.
|
||||||
* The return value is a string with the file content, or NULL on error.
|
* The return value is a string with the file content, or NULL on error.
|
||||||
|
*
|
||||||
* @param string $p_filename The path of the file to extract in a string.
|
* @param string $p_filename The path of the file to extract in a string.
|
||||||
|
*
|
||||||
* @return a string with the file content or NULL.
|
* @return a string with the file content or NULL.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
@@ -490,7 +505,7 @@ class Archive_Tar extends PEAR
|
|||||||
$v_result = $this->_extractInString($p_filename);
|
$v_result = $this->_extractInString($p_filename);
|
||||||
$this->_close();
|
$this->_close();
|
||||||
} else {
|
} else {
|
||||||
$v_result = NULL;
|
$v_result = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@@ -504,6 +519,7 @@ class Archive_Tar extends PEAR
|
|||||||
* in the directory indicated by the optional $p_path parameter.
|
* in the directory indicated by the optional $p_path parameter.
|
||||||
* If indicated the $p_remove_path can be used in the same way as it is
|
* If indicated the $p_remove_path can be used in the same way as it is
|
||||||
* used in extractModify() method.
|
* used in extractModify() method.
|
||||||
|
*
|
||||||
* @param array $p_filelist An array of filenames and directory names,
|
* @param array $p_filelist An array of filenames and directory names,
|
||||||
* or a single string with names separated
|
* or a single string with names separated
|
||||||
* by a single blank space.
|
* by a single blank space.
|
||||||
@@ -512,11 +528,13 @@ class Archive_Tar extends PEAR
|
|||||||
* @param string $p_remove_path Part of the memorized path that can be
|
* @param string $p_remove_path Part of the memorized path that can be
|
||||||
* removed if present at the beginning of
|
* removed if present at the beginning of
|
||||||
* the file/dir path.
|
* the file/dir path.
|
||||||
|
* @param boolean $p_preserve Preserve user/group ownership of files
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
* @see extractModify()
|
* @see extractModify()
|
||||||
*/
|
*/
|
||||||
function extractList($p_filelist, $p_path='', $p_remove_path='')
|
function extractList($p_filelist, $p_path='', $p_remove_path='', $p_preserve=false)
|
||||||
{
|
{
|
||||||
$v_result = true;
|
$v_result = true;
|
||||||
$v_list_detail = array();
|
$v_list_detail = array();
|
||||||
@@ -532,7 +550,7 @@ class Archive_Tar extends PEAR
|
|||||||
|
|
||||||
if ($v_result = $this->_openRead()) {
|
if ($v_result = $this->_openRead()) {
|
||||||
$v_result = $this->_extractList($p_path, $v_list_detail, "partial",
|
$v_result = $this->_extractList($p_path, $v_list_detail, "partial",
|
||||||
$v_list, $p_remove_path);
|
$v_list, $p_remove_path, $p_preserve);
|
||||||
$this->_close();
|
$this->_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +563,9 @@ class Archive_Tar extends PEAR
|
|||||||
* This method set specific attributes of the archive. It uses a variable
|
* This method set specific attributes of the archive. It uses a variable
|
||||||
* list of parameters, in the format attribute code + attribute values :
|
* list of parameters, in the format attribute code + attribute values :
|
||||||
* $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
|
* $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
|
||||||
|
*
|
||||||
* @param mixed $argv variable list of attributes and values
|
* @param mixed $argv variable list of attributes and values
|
||||||
|
*
|
||||||
* @return true on success, false on error.
|
* @return true on success, false on error.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
@@ -599,7 +619,9 @@ class Archive_Tar extends PEAR
|
|||||||
* This method sets the regular expression for ignoring files and directories
|
* This method sets the regular expression for ignoring files and directories
|
||||||
* at import, for example:
|
* at import, for example:
|
||||||
* $arch->setIgnoreRegexp("#CVS|\.svn#");
|
* $arch->setIgnoreRegexp("#CVS|\.svn#");
|
||||||
|
*
|
||||||
* @param string $regexp regular expression defining which files or directories to ignore
|
* @param string $regexp regular expression defining which files or directories to ignore
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function setIgnoreRegexp($regexp)
|
function setIgnoreRegexp($regexp)
|
||||||
@@ -613,7 +635,9 @@ class Archive_Tar extends PEAR
|
|||||||
* This method sets the regular expression for ignoring all files and directories
|
* This method sets the regular expression for ignoring all files and directories
|
||||||
* matching the filenames in the array list at import, for example:
|
* matching the filenames in the array list at import, for example:
|
||||||
* $arch->setIgnoreList(array('CVS', '.svn', 'bin/tool'));
|
* $arch->setIgnoreList(array('CVS', '.svn', 'bin/tool'));
|
||||||
|
*
|
||||||
* @param array $list a list of file or directory names to ignore
|
* @param array $list a list of file or directory names to ignore
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function setIgnoreList($list)
|
function setIgnoreList($list)
|
||||||
@@ -627,23 +651,21 @@ class Archive_Tar extends PEAR
|
|||||||
// {{{ _error()
|
// {{{ _error()
|
||||||
function _error($p_message)
|
function _error($p_message)
|
||||||
{
|
{
|
||||||
// ----- To be completed
|
$this->error_object = &$this->raiseError($p_message);
|
||||||
$this->raiseError($p_message);
|
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _warning()
|
// {{{ _warning()
|
||||||
function _warning($p_message)
|
function _warning($p_message)
|
||||||
{
|
{
|
||||||
// ----- To be completed
|
$this->error_object = &$this->raiseError($p_message);
|
||||||
$this->raiseError($p_message);
|
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _isArchive()
|
// {{{ _isArchive()
|
||||||
function _isArchive($p_filename=NULL)
|
function _isArchive($p_filename=null)
|
||||||
{
|
{
|
||||||
if ($p_filename == NULL) {
|
if ($p_filename == null) {
|
||||||
$p_filename = $this->_tarname;
|
$p_filename = $this->_tarname;
|
||||||
}
|
}
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@@ -654,15 +676,17 @@ class Archive_Tar extends PEAR
|
|||||||
// {{{ _openWrite()
|
// {{{ _openWrite()
|
||||||
function _openWrite()
|
function _openWrite()
|
||||||
{
|
{
|
||||||
if ($this->_compress_type == 'gz')
|
if ($this->_compress_type == 'gz' && function_exists('gzopen'))
|
||||||
$this->_file = @gzopen($this->_tarname, "wb9");
|
$this->_file = @gzopen($this->_tarname, "wb9");
|
||||||
else if ($this->_compress_type == 'bz2')
|
else if ($this->_compress_type == 'bz2' && function_exists('bzopen'))
|
||||||
$this->_file = @bzopen($this->_tarname, "w");
|
$this->_file = @bzopen($this->_tarname, "w");
|
||||||
else if ($this->_compress_type == 'none')
|
else if ($this->_compress_type == 'none')
|
||||||
$this->_file = @fopen($this->_tarname, "wb");
|
$this->_file = @fopen($this->_tarname, "wb");
|
||||||
else
|
else {
|
||||||
$this->_error('Unknown or missing compression type ('
|
$this->_error('Unknown or missing compression type ('
|
||||||
.$this->_compress_type.')');
|
.$this->_compress_type.')');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in write mode \''
|
$this->_error('Unable to open in write mode \''
|
||||||
@@ -707,15 +731,17 @@ class Archive_Tar extends PEAR
|
|||||||
// ----- File to open if the normal Tar file
|
// ----- File to open if the normal Tar file
|
||||||
$v_filename = $this->_tarname;
|
$v_filename = $this->_tarname;
|
||||||
|
|
||||||
if ($this->_compress_type == 'gz')
|
if ($this->_compress_type == 'gz' && function_exists('gzopen'))
|
||||||
$this->_file = @gzopen($v_filename, "rb");
|
$this->_file = @gzopen($v_filename, "rb");
|
||||||
else if ($this->_compress_type == 'bz2')
|
else if ($this->_compress_type == 'bz2' && function_exists('bzopen'))
|
||||||
$this->_file = @bzopen($v_filename, "r");
|
$this->_file = @bzopen($v_filename, "r");
|
||||||
else if ($this->_compress_type == 'none')
|
else if ($this->_compress_type == 'none')
|
||||||
$this->_file = @fopen($v_filename, "rb");
|
$this->_file = @fopen($v_filename, "rb");
|
||||||
else
|
else {
|
||||||
$this->_error('Unknown or missing compression type ('
|
$this->_error('Unknown or missing compression type ('
|
||||||
.$this->_compress_type.')');
|
.$this->_compress_type.')');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in read mode \''.$v_filename.'\'');
|
$this->_error('Unable to open in read mode \''.$v_filename.'\'');
|
||||||
@@ -737,9 +763,11 @@ class Archive_Tar extends PEAR
|
|||||||
return false;
|
return false;
|
||||||
} else if ($this->_compress_type == 'none')
|
} else if ($this->_compress_type == 'none')
|
||||||
$this->_file = @fopen($this->_tarname, "r+b");
|
$this->_file = @fopen($this->_tarname, "r+b");
|
||||||
else
|
else {
|
||||||
$this->_error('Unknown or missing compression type ('
|
$this->_error('Unknown or missing compression type ('
|
||||||
.$this->_compress_type.')');
|
.$this->_compress_type.')');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->_file == 0) {
|
if ($this->_file == 0) {
|
||||||
$this->_error('Unable to open in read/write mode \''
|
$this->_error('Unable to open in read/write mode \''
|
||||||
@@ -917,19 +945,13 @@ class Archive_Tar extends PEAR
|
|||||||
if ($v_filename == '')
|
if ($v_filename == '')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if($v_filename == $p_remove_dir.'/plugin.singleton')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if($v_filename == $p_remove_dir.'/ee')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// ----- ignore files and directories matching the ignore regular expression
|
// ----- ignore files and directories matching the ignore regular expression
|
||||||
if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/'.$v_filename)) {
|
if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/'.$v_filename)) {
|
||||||
$this->_warning("File '$v_filename' ignored");
|
$this->_warning("File '$v_filename' ignored");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($v_filename)) {
|
if (!file_exists($v_filename) && !is_link($v_filename)) {
|
||||||
$this->_warning("File '$v_filename' does not exist");
|
$this->_warning("File '$v_filename' does not exist");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1052,7 @@ class Archive_Tar extends PEAR
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _addString()
|
// {{{ _addString()
|
||||||
function _addString($p_filename, $p_string)
|
function _addString($p_filename, $p_string, $p_datetime = false)
|
||||||
{
|
{
|
||||||
if (!$this->_file) {
|
if (!$this->_file) {
|
||||||
$this->_error('Invalid file descriptor');
|
$this->_error('Invalid file descriptor');
|
||||||
@@ -1045,8 +1067,13 @@ class Archive_Tar extends PEAR
|
|||||||
// ----- Calculate the stored filename
|
// ----- Calculate the stored filename
|
||||||
$p_filename = $this->_translateWinPath($p_filename, false);;
|
$p_filename = $this->_translateWinPath($p_filename, false);;
|
||||||
|
|
||||||
|
// ----- If datetime is not specified, set current time
|
||||||
|
if ($p_datetime === false) {
|
||||||
|
$p_datetime = time();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
|
if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
|
||||||
time(), 384, "", 0, 0))
|
$p_datetime, 384, "", 0, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
@@ -1329,10 +1356,20 @@ class Archive_Tar extends PEAR
|
|||||||
for ($i=156; $i<512; $i++)
|
for ($i=156; $i<512; $i++)
|
||||||
$v_checksum+=ord(substr($v_binary_data,$i,1));
|
$v_checksum+=ord(substr($v_binary_data,$i,1));
|
||||||
|
|
||||||
$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/"
|
if (version_compare(PHP_VERSION,"5.5.0-dev")<0) {
|
||||||
."a8checksum/a1typeflag/a100link/a6magic/a2version/"
|
$fmt = "a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" .
|
||||||
."a32uname/a32gname/a8devmajor/a8devminor",
|
"a8checksum/a1typeflag/a100link/a6magic/a2version/" .
|
||||||
$v_binary_data);
|
"a32uname/a32gname/a8devmajor/a8devminor/a131prefix";
|
||||||
|
} else {
|
||||||
|
$fmt = "Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/" .
|
||||||
|
"Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/" .
|
||||||
|
"Z32uname/Z32gname/Z8devmajor/Z8devminor/Z131prefix";
|
||||||
|
}
|
||||||
|
$v_data = unpack($fmt, $v_binary_data);
|
||||||
|
|
||||||
|
if (strlen($v_data["prefix"]) > 0) {
|
||||||
|
$v_data["filename"] = "$v_data[prefix]/$v_data[filename]";
|
||||||
|
}
|
||||||
|
|
||||||
// ----- Extract the checksum
|
// ----- Extract the checksum
|
||||||
$v_header['checksum'] = OctDec(trim($v_data['checksum']));
|
$v_header['checksum'] = OctDec(trim($v_data['checksum']));
|
||||||
@@ -1384,6 +1421,7 @@ class Archive_Tar extends PEAR
|
|||||||
* Detect and report a malicious file name
|
* Detect and report a malicious file name
|
||||||
*
|
*
|
||||||
* @param string $file
|
* @param string $file
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
@@ -1434,9 +1472,11 @@ class Archive_Tar extends PEAR
|
|||||||
// {{{ _extractInString()
|
// {{{ _extractInString()
|
||||||
/**
|
/**
|
||||||
* This method extract from the archive one file identified by $p_filename.
|
* This method extract from the archive one file identified by $p_filename.
|
||||||
* The return value is a string with the file content, or NULL on error.
|
* The return value is a string with the file content, or null on error.
|
||||||
|
*
|
||||||
* @param string $p_filename The path of the file to extract in a string.
|
* @param string $p_filename The path of the file to extract in a string.
|
||||||
* @return a string with the file content or NULL.
|
*
|
||||||
|
* @return a string with the file content or null.
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _extractInString($p_filename)
|
function _extractInString($p_filename)
|
||||||
@@ -1446,7 +1486,7 @@ class Archive_Tar extends PEAR
|
|||||||
While (strlen($v_binary_data = $this->_readBlock()) != 0)
|
While (strlen($v_binary_data = $this->_readBlock()) != 0)
|
||||||
{
|
{
|
||||||
if (!$this->_readHeader($v_binary_data, $v_header))
|
if (!$this->_readHeader($v_binary_data, $v_header))
|
||||||
return NULL;
|
return null;
|
||||||
|
|
||||||
if ($v_header['filename'] == '')
|
if ($v_header['filename'] == '')
|
||||||
continue;
|
continue;
|
||||||
@@ -1454,14 +1494,14 @@ class Archive_Tar extends PEAR
|
|||||||
// ----- Look for long filename
|
// ----- Look for long filename
|
||||||
if ($v_header['typeflag'] == 'L') {
|
if ($v_header['typeflag'] == 'L') {
|
||||||
if (!$this->_readLongHeader($v_header))
|
if (!$this->_readLongHeader($v_header))
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($v_header['filename'] == $p_filename) {
|
if ($v_header['filename'] == $p_filename) {
|
||||||
if ($v_header['typeflag'] == "5") {
|
if ($v_header['typeflag'] == "5") {
|
||||||
$this->_error('Unable to extract in string a directory '
|
$this->_error('Unable to extract in string a directory '
|
||||||
.'entry {'.$v_header['filename'].'}');
|
.'entry {'.$v_header['filename'].'}');
|
||||||
return NULL;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
$n = floor($v_header['size']/512);
|
$n = floor($v_header['size']/512);
|
||||||
for ($i=0; $i<$n; $i++) {
|
for ($i=0; $i<$n; $i++) {
|
||||||
@@ -1479,13 +1519,13 @@ class Archive_Tar extends PEAR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// {{{ _extractList()
|
// {{{ _extractList()
|
||||||
function _extractList($p_path, &$p_list_detail, $p_mode,
|
function _extractList($p_path, &$p_list_detail, $p_mode,
|
||||||
$p_file_list, $p_remove_path)
|
$p_file_list, $p_remove_path, $p_preserve=false)
|
||||||
{
|
{
|
||||||
$v_result=true;
|
$v_result=true;
|
||||||
$v_nb = 0;
|
$v_nb = 0;
|
||||||
@@ -1506,16 +1546,16 @@ class Archive_Tar extends PEAR
|
|||||||
|
|
||||||
switch ($p_mode) {
|
switch ($p_mode) {
|
||||||
case "complete" :
|
case "complete" :
|
||||||
$v_extract_all = TRUE;
|
$v_extract_all = true;
|
||||||
$v_listing = FALSE;
|
$v_listing = false;
|
||||||
break;
|
break;
|
||||||
case "partial" :
|
case "partial" :
|
||||||
$v_extract_all = FALSE;
|
$v_extract_all = false;
|
||||||
$v_listing = FALSE;
|
$v_listing = false;
|
||||||
break;
|
break;
|
||||||
case "list" :
|
case "list" :
|
||||||
$v_extract_all = FALSE;
|
$v_extract_all = false;
|
||||||
$v_listing = TRUE;
|
$v_listing = true;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
$this->_error('Invalid extract mode ('.$p_mode.')');
|
$this->_error('Invalid extract mode ('.$p_mode.')');
|
||||||
@@ -1553,29 +1593,33 @@ class Archive_Tar extends PEAR
|
|||||||
if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
|
if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
|
||||||
&& (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
|
&& (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
|
||||||
== $p_file_list[$i])) {
|
== $p_file_list[$i])) {
|
||||||
$v_extract_file = TRUE;
|
$v_extract_file = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- It is a file, so compare the file names
|
// ----- It is a file, so compare the file names
|
||||||
elseif ($p_file_list[$i] == $v_header['filename']) {
|
elseif ($p_file_list[$i] == $v_header['filename']) {
|
||||||
$v_extract_file = TRUE;
|
$v_extract_file = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$v_extract_file = TRUE;
|
$v_extract_file = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look if this file need to be extracted
|
// ----- Look if this file need to be extracted
|
||||||
if (($v_extract_file) && (!$v_listing))
|
if (($v_extract_file) && (!$v_listing))
|
||||||
{
|
{
|
||||||
if (($p_remove_path != '')
|
if (($p_remove_path != '')
|
||||||
&& (substr($v_header['filename'], 0, $p_remove_path_size)
|
&& (substr($v_header['filename'].'/', 0, $p_remove_path_size)
|
||||||
== $p_remove_path))
|
== $p_remove_path)) {
|
||||||
$v_header['filename'] = substr($v_header['filename'],
|
$v_header['filename'] = substr($v_header['filename'],
|
||||||
$p_remove_path_size);
|
$p_remove_path_size);
|
||||||
|
if( $v_header['filename'] == '' ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (($p_path != './') && ($p_path != '/')) {
|
if (($p_path != './') && ($p_path != '/')) {
|
||||||
while (substr($p_path, -1) == '/')
|
while (substr($p_path, -1) == '/')
|
||||||
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
||||||
@@ -1653,6 +1697,11 @@ class Archive_Tar extends PEAR
|
|||||||
|
|
||||||
@fclose($v_dest_file);
|
@fclose($v_dest_file);
|
||||||
|
|
||||||
|
if ($p_preserve) {
|
||||||
|
@chown($v_header['filename'], $v_header['uid']);
|
||||||
|
@chgrp($v_header['filename'], $v_header['gid']);
|
||||||
|
}
|
||||||
|
|
||||||
// ----- Change the file mode, mtime
|
// ----- Change the file mode, mtime
|
||||||
@touch($v_header['filename'], $v_header['mtime']);
|
@touch($v_header['filename'], $v_header['mtime']);
|
||||||
if ($v_header['mode'] & 0111) {
|
if ($v_header['mode'] & 0111) {
|
||||||
@@ -1664,10 +1713,17 @@ class Archive_Tar extends PEAR
|
|||||||
|
|
||||||
// ----- Check the file size
|
// ----- Check the file size
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
if (filesize($v_header['filename']) != $v_header['size']) {
|
if (!is_file($v_header['filename'])) {
|
||||||
|
$this->_error('Extracted file '.$v_header['filename']
|
||||||
|
.'does not exist. Archive may be corrupted.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filesize = filesize($v_header['filename']);
|
||||||
|
if ($filesize != $v_header['size']) {
|
||||||
$this->_error('Extracted file '.$v_header['filename']
|
$this->_error('Extracted file '.$v_header['filename']
|
||||||
.' does not have the correct file size \''
|
.' does not have the correct file size \''
|
||||||
.filesize($v_header['filename'])
|
.$filesize
|
||||||
.'\' ('.$v_header['size']
|
.'\' ('.$v_header['size']
|
||||||
.' expected). Archive may be corrupted.');
|
.' expected). Archive may be corrupted.');
|
||||||
return false;
|
return false;
|
||||||
@@ -1740,12 +1796,20 @@ class Archive_Tar extends PEAR
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_compress_type == 'gz') {
|
if ($this->_compress_type == 'gz') {
|
||||||
|
$end_blocks = 0;
|
||||||
|
|
||||||
while (!@gzeof($v_temp_tar)) {
|
while (!@gzeof($v_temp_tar)) {
|
||||||
$v_buffer = @gzread($v_temp_tar, 512);
|
$v_buffer = @gzread($v_temp_tar, 512);
|
||||||
if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
|
if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
|
||||||
|
$end_blocks++;
|
||||||
// do not copy end blocks, we will re-make them
|
// do not copy end blocks, we will re-make them
|
||||||
// after appending
|
// after appending
|
||||||
continue;
|
continue;
|
||||||
|
} elseif ($end_blocks > 0) {
|
||||||
|
for ($i = 0; $i < $end_blocks; $i++) {
|
||||||
|
$this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
|
||||||
|
}
|
||||||
|
$end_blocks = 0;
|
||||||
}
|
}
|
||||||
$v_binary_data = pack("a512", $v_buffer);
|
$v_binary_data = pack("a512", $v_buffer);
|
||||||
$this->_writeBlock($v_binary_data);
|
$this->_writeBlock($v_binary_data);
|
||||||
@@ -1754,9 +1818,19 @@ class Archive_Tar extends PEAR
|
|||||||
@gzclose($v_temp_tar);
|
@gzclose($v_temp_tar);
|
||||||
}
|
}
|
||||||
elseif ($this->_compress_type == 'bz2') {
|
elseif ($this->_compress_type == 'bz2') {
|
||||||
|
$end_blocks = 0;
|
||||||
|
|
||||||
while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
|
while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
|
||||||
if ($v_buffer == ARCHIVE_TAR_END_BLOCK) {
|
if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
|
||||||
|
$end_blocks++;
|
||||||
|
// do not copy end blocks, we will re-make them
|
||||||
|
// after appending
|
||||||
continue;
|
continue;
|
||||||
|
} elseif ($end_blocks > 0) {
|
||||||
|
for ($i = 0; $i < $end_blocks; $i++) {
|
||||||
|
$this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
|
||||||
|
}
|
||||||
|
$end_blocks = 0;
|
||||||
}
|
}
|
||||||
$v_binary_data = pack("a512", $v_buffer);
|
$v_binary_data = pack("a512", $v_buffer);
|
||||||
$this->_writeBlock($v_binary_data);
|
$this->_writeBlock($v_binary_data);
|
||||||
@@ -1818,7 +1892,7 @@ class Archive_Tar extends PEAR
|
|||||||
*
|
*
|
||||||
* @param string $p_dir directory to check
|
* @param string $p_dir directory to check
|
||||||
*
|
*
|
||||||
* @return bool TRUE if the directory exists or was created
|
* @return bool true if the directory exists or was created
|
||||||
*/
|
*/
|
||||||
function _dirCheck($p_dir)
|
function _dirCheck($p_dir)
|
||||||
{
|
{
|
||||||
@@ -1887,7 +1961,11 @@ class Archive_Tar extends PEAR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined('OS_WINDOWS') && OS_WINDOWS) {
|
||||||
$v_result = strtr($v_result, '\\', '/');
|
$v_result = strtr($v_result, '\\', '/');
|
||||||
|
}
|
||||||
|
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,24 @@ class PMPluginRegistry
|
|||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the singleton instance from a serialized stored file
|
||||||
|
*
|
||||||
|
* @param $file
|
||||||
|
* @return PMPluginRegistry
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function loadSingleton($file)
|
||||||
|
{
|
||||||
|
self::$instance = unserialize(file_get_contents($file));
|
||||||
|
|
||||||
|
if (! is_object(self::$instance) || get_class(self::$instance) != "PMPluginRegistry") {
|
||||||
|
throw new Exception("Can't load main PMPluginRegistry object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function generates a storable representation of a value
|
* This function generates a storable representation of a value
|
||||||
* param
|
* param
|
||||||
|
|||||||
@@ -155,13 +155,6 @@ class CaseTracker
|
|||||||
//Array DB
|
//Array DB
|
||||||
$arrayCaseTrackerObject = array();
|
$arrayCaseTrackerObject = array();
|
||||||
|
|
||||||
$arrayCaseTrackerObject[] = array(
|
|
||||||
"obj_uid" => "char",
|
|
||||||
"obj_title" => "char",
|
|
||||||
"obj_description" => "char",
|
|
||||||
"obj_type" => "char"
|
|
||||||
);
|
|
||||||
|
|
||||||
$delimiter = \DBAdapter::getStringDelimiter();
|
$delimiter = \DBAdapter::getStringDelimiter();
|
||||||
|
|
||||||
//DynaForms
|
//DynaForms
|
||||||
@@ -297,13 +290,13 @@ class CaseTracker
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$arrayAvailableCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort(
|
$arrayCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort(
|
||||||
$arrayAvailableCaseTrackerObject,
|
$arrayCaseTrackerObject,
|
||||||
array("obj_type", "obj_title"),
|
array("obj_type", "obj_title"),
|
||||||
SORT_ASC
|
SORT_ASC
|
||||||
);
|
);
|
||||||
|
|
||||||
return $arrayAvailableCaseTrackerObject;
|
return $arrayCaseTrackerObject;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
@@ -390,8 +383,6 @@ class CaseTracker
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set data
|
|
||||||
\G::LoadClass("ArrayPeer");
|
|
||||||
$arraydbCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arraydbCaseTrackerObject, array("cto_position"), SORT_ASC);
|
$arraydbCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arraydbCaseTrackerObject, array("cto_position"), SORT_ASC);
|
||||||
|
|
||||||
return $arrayCaseTrackerObject;
|
return $arrayCaseTrackerObject;
|
||||||
|
|||||||
@@ -477,6 +477,11 @@ class WebEntry
|
|||||||
case "HTML":
|
case "HTML":
|
||||||
global $G_FORM;
|
global $G_FORM;
|
||||||
|
|
||||||
|
if (! class_exists("Smarty")) {
|
||||||
|
$loader = \Maveriks\Util\ClassLoader::getInstance();
|
||||||
|
$loader->addClass("Smarty", PATH_THIRDPARTY . "smarty".PATH_SEP."libs".PATH_SEP."Smarty.class.php");
|
||||||
|
}
|
||||||
|
|
||||||
$G_FORM = new \Form($processUid . "/" . $dynaFormUid, PATH_DYNAFORM, SYS_LANG, false);
|
$G_FORM = new \Form($processUid . "/" . $dynaFormUid, PATH_DYNAFORM, SYS_LANG, false);
|
||||||
$G_FORM->action = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/cases_StartExternal.php";
|
$G_FORM->action = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/cases_StartExternal.php";
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
* this file is used initialize main variables, redirect and dispatch all requests
|
* this file is used initialize main variables, redirect and dispatch all requests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function transactionLog($transactionName){
|
function transactionLog($transactionName){
|
||||||
if (extension_loaded('newrelic')) {
|
if (extension_loaded('newrelic')) {
|
||||||
$baseName="ProcessMaker";
|
$baseName="ProcessMaker";
|
||||||
@@ -609,12 +608,13 @@ Bootstrap::LoadClass( 'plugin' );
|
|||||||
//here we are loading all plugins registered
|
//here we are loading all plugins registered
|
||||||
//the singleton has a list of enabled plugins
|
//the singleton has a list of enabled plugins
|
||||||
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
|
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
|
||||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
|
||||||
|
|
||||||
if (file_exists( $sSerializedFile )) {
|
if (file_exists( $sSerializedFile )) {
|
||||||
$oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
|
$oPluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile);
|
||||||
$attributes = $oPluginRegistry->getAttributes();
|
$attributes = $oPluginRegistry->getAttributes();
|
||||||
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
|
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
|
||||||
|
} else{
|
||||||
|
$oPluginRegistry = PMPluginRegistry::getSingleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup propel definitions and logging
|
// setup propel definitions and logging
|
||||||
|
|||||||
Reference in New Issue
Block a user