function postFullSpot($user, $serverPrivKey, $newsgroup, $spot) { # instantiate the necessary objects $spotSigning = new SpotSigning(); /* * Create the spotnet from header part accrdoing to the following structure: * From: [Nickname] <[USER PUBLIC KEY]@[CAT][KEY-ID][SUBCAT].[SIZE].[RANDOM].[DATE].[CUSTOM-ID].[CUSTOM-VALUE].[SIGNATURE]> */ $spotHeader = $spot['category'] + 1 . $spot['key']; // Append the category and keyid # Process each subcategory and add them to the from header foreach ($spot['subcatlist'] as $subcat) { $spotHeader .= $subcat[0] . str_pad(substr($subcat, 1), 2, '0', STR_PAD_LEFT); } # foreach $spotHeader .= '.' . $spot['filesize']; $spotHeader .= '.' . 10; // some kind of magic number? $spotHeader .= '.' . time(); $spotHeader .= '.' . $spotSigning->makeRandomStr(4); $spotHeader .= '.' . $spotSigning->makeRandomStr(3); # If a tag is given, add it to the subject if (strlen(trim($spot['tag'])) > 0) { $spot['title'] = $spot['title'] . ' | ' . $spot['tag']; } # if # sign the header by using the users' key $header_signature = $spotSigning->signMessage($user['privatekey'], $spot['title'] . $spotHeader . $spot['poster']); # sign the XML with the users' key $xml_signature = $spotSigning->signMessage($user['privatekey'], $spot['spotxml']); # Extract the users' publickey $userPubKey = $spotSigning->getPublicKey($user['privatekey']); # Create the From header $spotnetFrom = $user['username'] . ' <' . $this->_spotParser->specialString($userPubKey['publickey']['modulo']) . '@'; $header = 'From: ' . $spotnetFrom . $spotHeader . '.' . $this->_spotParser->specialString($header_signature['signature']) . ">\r\n"; # Add the Spotnet XML file, but split it in chunks of 900 characters $tmpXml = explode("\r\n", chunk_split($spot['spotxml'], 900)); foreach ($tmpXml as $xmlChunk) { if (strlen(trim($xmlChunk)) > 0) { $header .= 'X-XML: ' . $xmlChunk . "\r\n"; } # if } # foreach $header .= 'X-XML-Signature: ' . $this->_spotParser->specialString($xml_signature['signature']) . "\r\n"; # post the message return $this->postSignedMessage($user, $serverPrivKey, $newsgroup, $spot, $header); }