From 3fe55aa94f4e68b5e1b95ec1eb74ed5c6b454be0 Mon Sep 17 00:00:00 2001 From: Hector Cortez Date: Tue, 5 Mar 2013 09:12:44 -0400 Subject: [PATCH] BUG 0000 Adjustment for the standardization of code. CODE_STYLE --- gulliver/system/class.headPublisher.php | 278 +++++++++--------- gulliver/system/class.helper.php | 120 ++++---- .../triggers/class.pmAlfrescoFunctions.php | 166 ++++++----- .../appFolder/appFolderSaveDocument.php | 220 +++++++------- 4 files changed, 400 insertions(+), 384 deletions(-) diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index 22b89f69a..021bc8537 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -25,6 +25,7 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ + /** * Class headPublisher * @@ -34,51 +35,50 @@ */ class headPublisher { - public static $instance = null; - var $scriptFiles = array (); - var $leimnudLoad = array (); - /* extJsSkin init coreLoad flag*/ - var $extJsInit = 'false'; - /* extJsSkin store the current skin for the ExtJs*/ - var $extJsSkin = ''; + public static $instance = null; + public $scriptFiles = array(); + public $leimnudLoad = array(); + + /* extJsSkin init coreLoad flag */ + public $extJsInit = 'false'; + /* extJsSkin store the current skin for the ExtJs */ + public $extJsSkin = ''; /* extJsScript Array, to store the file to be include */ - var $extJsScript = array (); + public $extJsScript = array(); /* extJsLibrary Array, to store extended ExtJs lybraries */ - var $extJsLibrary = array (); + public $extJsLibrary = array(); /* extJsContent Array, to store the file to be include in the skin content */ - var $extJsContent = array (); + public $extJsContent = array(); /* extVariable array, to store the variables generated in PHP, and used in JavaScript */ - var $extVariable = array (); + public $extVariable = array(); /* variable array, to store the variables generated in PHP, and used in JavaScript */ - var $vars = array (); + public $vars = array(); /* tplVariable array, to store the variables for template power */ - var $tplVariable = array (); - - var $translationsFile; - - var $leimnudInitString = ' var leimnud = new maborak(); + public $tplVariable = array(); + public $translationsFile; + public $leimnudInitString = ' var leimnud = new maborak(); leimnud.make({ zip:true, inGulliver:true, modules :"dom,abbr,rpc,drag,drop,app,panel,fx,grid,xmlform,validator,dashboard", files :"" });'; - var $headerScript = ' + public $headerScript = ' try{ leimnud.exec(leimnud.fix.memoryLeak); if(leimnud.browser.isIphone){ leimnud.iphone.make(); } }catch(e){}'; - var $disableHeaderScripts = false; - var $title = ''; + public $disableHeaderScripts = false; + public $title = ''; /** * Function headPublisher @@ -87,14 +87,13 @@ class headPublisher * @access public * @return string */ - - public function __construct () + public function __construct() { - $this->addScriptFile( "/js/maborak/core/maborak.js" ); + $this->addScriptFile("/js/maborak/core/maborak.js"); $this->translationsFile = "/js/ext/translation." . SYS_LANG . ".js"; } - function &getSingleton () + public function &getSingleton() { if (self::$instance == null) { self::$instance = new headPublisher(); @@ -111,7 +110,7 @@ class headPublisher * @param eter string LoadType * @return string */ - function setTitle ($title) + public function setTitle($title) { $this->title = $title; } @@ -125,7 +124,7 @@ class headPublisher * @param eter string LoadType * @return string */ - function addScriptFile ($url, $LoadType = 1) + public function addScriptFile($url, $LoadType = 1) { if ($LoadType == 1) { $this->scriptFiles[$url] = $url; @@ -144,8 +143,7 @@ class headPublisher * @param eter string module * @return string */ - - function addInstanceModule ($instance, $module) + public function addInstanceModule($instance, $module) { $this->headerScript .= "leimnud.Package.Load('" . $module . "',{Instance:" . $instance . ",Type:'module'});\n"; } @@ -159,7 +157,7 @@ class headPublisher * @param eter string module * @return string */ - function addClassModule ($class, $module) + public function addClassModule($class, $module) { $this->headerScript .= "leimnud.Package.Load('" . $module . "',{Class:" . $class . ",Type:'module'});\n"; } @@ -172,7 +170,7 @@ class headPublisher * @param eter string script * @return string */ - function addScriptCode ($script) + public function addScriptCode($script) { $this->headerScript .= $script; } @@ -184,34 +182,33 @@ class headPublisher * @access public * @return string */ - function printHeader () + public function printHeader() { $jslabel = 'labels/en.js'; - if (defined( 'SYS_LANG' )) { + if (defined('SYS_LANG')) { $jslabel = 'labels' . PATH_SEP . SYS_LANG . '.js'; - if (! file_exists( PATH_CORE . 'js' . PATH_SEP . $jslabel )) { + if (!file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel)) { $jslabel = 'labels/en.js'; } } - if (file_exists( PATH_CORE . 'js' . PATH_SEP . $jslabel )) { - $this->addScriptFile( '/jscore/' . $jslabel, 1 ); + if (file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel)) { + $this->addScriptFile('/jscore/' . $jslabel, 1); } if ($this->disableHeaderScripts) { return ''; } // available js-calendar languages array - $availableJsCalendarLang = array ('ca','cn','cz','de','en','es','fr','it','jp','nl','pl','pt','ro','ru','sv' - ); + $availableJsCalendarLang = array('ca', 'cn', 'cz', 'de', 'en', 'es', 'fr', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv'); // get the system language without locale - $sysLang = explode( '-', SYS_LANG ); + $sysLang = explode('-', SYS_LANG); $sysLang = $sysLang[0]; // verify if the requested lang by the system is supported by js-calendar library, if not set english by default - $sysLang = in_array( $sysLang, $availableJsCalendarLang ) ? $sysLang : 'en'; + $sysLang = in_array($sysLang, $availableJsCalendarLang) ? $sysLang : 'en'; - $this->addScriptFile( "/js/widgets/js-calendar/unicode-letter.js" ); + $this->addScriptFile("/js/widgets/js-calendar/unicode-letter.js"); //$this->addScriptFile( "/js/widgets/js-calendar/lang/" . $sysLang . ".js" ); $head = ''; @@ -219,7 +216,7 @@ class headPublisher foreach ($this->scriptFiles as $file) { $head .= "\n"; } - if(!in_array( $this->translationsFile, $this->scriptFiles)) { + if (!in_array($this->translationsFile, $this->scriptFiles)) { $head .= "\n"; } @@ -245,12 +242,12 @@ class headPublisher * @access public * @return string */ - function printRawHeader () + public function printRawHeader() { $jslabel = '/jscore/labels/en.js'; - if (defined( 'SYS_LANG' )) { + if (defined('SYS_LANG')) { $jslabel1 = 'labels' . PATH_SEP . SYS_LANG . '.js'; - if (! file_exists( PATH_CORE . 'js' . PATH_SEP . $jslabel1 )) { + if (!file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel1)) { $jslabel = '/jscore/labels/en.js'; } } @@ -265,7 +262,7 @@ class headPublisher $head .= " eval(ajax_function('" . $file . "','',''));\n"; } //Adapts the add events on load to simple javascript sentences. - $this->headerScript = preg_replace( '/\s*leimnud.event.add\s*\(\s*window\s*,\s*(?:\'|")load(?:\'|")\s*,\s*function\(\)\{(.+)\}\s*\)\s*;?/', '$1', $this->headerScript ); + $this->headerScript = preg_replace('/\s*leimnud.event.add\s*\(\s*window\s*,\s*(?:\'|")load(?:\'|")\s*,\s*function\(\)\{(.+)\}\s*\)\s*;?/', '$1', $this->headerScript); $head .= $this->headerScript; //$head .= "\n"; return $head; @@ -279,10 +276,10 @@ class headPublisher * @access public * @return string */ - function clearScripts () + public function clearScripts() { - $this->scriptFiles = array (); - $this->leimnudLoad = array (); + $this->scriptFiles = array(); + $this->leimnudLoad = array(); $this->leimnudInitString = ''; $this->headerScript = ''; } @@ -298,14 +295,14 @@ class headPublisher * @access public * @return string */ - function includeExtJs () + public function includeExtJs() { $this->clearScripts(); $head = ''; $head .= " \n"; $head .= " \n"; - $aux = explode( '-', strtolower( SYS_LANG ) ); - if (($aux[0] != 'en') && file_exists( PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $aux[0] . '.js' )) { + $aux = explode('-', strtolower(SYS_LANG)); + if (($aux[0] != 'en') && file_exists(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $aux[0] . '.js')) { $head .= " \n"; } @@ -315,7 +312,7 @@ class headPublisher // $head .= " \n"; // $head .= " \n"; - if (! isset( $this->extJsSkin ) || $this->extJsSkin == '') { + if (!isset($this->extJsSkin) || $this->extJsSkin == '') { $this->extJsSkin = 'xtheme-gray'; //$this->extJsSkin = 'gtheme'; } @@ -323,34 +320,34 @@ class headPublisher $head .= $this->getExtJsScripts(); $head .= $this->getExtJsVariablesScript(); $oServerConf = & serverConf::getSingleton(); - if ($oServerConf->isRtl( SYS_LANG )) { + if ($oServerConf->isRtl(SYS_LANG)) { $head .= " \n"; } return $head; } - function getExtJsStylesheets ($skinName) + public function getExtJsStylesheets($skinName) { $script = " \n"; //$script .= " \n"; /* - $script .= " \n"; - $script .= " \n"; + $script .= " \n"; + $script .= " \n"; - // + } + //DEPRECATED, this will be removed in a future --> - //new interactive css decorator - $script .= " \n"; - $script .= " \n"; - */ + //new interactive css decorator + $script .= " \n"; + $script .= " \n"; + */ // Load external/plugin css // NOTE is necesary to move this to decorator server - if (class_exists( 'PMPluginRegistry' )) { + if (class_exists('PMPluginRegistry')) { $oPluginRegistry = & PMPluginRegistry::getSingleton(); $registeredCss = $oPluginRegistry->getRegisteredCss(); foreach ($registeredCss as $cssFile) { @@ -360,10 +357,10 @@ class headPublisher return $script; } - function getExtJsScripts () + public function getExtJsScripts() { $script = ''; - if (isset( $this->extJsScript ) && is_array( $this->extJsScript )) { + if (isset($this->extJsScript) && is_array($this->extJsScript)) { foreach ($this->extJsScript as $key => $file) { $script .= " \n"; } @@ -371,40 +368,40 @@ class headPublisher return $script; } - function getExtJsVariablesScript () + public function getExtJsVariablesScript() { $script = ''; - if (count( $this->extVariable ) > 0) { + if (count($this->extVariable) > 0) { $script = "\n"; } return $script; } - function getExtJsLibraries () + public function getExtJsLibraries() { $script = ''; - if (isset( $this->extJsLibrary ) && is_array( $this->extJsLibrary )) { + if (isset($this->extJsLibrary) && is_array($this->extJsLibrary)) { foreach ($this->extJsLibrary as $file) { $script .= " \n"; } } - if(!in_array( $this->translationsFile, $this->extJsLibrary)) { + if (!in_array($this->translationsFile, $this->extJsLibrary)) { $script .= " \n"; } return $script; @@ -418,12 +415,12 @@ class headPublisher * @param (String) http js path library * @return none */ - function usingExtJs ($library) + public function usingExtJs($library) { - if (! is_string( $library )) { - throw new Exception( 'headPublisher::usingExt->ERROR - the parameter should be a js path string' ); + if (!is_string($library)) { + throw new Exception('headPublisher::usingExt->ERROR - the parameter should be a js path string'); } - array_push( $this->extJsLibrary, $library ); + array_push($this->extJsLibrary, $library); } /** @@ -433,7 +430,7 @@ class headPublisher * @access public * @return string */ - function setExtSkin ($skin) + public function setExtSkin($skin) { $this->extJsSkin = $skin; } @@ -455,72 +452,72 @@ class headPublisher * @access public * @return string */ - function addExtJsScript ($filename, $debug = false, $isExternal = false) + public function addExtJsScript($filename, $debug = false, $isExternal = false) { $sPath = PATH_TPL; //if the template file doesn't exists, then try with the plugins folders - if (! is_file( $sPath . $filename . ".js" )) { - $aux = explode( PATH_SEP, $filename ); + if (!is_file($sPath . $filename . ".js")) { + $aux = explode(PATH_SEP, $filename); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment - if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) { + if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry = & PMPluginRegistry::getSingleton(); - if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) { + if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; } } } - if (! $isExternal) { + if (!$isExternal) { $jsFilename = $sPath . $filename . '.js'; } else { $jsFilename = $filename . '.js'; } - if (! file_exists( $jsFilename )) { + if (!file_exists($jsFilename)) { return; } - $mtime = filemtime( $jsFilename ); - G::mk_dir( PATH_C . 'ExtJs' ); + $mtime = filemtime($jsFilename); + G::mk_dir(PATH_C . 'ExtJs'); if ($debug) { - $cacheName = str_replace( '/', '_', $filename ); + $cacheName = str_replace('/', '_', $filename); $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js'; - file_put_contents( $cacheFilename, file_get_contents( $jsFilename ) ); + file_put_contents($cacheFilename, file_get_contents($jsFilename)); } else { - $cacheName = md5( $mtime . $jsFilename ); + $cacheName = md5($mtime . $jsFilename); $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js'; - if (! file_exists( $cacheFilename )) { + if (!file_exists($cacheFilename)) { require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php'); - $content = JSMin::minify( file_get_contents( $jsFilename ) ); - file_put_contents( $cacheFilename, $content ); + $content = JSMin::minify(file_get_contents($jsFilename)); + file_put_contents($cacheFilename, $content); } } $this->extJsScript[] = '/extjs/' . $cacheName; //hook for registered javascripts from plugins - if (class_exists( 'PMPluginRegistry' )) { + if (class_exists('PMPluginRegistry')) { $oPluginRegistry = & PMPluginRegistry::getSingleton(); - $pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy( $filename ); + $pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename); } else { - $pluginJavascripts = array (); + $pluginJavascripts = array(); } - if (count( $pluginJavascripts ) > 0) { + if (count($pluginJavascripts) > 0) { if ($debug) { foreach ($pluginJavascripts as $pluginJsFile) { $jsPluginCacheName = ''; - if (substr( $pluginJsFile, - 3 ) != '.js') { + if (substr($pluginJsFile, - 3) != '.js') { $pluginJsFile .= '.js'; } - if (file_exists( PATH_PLUGINS . $pluginJsFile )) { - $jsPluginCacheName = str_replace( '/', '_', str_replace( '.js', '', $pluginJsFile ) ); + if (file_exists(PATH_PLUGINS . $pluginJsFile)) { + $jsPluginCacheName = str_replace('/', '_', str_replace('.js', '', $pluginJsFile)); $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . ".js"; - file_put_contents( $cacheFilename, file_get_contents( PATH_PLUGINS . $pluginJsFile ) ); + file_put_contents($cacheFilename, file_get_contents(PATH_PLUGINS . $pluginJsFile)); } if ($jsPluginCacheName != '') { $this->extJsScript[] = '/extjs/' . $jsPluginCacheName; @@ -529,18 +526,18 @@ class headPublisher } else { foreach ($pluginJavascripts as $pluginJsFile) { $jsPluginCacheName = ''; - if (substr( $pluginJsFile, - 3 ) !== '.js') { + if (substr($pluginJsFile, - 3) !== '.js') { $pluginJsFile .= '.js'; } - if (file_exists( PATH_PLUGINS . $pluginJsFile )) { - $mtime = filemtime( PATH_PLUGINS . $pluginJsFile ); - $jsPluginCacheName = md5( $mtime . $pluginJsFile ); + if (file_exists(PATH_PLUGINS . $pluginJsFile)) { + $mtime = filemtime(PATH_PLUGINS . $pluginJsFile); + $jsPluginCacheName = md5($mtime . $pluginJsFile); $cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . '.js'; - if (! file_exists( $cacheFilename )) { + if (!file_exists($cacheFilename)) { require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php'); - $content = JSMin::minify( file_get_contents( PATH_PLUGINS . $pluginJsFile ) ); - file_put_contents( $cacheFilename, $content ); + $content = JSMin::minify(file_get_contents(PATH_PLUGINS . $pluginJsFile)); + file_put_contents($cacheFilename, $content); } } if ($jsPluginCacheName != '') { @@ -565,12 +562,12 @@ class headPublisher * @access public * @return string */ - function AddContent ($templateHtml) + public function AddContent($templateHtml) { $this->extJsContent[] = $templateHtml; } - function getContent () + public function getContent() { return $this->extJsContent; } @@ -584,18 +581,18 @@ class headPublisher * @access public * @return string */ - function Assign ($variable, $value) + public function Assign($variable, $value) { - $this->extVariable[] = array ('name' => $variable,'value' => $value,'type' => 'string' + $this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'string' ); } - function AssignVar ($name, $value) + public function AssignVar($name, $value) { $this->vars[$name] = $value; } - function getVars () + public function getVars() { return $this->vars; } @@ -609,10 +606,9 @@ class headPublisher * @access public * @return string */ - function AssignNumber ($variable, $value) + public function AssignNumber($variable, $value) { - $this->extVariable[] = array ('name' => $variable,'value' => $value,'type' => 'number' - ); + $this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'number'); } /** @@ -624,29 +620,29 @@ class headPublisher * @access public * @return string */ - function renderExtJs () + public function renderExtJs() { $body = ''; - if (isset( $this->extJsContent ) && is_array( $this->extJsContent )) { + if (isset($this->extJsContent) && is_array($this->extJsContent)) { foreach ($this->extJsContent as $key => $file) { $sPath = PATH_TPL; //if the template file doesn't exists, then try with the plugins folders - if (! is_file( $sPath . $file . ".html" )) { - $aux = explode( PATH_SEP, $file ); + if (!is_file($sPath . $file . ".html")) { + $aux = explode(PATH_SEP, $file); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment - if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) { + if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry = & PMPluginRegistry::getSingleton(); - if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) { + if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; } } } - $template = new TemplatePower( $sPath . $file . '.html' ); + $template = new TemplatePower($sPath . $file . '.html'); $template->prepare(); foreach ($this->getVars() as $k => $v) { - $template->assign( $k, $v ); + $template->assign($k, $v); } $body .= $template->getOutputContent(); @@ -655,24 +651,24 @@ class headPublisher return $body; } - function stripCodeQuotes ($sJson) + public function stripCodeQuotes($sJson) { - $fields = array ("editor","renderer" + $fields = array("editor", "renderer" ); foreach ($fields as $field) { $pattern = '/"(' . $field . ')":"[a-zA-Z.()]*"/'; // echo $pattern."
"; - preg_match( $pattern, $sJson, $matches ); + preg_match($pattern, $sJson, $matches); // var_dump ($matches); - // echo "
"; - if (! empty( $matches )) { + // echo "
"; + if (!empty($matches)) { $rendererMatch = $matches[0]; - $replaceBy = explode( ":", $matches[0] ); - $replaceBy[1] = str_replace( '"', '', $replaceBy[1] ); - $tmpString = implode( ":", $replaceBy ); - $sJson = str_replace( $rendererMatch, $tmpString, $sJson ); + $replaceBy = explode(":", $matches[0]); + $replaceBy[1] = str_replace('"', '', $replaceBy[1]); + $tmpString = implode(":", $replaceBy); + $sJson = str_replace($rendererMatch, $tmpString, $sJson); // var_dump ($sJson); - // echo "
"; + // echo "
"; } } return $sJson; @@ -687,9 +683,9 @@ class headPublisher * @access public * @return string */ - function disableHeaderScripts () + public function disableHeaderScripts() { $this->disableHeaderScripts = true; } } - + \ No newline at end of file diff --git a/gulliver/system/class.helper.php b/gulliver/system/class.helper.php index b61b2f157..93f2f6ae4 100755 --- a/gulliver/system/class.helper.php +++ b/gulliver/system/class.helper.php @@ -1,4 +1,5 @@ content = ''; - $this->gzipEnabled = true; - $this->minified = true; - $this->gzipModuleEnabled = false; - $this->contentType = 'text/html'; - } + public function __construct() + { + $this->content = ''; + $this->gzipEnabled = true; + $this->minified = true; + $this->gzipModuleEnabled = false; + $this->contentType = 'text/html'; + } - function addFile($file){ - if( is_file($file) ) - $this->content .= file_get_contents($file); - } + public function addFile($file) + { + if (is_file($file)) { + $this->content .= file_get_contents($file); + } + } - function addContent($content){ - $this->content = $content; - } + public function addContent($content) + { + $this->content = $content; + } - function setContentType($ctype){ - $this->contentType = $ctype; - } + public function setContentType($ctype) + { + $this->contentType = $ctype; + } - function init(){ - header("Content-type: {$this->contentType}"); - header('Pragma: cache'); - header('Cache-Control: public'); + public function init() + { + header("Content-type: {$this->contentType}"); + header('Pragma: cache'); + header('Cache-Control: public'); - if( $this->gzipEnabled && extension_loaded('zlib') ){ - $this->gzipModuleEnabled = true; - ob_start('ob_gzhandler'); - } else - ob_start(); - } + if ($this->gzipEnabled && extension_loaded('zlib')) { + $this->gzipModuleEnabled = true; + ob_start('ob_gzhandler'); + } else { + ob_start(); + } + } - function minify() { - if ($this->contentType != 'text/css') { - G::LoadThirdParty('jsmin', 'jsmin'); - $this->content = JSMin::minify($this->content); - } - } + public function minify() + { + if ($this->contentType != 'text/css') { + G::LoadThirdParty('jsmin', 'jsmin'); + $this->content = JSMin::minify($this->content); + } + } - function flush(){ - if( $this->minified ) - $this->minify(); - print($this->content); - ob_end_flush(); - } + public function flush() + { + if ($this->minified) { + $this->minify(); + } + print($this->content); + ob_end_flush(); + } - function serve($type=null){ - if( isset($type) ) - $this->setContentType($ctype); - $this->init(); - $this->flush(); - } + public function serve($type = null) + { + if (isset($type)) { + $this->setContentType($ctype); + } + $this->init(); + $this->flush(); + } } + /* function minify($buffer) { return G::removeComments($buffer); } -*/ \ No newline at end of file +*/ + \ No newline at end of file diff --git a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php index f4735cfc3..f9d053aff 100755 --- a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php +++ b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php @@ -23,7 +23,6 @@ * @icon /images/triggers/alfrescoIcon.png * @className class.pmTrAlfresco.pmFunctions.php */ - /** * @method * @@ -41,14 +40,16 @@ * */ G::LoadSystem('restClient'); + // Validation left -function cancelCheckout($alfrescoServerUrl, $docUid, $user="", $pwd="") { - //require_once(PATH_CORE. 'classes' . PATH_SEP.'triggers' . PATH_SEP . 'class.pmTrAlfresco.php'); -$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid"; -$domapi_exec = RestClient::delete($alfresco_url,$user,$pwd,"application/atom+xml;type=entry"); -//$alfrescoMessage = $domapi_exec['header']; -$domapi_res = G::json_decode($domapi_exec->getResponse()); -return $domapi_res; +function cancelCheckout($alfrescoServerUrl, $docUid, $user = "", $pwd = "") +{ + //require_once(PATH_CORE. 'classes' . PATH_SEP.'triggers' . PATH_SEP . 'class.pmTrAlfresco.php'); + $alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid"; + $domapi_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml;type=entry"); + //$alfrescoMessage = $domapi_exec['header']; + $domapi_res = G::json_decode($domapi_exec->getResponse()); + return $domapi_res; } /** @@ -69,22 +70,23 @@ return $domapi_res; * */ // Validation done -function checkIn($alfrescoServerUrl, $docUid, $comments, $user="", $pwd="") { -$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/i/$docUid?checkin=true&checkinComment=$comments"; -$xmlData = array(); -$xmlData = ''; +function checkIn($alfrescoServerUrl, $docUid, $comments, $user = "", $pwd = "") +{ + $alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/i/$docUid?checkin=true&checkinComment=$comments"; + $xmlData = array(); + $xmlData = ''; -$alfresco_exec = RestClient::put($alfresco_url,$xmlData,$user,$pwd,"application/atom+xml"); -$alfrescoMessage = $alfresco_exec->getResponseMessage(); -if($alfrescoMessage === 'OK' ) - return "The Document has been Checkedin"; -elseif ($alfrescoMessage === 'Internal Server Error') + $alfresco_exec = RestClient::put($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); + $alfrescoMessage = $alfresco_exec->getResponseMessage(); + if ($alfrescoMessage === 'OK') { + return "The Document has been Checkedin"; + } elseif ($alfrescoMessage === 'Internal Server Error') { return "Please enter a Valid Document Id"; -else -return $alfrescoMessage; + } else { + return $alfrescoMessage; + } } - /** * @method * @@ -102,19 +104,21 @@ return $alfrescoMessage; * */ // Validation done -function checkOut($alfrescoServerUrl, $docUid, $user="", $pwd="") { -$alfresco_url = "$alfrescoServerUrl/s/cmis/checkedout"; -$xmlData = array(); -$xmlData = ''.''.''.''.''.'workspace://SpacesStore/'.$docUid.''.''.''.''.''; +function checkOut($alfrescoServerUrl, $docUid, $user = "", $pwd = "") +{ + $alfresco_url = "$alfrescoServerUrl/s/cmis/checkedout"; + $xmlData = array(); + $xmlData = '' . '' . '' . '' . '' . 'workspace://SpacesStore/' . $docUid . '' . '' . '' . '' . ''; -$alfresco_exec = RestClient::post($alfresco_url,$xmlData,$user,$pwd,"application/atom+xml;type=entry"); -$alfrescoMessage = $alfresco_exec->getResponseMessage(); -if($alfrescoMessage === 'Created' ) - return "The Document has been Checkedout"; -elseif ($alfrescoMessage === 'Conflict') + $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml;type=entry"); + $alfrescoMessage = $alfresco_exec->getResponseMessage(); + if ($alfrescoMessage === 'Created') { + return "The Document has been Checkedout"; + } elseif ($alfrescoMessage === 'Conflict') { return "The Document you are trying to checkout has already been Checkedout"; -else -return $alfrescoMessage; + } else { + return $alfrescoMessage; + } } /** @@ -134,22 +138,23 @@ return $alfrescoMessage; * @return string | $result | Response * */ -function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd) { +function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd) +{ $name = explode("/", $folderName); - $init = substr($parentFolder,0,1); - $parentFolder = ($init == "/")? substr($parentFolder, 1)."/": $parentFolder."/"; - $alfresco_url = "$alfrescoServerUrl/s/cmis/p/".$parentFolder."children"; + $init = substr($parentFolder, 0, 1); + $parentFolder = ($init == "/") ? substr($parentFolder, 1) . "/" : $parentFolder . "/"; + $alfresco_url = "$alfrescoServerUrl/s/cmis/p/" . $parentFolder . "children"; $xmlData = array(); - $xmlData = ''.''.''.$name[0].''.''.''.'cmis:folder'.''.''.''; - $alfresco_exec = RestClient::post($alfresco_url,$xmlData,$user,$pwd,"application/atom+xml"); + $xmlData = '' . '' . '' . $name[0] . '' . '' . '' . 'cmis:folder' . '' . '' . ''; + $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); $alfrescoMessage = $alfresco_exec->getResponseMessage(); - $folderName = substr(strstr($folderName, "/"),1); - $parentFolder = $parentFolder."".$name[0]; + $folderName = substr(strstr($folderName, "/"), 1); + $parentFolder = $parentFolder . "" . $name[0]; if ($folderName != null) { createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd); } - if($alfrescoMessage === 'Created') { + if ($alfrescoMessage === 'Created') { return "The Folder has been Created"; } else { return $alfrescoMessage; @@ -172,9 +177,10 @@ function createFolder($alfrescoServerUrl, $parentFolder, $folderName, $user, $pw * @return string | $result | Response * */ -function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) { - $alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId"; - $alfresco_exec = RestClient::delete($alfresco_url,$user,$pwd,"application/atom+xml"); +function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) +{ + $alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId"; + $alfresco_exec = RestClient::delete($alfresco_url, $user, $pwd, "application/atom+xml"); $alfresco_res = G::json_decode($alfresco_exec->getResponse()); echo($alfresco_res); @@ -198,10 +204,11 @@ function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) { * @return string | $result | Response * */ -function downloadDoc($alfrescoServerUrl, $pathFile , $pathFolder, $user, $pwd) { +function downloadDoc($alfrescoServerUrl, $pathFile, $pathFolder, $user, $pwd) +{ if (!(G::verifyPath($pathFolder))) { G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $pathFolder)); - G::header('Location: '.$_SERVER['HTTP_REFERER']); + G::header('Location: ' . $_SERVER['HTTP_REFERER']); die; } @@ -209,22 +216,22 @@ function downloadDoc($alfrescoServerUrl, $pathFile , $pathFolder, $user, $pwd) { $nameFile = $dataPathFile['basename']; $alfresco_url = "$alfrescoServerUrl" . PATH_SEP . "s" . PATH_SEP . "cmis" . PATH_SEP . "p" . PATH_SEP . "Sites" . PATH_SEP . "$pathFile"; - $alfresco_exec = RestClient::get($alfresco_url,$user,$pwd,'application/atom+xml'); + $alfresco_exec = RestClient::get($alfresco_url, $user, $pwd, 'application/atom+xml'); $sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray); - $xmlObject = simplexml_load_string((string)$sXmlArray); + $xmlObject = simplexml_load_string((string) $sXmlArray); if (!isset($xmlObject->content)) { G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $nameFile . ' in Alfresco')); - G::header('Location: '.$_SERVER['HTTP_REFERER']); + G::header('Location: ' . $_SERVER['HTTP_REFERER']); die; } - $linkContent = (string)$xmlObject->content->attributes()->src; - $alfresco_exec = RestClient::get($linkContent,$user,$pwd,'application/atom+xml'); + $linkContent = (string) $xmlObject->content->attributes()->src; + $alfresco_exec = RestClient::get($linkContent, $user, $pwd, 'application/atom+xml'); $sXmlArray = $alfresco_exec->getResponse(); $content = eregi_replace("[\n|\r|\n\r]", '', $sXmlArray); - + if ('/' != substr($pathFolder, -1)) { $pathFolder .= '/'; } @@ -250,16 +257,17 @@ function downloadDoc($alfrescoServerUrl, $pathFile , $pathFolder, $user, $pwd) { * @return string | $result | Response * */ -function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) { - $getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout"; +function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) +{ + $getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout"; - $domapi_exec = RestClient::get($getChildrenUrl,$user,$pwd,'application/atom+xml'); - $sXmlArray = G::json_decode($domapi_exec->getResponse()); - $sXmlArray = trim($sXmlArray); - $xXmlArray = simplexml_load_string($sXmlArray); - $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1); + $domapi_exec = RestClient::get($getChildrenUrl, $user, $pwd, 'application/atom+xml'); + $sXmlArray = G::json_decode($domapi_exec->getResponse()); + $sXmlArray = trim($sXmlArray); + $xXmlArray = simplexml_load_string($sXmlArray); + $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); - return $alfresco_res; + return $alfresco_res; } /** @@ -278,13 +286,14 @@ function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) { * @return string | $result | Response * */ -function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) { +function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) +{ $getChildrenUrl = "$alfrescoServerUrl/service/api/node/workspace/SpacesStore/$folderId/children"; - $alfresco_exec = RestClient::get($getChildrenUrl,$user,$pwd); + $alfresco_exec = RestClient::get($getChildrenUrl, $user, $pwd); $sXmlArray = $alfresco_exec->getResponse(); $sXmlArray = trim($sXmlArray); $xXmlArray = simplexml_load_string($sXmlArray); - $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1); + $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); return $aXmlArray; } @@ -309,18 +318,18 @@ function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) { * @return string | $result | Response * */ -function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '') { - if (!(file_exists($fileSource))) - { +function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docType, $user, $pwd, $path = '') +{ + if (!(file_exists($fileSource))) { G::SendTemporalMessage('ID_FILE_PLUGIN_NOT_EXISTS', 'error', 'labels', null, null, array('pluginFile' => $fileSource)); - G::header('Location: '.$_SERVER['HTTP_REFERER']); + G::header('Location: ' . $_SERVER['HTTP_REFERER']); die; } - $filep = fopen($fileSource,"r"); - $fileLength = filesize($fileSource); - $fileContent = fread($filep,$fileLength); - $fileContent = base64_encode($fileContent); - + $filep = fopen($fileSource, "r"); + $fileLength = filesize($fileSource); + $fileContent = fread($filep, $fileLength); + $fileContent = base64_encode($fileContent); + if ($path != '') { createFolder($alfrescoServerUrl, 'Sites', $path, $user, $pwd); $path = $path . PATH_SEP; @@ -328,13 +337,14 @@ function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docTy $alfresco_url = "$alfrescoServerUrl/s/cmis/p/Sites/" . $path . "children"; $xmlData = array(); - $xmlData = ''.$title.''.$description.''.$fileContent.'cmis:document'; + $xmlData = '' . $title . '' . $description . '' . $fileContent . 'cmis:document'; - $alfresco_exec = RestClient::post($alfresco_url,$xmlData,$user,$pwd,"application/atom+xml"); - $sXmlArray = $alfresco_exec->getResponse(); - $sXmlArray = trim($sXmlArray); - $xXmlArray = simplexml_load_string($sXmlArray); - $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1); + $alfresco_exec = RestClient::post($alfresco_url, $xmlData, $user, $pwd, "application/atom+xml"); + $sXmlArray = $alfresco_exec->getResponse(); + $sXmlArray = trim($sXmlArray); + $xXmlArray = simplexml_load_string($sXmlArray); + $aXmlArray = @G::json_decode(@G::json_encode($xXmlArray), 1); return $aXmlArray; -} \ No newline at end of file +} + \ No newline at end of file diff --git a/workflow/engine/methods/appFolder/appFolderSaveDocument.php b/workflow/engine/methods/appFolder/appFolderSaveDocument.php index 4c07ecc4b..32984d8c1 100755 --- a/workflow/engine/methods/appFolder/appFolderSaveDocument.php +++ b/workflow/engine/methods/appFolder/appFolderSaveDocument.php @@ -1,4 +1,5 @@ load($_GET['UID']); - }else{ - $oFolder=new AppFolder(); - $folderStructure=$oFolder->getFolderStructure(isset($_GET['folderId'])?$_GET['folderId']:"/"); - $aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']); + if ($_GET['UID'] != -1) { + $aID = $oInputDocument->load($_GET['UID']); + } else { + $oFolder = new AppFolder(); + $folderStructure = $oFolder->getFolderStructure(isset($_GET['folderId']) ? $_GET['folderId'] : "/"); + $aID = array('INP_DOC_DESTINATION_PATH' => $folderStructure['PATH']); } - - + + $oAppDocument = new AppDocument(); - - - //Get the Custom Folder ID (create if necessary) - $oFolder=new AppFolder(); - if($_GET['UID']!=-1){ - //krumo("jhl"); - $folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'],$appId); - //Tags - $fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'],$appId); - }else{ - $folderId=isset($_GET['folderId'])?$_GET['folderId']:"/"; - $fileTags="EXTERNAL"; + + + //Get the Custom Folder ID (create if necessary) + $oFolder = new AppFolder(); + if ($_GET['UID'] != -1) { + //krumo("jhl"); + $folderId = $oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId); + //Tags + $fileTags = $oFolder->parseTags($aID['INP_DOC_TAGS'], $appId); + } else { + $folderId = isset($_GET['folderId']) ? $_GET['folderId'] : "/"; + $fileTags = "EXTERNAL"; } - switch($actionType){ - case "R": //replace - $aFields = array('APP_DOC_UID' => $appDocUid, - 'APP_UID' => $appId, - 'DOC_VERSION' => $docVersion, - 'DEL_INDEX' => 1, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); + switch ($actionType) { + case "R": //replace + $aFields = array('APP_DOC_UID' => $appDocUid, + 'APP_UID' => $appId, + 'DOC_VERSION' => $docVersion, + 'DEL_INDEX' => 1, + 'USR_UID' => $_SESSION['USER_LOGGED'], + 'DOC_UID' => $docUid, + 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], + 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), + 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', + 'APP_DOC_TITLE' => '', + 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', + 'FOLDER_UID' => $folderId, + 'APP_DOC_TAGS' => $fileTags); $oAppDocument->update($aFields); - break; + break; case "NV": //New Version - - - $aFields = array('APP_DOC_UID' => $appDocUid, - 'APP_UID' => $appId, - - 'DEL_INDEX' => 1, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); + + $aFields = array('APP_DOC_UID' => $appDocUid, + 'APP_UID' => $appId, + 'DEL_INDEX' => 1, + 'USR_UID' => $_SESSION['USER_LOGGED'], + 'DOC_UID' => $docUid, + 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], + 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), + 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', + 'APP_DOC_TITLE' => '', + 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', + 'FOLDER_UID' => $folderId, + 'APP_DOC_TAGS' => $fileTags); $oAppDocument->create($aFields); - break; - default: //New - $aFields = array('APP_UID' => $appId, - 'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1, - 'USR_UID' => $_SESSION['USER_LOGGED'], - 'DOC_UID' => $docUid, - 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], - 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), - 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', - 'APP_DOC_TITLE' => '', - 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', - 'FOLDER_UID' => $folderId, - 'APP_DOC_TAGS' => $fileTags); - + break; + default: //New + $aFields = array('APP_UID' => $appId, + 'DEL_INDEX' => isset($_SESSION['INDEX']) ? $_SESSION['INDEX'] : 1, + 'USR_UID' => $_SESSION['USER_LOGGED'], + 'DOC_UID' => $docUid, + 'APP_DOC_TYPE' => $_POST['form']['APP_DOC_TYPE'], + 'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'), + 'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ? $_POST['form']['APP_DOC_COMMENT'] : '', + 'APP_DOC_TITLE' => '', + 'APP_DOC_FILENAME' => isset($_FILES['form']['name']['APP_DOC_FILENAME']) ? $_FILES['form']['name']['APP_DOC_FILENAME'] : '', + 'FOLDER_UID' => $folderId, + 'APP_DOC_TAGS' => $fileTags); $oAppDocument->create($aFields); - break; + break; } - $sAppDocUid = $oAppDocument->getAppDocUid(); $iDocVersion = $oAppDocument->getDocVersion(); - $info = pathinfo( $oAppDocument->getAppDocFilename() ); + $info = pathinfo($oAppDocument->getAppDocFilename()); $ext = (isset($info['extension']) ? $info['extension'] : ''); //save the file - if (!empty($_FILES['form'])) { - if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { - $sPathName = PATH_DOCUMENT . $appId . PATH_SEP; - $sFileName = $sAppDocUid . "_".$iDocVersion. '.' . $ext; - G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName ); + if (!empty($_FILES['form'])) { + if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) { + $sPathName = PATH_DOCUMENT . $appId . PATH_SEP; + $sFileName = $sAppDocUid . "_" . $iDocVersion . '.' . $ext; + G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName); - //Plugin Hook PM_UPLOAD_DOCUMENT for upload document - $oPluginRegistry =& PMPluginRegistry::getSingleton(); - if ( $oPluginRegistry->existsTrigger ( PM_UPLOAD_DOCUMENT ) && class_exists ('uploadDocumentData' ) ) { - - $oData['APP_UID'] = $appId; - $documentData = new uploadDocumentData ( - $appId, - $_SESSION['USER_LOGGED'], - $sPathName . $sFileName, - $aFields['APP_DOC_FILENAME'], - $sAppDocUid - ); + //Plugin Hook PM_UPLOAD_DOCUMENT for upload document + $oPluginRegistry = & PMPluginRegistry::getSingleton(); + if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) { - $oPluginRegistry->executeTriggers ( PM_UPLOAD_DOCUMENT , $documentData ); - unlink ( $sPathName . $sFileName ); + $oData['APP_UID'] = $appId; + $documentData = new uploadDocumentData( + $appId, + $_SESSION['USER_LOGGED'], + $sPathName . $sFileName, + $aFields['APP_DOC_FILENAME'], + $sAppDocUid + ); + + $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData); + unlink($sPathName . $sFileName); + } + //end plugin } - //end plugin - } } - - - G::header('location: appFolderList'); - die; - - - } catch ( Exception $e ) { + G::header('location: appFolderList'); + die; +} catch (Exception $e) { /* Render Error page */ - $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish' ); - } \ No newline at end of file + $aMessage['MESSAGE'] = $e->getMessage(); + $G_PUBLISH = new Publisher; + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); + G::RenderPage('publish'); +} + \ No newline at end of file