diff --git a/workflow/engine/classes/class.dashletProcessMakerCommunity.php b/workflow/engine/classes/class.dashletProcessMakerCommunity.php index 0c01c9898..bf19fd9e9 100644 --- a/workflow/engine/classes/class.dashletProcessMakerCommunity.php +++ b/workflow/engine/classes/class.dashletProcessMakerCommunity.php @@ -2,26 +2,31 @@ require_once 'classes/interfaces/dashletInterface.php'; -class dashletProcessMakerCommunity implements DashletInterface { +class dashletProcessMakerCommunity implements DashletInterface +{ - const version = '1.0'; + const version = '1.0'; - public static function getAdditionalFields($className) { - $additionalFields = array(); + public static function getAdditionalFields ($className) + { + $additionalFields = array (); - return $additionalFields; - } + return $additionalFields; + } - public static function getXTemplate($className) { - return ""; - } + public static function getXTemplate ($className) + { + return ""; + } - public function setup($config) { - return true; - } + public function setup ($config) + { + return true; + } - public function render ($width = 300) { - $html = " + public function render ($width = 300) + { + $html = " @@ -139,7 +144,7 @@ class dashletProcessMakerCommunity implements DashletInterface { "; - echo $html; - } + echo $html; + } } \ No newline at end of file diff --git a/workflow/engine/classes/class.dashletProcessMakerEnterprise.php b/workflow/engine/classes/class.dashletProcessMakerEnterprise.php index 6aa9b5f27..edc7347f2 100644 --- a/workflow/engine/classes/class.dashletProcessMakerEnterprise.php +++ b/workflow/engine/classes/class.dashletProcessMakerEnterprise.php @@ -2,26 +2,31 @@ require_once 'classes/interfaces/dashletInterface.php'; -class dashletProcessMakerEnterprise implements DashletInterface { +class dashletProcessMakerEnterprise implements DashletInterface +{ - const version = '1.0'; + const version = '1.0'; - public static function getAdditionalFields($className) { - $additionalFields = array(); + public static function getAdditionalFields ($className) + { + $additionalFields = array (); - return $additionalFields; - } + return $additionalFields; + } - public static function getXTemplate($className) { - return ""; - } + public static function getXTemplate ($className) + { + return ""; + } - public function setup($config) { - return true; - } + public function setup ($config) + { + return true; + } - public function render ($width = 300) { - $html = " + public function render ($width = 300) + { + $html = " @@ -247,7 +252,7 @@ class dashletProcessMakerEnterprise implements DashletInterface { "; - echo $html; - } + echo $html; + } } \ No newline at end of file diff --git a/workflow/engine/classes/class.dashletRssReader.php b/workflow/engine/classes/class.dashletRssReader.php index 28d5fea61..4e3d6e9ed 100644 --- a/workflow/engine/classes/class.dashletRssReader.php +++ b/workflow/engine/classes/class.dashletRssReader.php @@ -2,107 +2,111 @@ require_once 'classes/interfaces/dashletInterface.php'; -class dashletRssReader implements DashletInterface { +class dashletRssReader implements DashletInterface +{ - const version = '1.0'; + const version = '1.0'; - public static function getAdditionalFields($className) { - $additionalFields = array(); - - $urlFrom = new stdclass(); - $urlFrom->xtype = 'textfield'; - $urlFrom->name = 'DAS_URL'; - $urlFrom->fieldLabel = 'Url'; - $urlFrom->width = 320; - $urlFrom->maxLength = 200; - $urlFrom->allowBlank = false; - $urlFrom->value = "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP"; - $additionalFields[] = $urlFrom; - - return $additionalFields; - } - - public static function getXTemplate($className) { - return ""; - } - - public function setup($config) { - $this->urlFrom = isset($config['DAS_URL']) ? $config['DAS_URL'] : "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP"; - return true; - } - - public function render ($width = 300) { - $pCurl = curl_init(); - curl_setopt($pCurl, CURLOPT_URL, $this->urlFrom); - curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($pCurl, CURLOPT_AUTOREFERER, true); - //To avoid SSL error - curl_setopt($pCurl, CURLOPT_SSL_VERIFYHOST, 0); - curl_setopt($pCurl, CURLOPT_SSL_VERIFYPEER, 0); - - //To avoid timeouts - curl_setopt($pCurl, CURLOPT_CONNECTTIMEOUT, 10); - curl_setopt($pCurl, CURLOPT_TIMEOUT, 20); - - curl_setopt($pCurl, CURLOPT_NOPROGRESS, false); - curl_setopt($pCurl, CURLOPT_VERBOSE, true); - - //Apply proxy settings - $sysConf = System::getSystemConfiguration(); - if ($sysConf['proxy_host'] != '') { - curl_setopt($pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '')); - if ($sysConf['proxy_port'] != '') { - curl_setopt($pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port']); - } - if ($sysConf['proxy_user'] != '') { - curl_setopt($pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '')); - } - curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:')); - } - - $self->rss = @simplexml_load_string(curl_exec($pCurl)); - if($self->rss) + public static function getAdditionalFields ($className) { - $index= 0; - $render = ''; - $self->items = $self->rss->channel->item; - if (count($self->rss->channel)!= 0) { - $status = 'true'; - foreach($self->items as $self->item) - { - $self->title = $self->item->title; - $self->link = $self->item->link; + $additionalFields = array (); - $self->des = $self->item->description; - $render[] = array('link' => ''.$self->title.'
','description' => $self->des.'

'); - $index++; + $urlFrom = new stdclass(); + $urlFrom->xtype = 'textfield'; + $urlFrom->name = 'DAS_URL'; + $urlFrom->fieldLabel = 'Url'; + $urlFrom->width = 320; + $urlFrom->maxLength = 200; + $urlFrom->allowBlank = false; + $urlFrom->value = "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP"; + $additionalFields[] = $urlFrom; + + return $additionalFields; + } + + public static function getXTemplate ($className) + { + return ""; + } + + public function setup ($config) + { + $this->urlFrom = isset( $config['DAS_URL'] ) ? $config['DAS_URL'] : "http://license.processmaker.com/syspmLicenseSrv/en/green/services/rssAP"; + return true; + } + + public function render ($width = 300) + { + $pCurl = curl_init(); + curl_setopt( $pCurl, CURLOPT_URL, $this->urlFrom ); + curl_setopt( $pCurl, CURLOPT_RETURNTRANSFER, true ); + curl_setopt( $pCurl, CURLOPT_FOLLOWLOCATION, false ); + curl_setopt( $pCurl, CURLOPT_AUTOREFERER, true ); + //To avoid SSL error + curl_setopt( $pCurl, CURLOPT_SSL_VERIFYHOST, 0 ); + curl_setopt( $pCurl, CURLOPT_SSL_VERIFYPEER, 0 ); + + //To avoid timeouts + curl_setopt( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 ); + curl_setopt( $pCurl, CURLOPT_TIMEOUT, 20 ); + + curl_setopt( $pCurl, CURLOPT_NOPROGRESS, false ); + curl_setopt( $pCurl, CURLOPT_VERBOSE, true ); + + //Apply proxy settings + $sysConf = System::getSystemConfiguration(); + if ($sysConf['proxy_host'] != '') { + curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') ); + if ($sysConf['proxy_port'] != '') { + curl_setopt( $pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port'] ); + } + if ($sysConf['proxy_user'] != '') { + curl_setopt( $pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') ); + } + curl_setopt( $pCurl, CURLOPT_HTTPHEADER, array ('Expect:' + ) ); } - } - else { - $status = 'Error'; - $render[] =array('link' => 'Error', 'description' =>"Unable to parse XML"); - } - } - else { - $status = 'Error'; - $render[] =array('link' => 'Error', 'description' =>"Unable to parse XML"); - } - G::verifyPath ( PATH_SMARTY_C, true ); - $smarty = new Smarty(); - $smarty->template_dir = PATH_CORE.'templates/dashboard/'; - $smarty->compile_dir = PATH_SMARTY_C; - try { - $smarty->assign('url', $this->urlFrom); - $smarty->assign('render', $render); - $smarty->assign('status', $status); - } - catch (Exception $ex) { - print $item->key; - } - $smarty->display('dashletRssReaderTemplate.html',null,null); + $self->rss = @simplexml_load_string( curl_exec( $pCurl ) ); + if ($self->rss) { + $index = 0; + $render = ''; + $self->items = $self->rss->channel->item; + if (count( $self->rss->channel ) != 0) { + $status = 'true'; + foreach ($self->items as $self->item) { + $self->title = $self->item->title; + $self->link = $self->item->link; - } + $self->des = $self->item->description; + $render[] = array ('link' => '' . $self->title . '
','description' => $self->des . '

' + ); + $index ++; + } + } else { + $status = 'Error'; + $render[] = array ('link' => 'Error','description' => "Unable to parse XML" + ); + } + } else { + $status = 'Error'; + $render[] = array ('link' => 'Error','description' => "Unable to parse XML" + ); + } + G::verifyPath( PATH_SMARTY_C, true ); + $smarty = new Smarty(); + $smarty->template_dir = PATH_CORE . 'templates/dashboard/'; + $smarty->compile_dir = PATH_SMARTY_C; + + try { + $smarty->assign( 'url', $this->urlFrom ); + $smarty->assign( 'render', $render ); + $smarty->assign( 'status', $status ); + } catch (Exception $ex) { + print $item->key; + } + $smarty->display( 'dashletRssReaderTemplate.html', null, null ); + + } } \ No newline at end of file