Exemple #1
0
 /**
  * processes SOAP message returned from server
  *
  * @param	array	$headers	The HTTP headers
  * @param	string	$data		unprocessed response data from server
  * @return	mixed	value of the message, decoded into a PHP type
  * @access   private
  */
 function parseResponse($headers, $data)
 {
     $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
     $this->responseAttachments = array();
     if (strstr($headers['content-type'], 'multipart/related')) {
         $this->debug('Decode multipart/related');
         $input = '';
         foreach ($headers as $k => $v) {
             $input .= "{$k}: {$v}\r\n";
         }
         $params['input'] = $input . "\r\n" . $data;
         $params['include_bodies'] = true;
         $params['decode_bodies'] = true;
         $params['decode_headers'] = true;
         $structure = Mail_mimeDecode::decode($params);
         foreach ($structure->parts as $part) {
             if (!isset($part->disposition)) {
                 $this->debug('Have root part of type ' . $part->headers['content-type']);
                 $return = parent::parseResponse($part->headers, $part->body);
             } else {
                 $this->debug('Have an attachment of type ' . $part->headers['content-type']);
                 $info['data'] = $part->body;
                 $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
                 $info['contenttype'] = $part->headers['content-type'];
                 $info['cid'] = $part->headers['content-id'];
                 $this->responseAttachments[] = $info;
             }
         }
         if (isset($return)) {
             return $return;
         }
         $this->setError('No root part found in multipart/related content');
         return;
     }
     $this->debug('Not multipart/related');
     return parent::parseResponse($headers, $data);
 }
 function _GetRepositoryModules($prefix = '', $newest = 1)
 {
     global $CMS_VERSION;
     $url = $this->GetPreference('module_repository');
     if ($url == '') {
         return array(false, $this->Lang('error_norepositoryurl'));
     }
     $nusoap =& $this->GetModuleInstance('nuSOAP');
     $nusoap->Load();
     $nu_soapclient = new nu_soapclient($url, false, false, false, false, false, 90, 90);
     if ($err = $nu_soapclient->GetError()) {
         return array(false, $this->Lang('error_nosoapconnect'));
     }
     $allmoduledetails = array();
     $repversion = $nu_soapclient->call('ModuleRepository.soap_version');
     if ($err = $nu_soapclient->GetError()) {
         return array(false, $this->Lang('error_soaperror') . ' (' . $url . '): ' . $err);
     }
     if (version_compare($repversion, MINIMUM_REPOSITORY_VERSION) < 0) {
         return array(false, $this->Lang('error_minimumrepository'));
     }
     $qparms = array();
     if (!empty($prefix)) {
         $qparms['prefix'] = $prefix;
     }
     $qparms['newest'] = $newest;
     $qparms['clientcmsversion'] = $CMS_VERSION;
     $allmoduledetails = $nu_soapclient->call('ModuleRepository.soap_moduledetailsgetall', $qparms);
     if ($err = $nu_soapclient->GetError()) {
         return array(false, $this->Lang('error_soaperror') . ' (' . $url . '): ' . $err);
     }
     //     if( !is_array( $allmoduledetails ) || count( $allmoduledetails ) == 0 )
     //        {
     //  	return array(false,$this->Lang('error_connectnomodules').' ('.$url.'): '.$err);
     //        }
     return array(true, $allmoduledetails);
 }
if (FALSE == can_admin_upload()) {
    echo '<div class="pageerrorcontainer"><div class="pageoverflow"><p class="pageerror">' . $this->Lang('error_permissions') . '</p></div></div>';
    $caninstall = false;
}
$modules = array_keys($gCms->modules);
if (!count($modules)) {
    $smarty->assign('nvmessage', $this->Lang('error_nomodules'));
} else {
    $url = $this->GetPreference('module_repository');
    if ($url == '') {
        $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_norepositoryurl'));
        return;
    }
    $nusoap =& $this->GetModuleInstance('nuSOAP');
    $nusoap->Load();
    $nu_soapclient = new nu_soapclient($url, false, false, false, false, false, 90, 90);
    if ($err = $nu_soapclient->GetError()) {
        $this->_DisplayErrorPage($id, $params, $returnid, 'SOAP Error: ' . $err);
        return;
    }
    $repversion = $nu_soapclient->call('ModuleRepository.soap_version');
    if ($err = $nu_soapclient->GetError()) {
        $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_soaperror') . ' (' . $url . '): ' . $err);
        return;
    }
    if (version_compare($repversion, MINIMUM_REPOSITORY_VERSION) < 0) {
        $this->_DisplayErrorPage($id, $params, $returnid, $this->Lang('error_minimumrepository'));
        return;
    }
    $qparms['names'] = implode(',', $modules);
    $qparms['newest'] = '1';