b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: htsrv ] [ index: htsrv ] [ all elements ]

Source for file mms.php

Documentation is available at mms.php

  1. <?php
  2. /**
  3.  * MMS Server - injecting mms messages from a mobile phone into a blog
  4.  *
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  *
  7.  * This file built upon code from original Peffisaur -
  8.  * Stefan Hellkvist - {@link http://hellkvist.org}
  9.  *
  10.  * Released under GNU GPL License - http://b2evolution.net/about/license.html
  11.  *
  12.  * @copyright (c)2004 by Hans Reinders - {@link http://hansreinders.com}
  13.  *
  14.  * @package htsrv
  15.  * @todo MOVE THIS FILE TO /htsrv
  16.  */
  17.  
  18. /**
  19.  * Initalize:
  20.  */
  21. require_oncedirname(__FILE__).'/b2evocore/_main.php' );
  22.  
  23. param'login''string'''true );
  24. param'pass''string'''true );
  25. param'cat''integer'$default_categorytrue );
  26.  
  27. if!user_pass_ok$login$passfalse || $_SERVER['CONTENT_TYPE'!= "application/vnd.wap.mms-message" || strlen$HTTP_RAW_POST_DATA == exit;
  28.  
  29. $current_User new Userget_userdatabylogin$login ) );
  30. $post_category $cat;
  31. $blog get_catblog($post_category)
  32.  
  33. // Check permission:
  34. $current_User->check_perm'blog_post_statuses''published'true$blog );
  35.  
  36.  
  37. define"BCC",             0x01 );
  38. define"CC",             0x02 );
  39. define"CONTENT_LOCATION",     0x03 );
  40. define"CONTENT_TYPE",     0x04 );
  41. define"DATE",         0x05 );
  42. define"DELIVERY_REPORT",     0x06 );
  43. define"DELIVERY_TIME",     0x07 );
  44. define"EXPIRY",         0x08 );
  45. define"FROM",         0x09 );
  46. define"MESSAGE_CLASS",    0x0A );
  47. define"MESSAGE_ID",         0x0B );
  48. define"MESSAGE_TYPE",     0x0C );
  49. define"MMS_VERSION",         0x0D );
  50. define"MESSAGE_SIZE",     0x0E );
  51. define"PRIORITY",         0x0F );
  52. define"READ_REPLY",         0x10 );
  53. define"REPORT_ALLOWED",     0x11 );
  54. define"RESPONSE_STATUS",     0x12 );
  55. define"RESPONSE_TEXT",     0x13 );
  56. define"SENDER_VISIBILITY",     0x14 );
  57. define"STATUS",         0x15 );
  58. define"SUBJECT",         0x16 );
  59. define"TO",             0x17 );
  60. define"TRANSACTION_ID",     0x18 );
  61. define"IMAGE_GIF",         0x1D );
  62. define"IMAGE_JPEG",         0x1E );
  63. define"IMAGE_PNG",         0x20 );
  64. define"IMAGE_WBMP",         0x21 );
  65. define"TEXT_PLAIN",         0x03 );
  66. define"MULTIPART_MIXED",     0x23 );
  67. define"MULTIPART_RELATED",      0x33 );
  68.  
  69. $content_types array"*/*""text/*""text/html""text/plain",
  70.               "text/x-hdml""text/x-ttml""text/x-vCalendar",
  71.             "text/x-vCard""text/vnd.wap.wml"
  72.             "text/vnd.wap.wmlscript""text/vnd.wap.wta-event",
  73.             "multipart/*""multipart/mixed"
  74.             "multipart/form-data""multipart/byterantes",
  75.             "multipart/alternative""application/*",
  76.             "application/java-vm"
  77.             "application/x-www-form-urlencoded",
  78.             "application/x-hdmlc""application/vnd.wap.wmlc",
  79.             "application/vnd.wap.wmlscriptc"
  80.             "application/vnd.wap.wta-eventc"
  81.             "application/vnd.wap.uaprof"
  82.             "application/vnd.wap.wtls-ca-certificate",
  83.             "application/vnd.wap.wtls-user-certificate",
  84.             "application/x-x509-ca-cert"
  85.             "application/x-x509-user-cert"
  86.             "image/*""image/gif""image/jpeg""image/tiff",
  87.             "image/png""image/vnd.wap.wbmp"
  88.             "application/vnd.wap.multipart.*"
  89.             "application/vnd.wap.multipart.mixed"
  90.             "application/vnd.wap.multipart.form-data"
  91.             "application/vnd.wap.multipart.byteranges"
  92.             "application/vnd.wap.multipart.alternative"
  93.             "application/xml""text/xml"
  94.             "application/vnd.wap.wbxml"
  95.             "application/x-x968-cross-cert"
  96.             "application/x-x968-ca-cert"
  97.             "application/x-x968-user-cert"
  98.             "text/vnd.wap.si"
  99.             "application/vnd.wap.sic"
  100.             "text/vnd.wap.sl"
  101.             "application/vnd.wap.slc"
  102.             "text/vnd.wap.co"
  103.             "application/vnd.wap.coc"
  104.             "application/vnd.wap.multipart.related"
  105.             "application/vnd.wap.sia"
  106.             "text/vnd.wap.connectivity-xml"
  107.             "application/vnd.wap.connectivity-wbxml"
  108.             "application/pkcs7-mime"
  109.             "application/vnd.wap.hashed-certificate"
  110.             "application/vnd.wap.signed-certificate"
  111.             "application/vnd.wap.cert-response",
  112.             "application/xhtml+xml",
  113.             "application/wml+xml",
  114.             "text/css"
  115.             "application/vnd.wap.mms-message"
  116.             "application/vnd.wap.rollover-certificate"
  117.             "application/vnd.wap.locc+wbxml"
  118.             "application/vnd.wap.loc+xml"
  119.             "application/vnd.syncml.dm+wbxml"
  120.             "application/vnd.syncml.dm+xml"
  121.             "application/vnd.syncml.notification"
  122.             "application/vnd.wap.xhtml+xml"
  123.             "application/vnd.wv.csp.cir"
  124.             "application/vnd.oma.dd+xml"
  125.             "application/vnd.oma.drm.message"
  126.             "application/vnd.oma.drm.content"
  127.             "application/vnd.oma.drm.rights+xml",
  128.             "application/vnd.oma.drm.rights+wbxml" );
  129.  
  130. $typeToExtension arrayIMAGE_GIF =>        ".gif",
  131.               IMAGE_JPEG =>         ".jpg",     
  132.               IMAGE_PNG =>          ".png",
  133.               IMAGE_WBMP =>         ".wbmp",
  134.               TEXT_PLAIN =>        ".txt",
  135.               "application/smil" => ".smil",
  136.               "audio/amr" =>       ".amr",
  137.               "x-music/x-midi" =>    ".mid",
  138.               "audio/midi" =>    ".mid",
  139.               "audio/x-wav" =>      ".wav",
  140.               "video/mpeg" =>    ".mpg",
  141.               "video/avi" =>    ".avi",
  142.               "video/mpeg4" =>    ".mp4",
  143.               "application/zip" =>    ".zip",
  144.               "text/x-imelody" =>     ".imy" );
  145.  
  146. function calcSize$md )
  147. {
  148.     $size 0;
  149.     $parts $md->parts;
  150.     for $i 0$i sizeof$parts )$i++ )
  151.     {
  152.         $p $parts[$i];
  153.         $size $size+$p->dataLen;
  154.     }
  155.     return $size;
  156. }
  157.  
  158. function contentTypeToString$contentType )
  159. {
  160.     global $content_types;
  161.     if is_string$contentType ) ) return $contentType;
  162.     return $content_types[$contentType];
  163. }
  164.  
  165. function extractText$md )
  166. {
  167.     $parts $md->parts;
  168.     for $i 0$i sizeof$parts )$i++ )
  169.     {
  170.         $p=$parts[$i];
  171.         if $p->contentType==TEXT_PLAIN )
  172.         {
  173.             $text toString$p->data );
  174.             $text textDecode$text );
  175.             $text strip_tags$text );
  176.             return $text;
  177.         }
  178.     }
  179.     return "";
  180. }
  181.  
  182.  
  183. function getExtension$contentType )
  184. {
  185.     global $typeToExtension;
  186.     if array_key_exists$contentType$typeToExtension ) ) return $typeToExtension[$contentType];
  187.     return ".bin";
  188. }
  189.  
  190.  
  191.  
  192. function textDecode$text )
  193. {
  194.     if ord$text{0== 0xff && ord$text{1== 0xfe )
  195.     {
  196.         for $i 2$i strlen$text )$i += $res .= $text{$i};
  197.         return $res;
  198.         }
  199.     return $text;
  200. }
  201.  
  202.  
  203. function toString$data )
  204. {
  205.     for $i 0$i sizeof$data )$i++ $res .= chr$data[$i);
  206.     return $res;
  207. }
  208.  
  209. function writeBackSendConf$md {
  210.     $reply[00x8c// X-Mms-Message-Type
  211.     $reply[10x81// = m-send-conf
  212.     $reply[20x98// X-Mms-Transaction-ID
  213.     for $i 3$i strlen$md->transactionId )+3$i++ $reply[$iord$md->transactionId{$i-3);
  214.     $reply[$i++]=0// Terminate string
  215.     $reply[$i++]=0x8D// X-Mms-Version
  216.     $reply[$i++]=0x90// = 1.0
  217.     $reply[$i++]=0x92// X-Mms-Response-Status
  218.     $reply[$i++]=128;  // = OK
  219.     header("Content-Type: application/vnd.wap.mms-message");
  220.     for $j 0$j $i$j++ printchr$reply[$j) );
  221. }
  222.  
  223. /**
  224.  * @package htsrv
  225.  */
  226. class MMSDecoder {
  227.     var $data;
  228.     var $curp;
  229.     var $messageType;
  230.     var $transactionId;
  231.     var $mmsVersion;
  232.     var $date;
  233.     var $from;
  234.     var $to;
  235.     var $cc;
  236.     var $bcc;
  237.     var $subject;
  238.     var $messageClass;
  239.     var $priority;
  240.     var $senderVisibility;
  241.     var $deliveryReport;
  242.     var $readReply;
  243.     var $contentType;
  244.     var $bodyStartsAt;
  245.     var $expiryDate;
  246.     var $expiryDeltaSeconds;
  247.     var $status;
  248.     var $nparts;
  249.     var $parts;
  250.  
  251.     function isSeparator$ch )
  252.     {
  253.         return $ch == 40 || $ch == 41 || $ch == 60 || $ch == 62 || $ch == 64 || $ch == 44 || $ch == 58 || $ch == 59 || $ch == 92 || $ch == 47 || $ch == 123 || $ch == 125 || $ch == 91 || $ch == 93 || $ch == 63 || $ch == 61 || $ch == 32 || $ch == 11;
  254.     }
  255.  
  256.     function MMSDecoder$data )
  257.     {
  258.         $datalen strlen$data );
  259.         for $i 0$i $datalen$i++ $this->data[$iord$data{$i);
  260.         $this->curp = 0;
  261.     }
  262.  
  263.     function parse()
  264.     {
  265.         while MMSDecoder::parseHeader() );
  266.         $this->bodyStartsAt = $this->curp;
  267.         if $this->contentType == MULTIPART_MIXED || $this->contentType == MULTIPART_RELATED MMSDecoder::parseBody();
  268.     }
  269.  
  270.     function parseApplicationHeader()
  271.     {
  272.         $res MMSDecoder::parseToken$token );
  273.         if ($res$res MMSDecoder::parseTextString$appspec );
  274.         return $res;
  275.     }
  276.  
  277.     function parseBcc()
  278.     {
  279.         MMSDecoder::parseEncodedString$this->bcc );
  280.     }
  281.  
  282.     function parseBody()
  283.     {
  284.         MMSDecoder::parseUintvar$this->nparts );
  285.         for ($i=0$i $this->nparts$i++ MMSDecoder::parsePart($i);
  286.     }
  287.  
  288.     function parseCc({
  289.         MMSDecoder::parseEncodedString$this->cc );
  290.     }
  291.  
  292.     function parseConstrainedEncoding&$encoding )
  293.     {
  294.         $res MMSDecoder::parseShortInteger$encoding );
  295.         if (!$res$res MMSDecoder::parseExtensionMedia$encoding );
  296.         return $res;
  297.     }
  298.  
  299.     function parseConstrainedMedia&$contentType )
  300.     {
  301.         return MMSDecoder::parseConstrainedEncoding$contentType );
  302.     }
  303.  
  304.     function parseContentGeneralForm&$encoding )
  305.     {
  306.         $res MMSDecoder::parseValueLength$length );
  307.         $tmp $this->curp;
  308.         if !$res return 0;
  309.         $res MMSDecoder::parseMediaType$encoding );
  310.         $this->curp = $tmp+$length;
  311.         return $res;
  312.     }
  313.  
  314.     function parseContentType&$contentType )
  315.     {
  316.         $typeFound MMSDecoder::parseConstrainedMedia$contentType );
  317.         if !$typeFound )
  318.         {
  319.             MMSDecoder::parseContentGeneralForm$contentType );
  320.             $typeFound 1;
  321.         }
  322.         return $typeFound;
  323.     }
  324.  
  325.     function parseDate&$date )
  326.     {
  327.         MMSDecoder::parseLongInteger$date );
  328.     }
  329.  
  330.     function parseDeliveryReport()
  331.     {
  332.         $this->deliveryReport = $this->data[$this->curp++];
  333.     }
  334.  
  335.     function parseDeltaSeconds&$deltaSecs )
  336.     {
  337.         MMSDecoder::parseDate$deltaSecs );
  338.     }
  339.  
  340.     function parseEncodedString(&$encstring)
  341.     {
  342.         $isencoded MMSDecoder::parseValueLength$length );
  343.         if $isencoded $this->curp++;
  344.         MMSDecoder::parseTextString$encstring );
  345.     }
  346.  
  347.     function parseExpiry()
  348.     {
  349.         MMSDecoder::parseValueLength$length );
  350.         switch $this->data[$this->curp)
  351.         {
  352.             case 128:
  353.                 $this->curp++
  354.                 MMSDecoder::parseDate$this->expiryDate )
  355.                 break;
  356.             case 129:
  357.                 $this->curp++
  358.                 MMSDecoder::parseDeltaSeconds$this->expiryDeltaSeconds );
  359.                 break;
  360.             default:
  361.         }
  362.     }
  363.  
  364.     function parseExtensionMedia&$encoding )
  365.     {
  366.         $ch $this->data[$this->curp];
  367.         if $ch<32 || $ch == 127 return 0;
  368.         $res MMSDecoder::parseTextString$encoding );
  369.         return $res;
  370.     }
  371.  
  372.     function parseFrom()
  373.     {
  374.         MMSDecoder::parseValueLength$length );
  375.         if $this->data[$this->curp== 128 )
  376.         {
  377.             $this->curp++;
  378.             MMSDecoder::parseEncodedString$this->from );
  379.         }
  380.         else
  381.         {
  382.             $this->from = "Anonymous";
  383.             $this->curp++;
  384.         }
  385.     }
  386.  
  387.     function parseHeader()
  388.     {
  389.         $res MMSDecoder::parseMMSHeader();
  390.         if (!$res$res MMSDecoder::parseApplicationHeader();
  391.         return $res;
  392.     }
  393.  
  394.     function parseInteger&$integer )
  395.     {
  396.         $res MMSDecoder::parseShortInteger$integer );
  397.         if (!$res$res MMSDecoder::parseLongInteger$integer );
  398.         return $res;
  399.     }
  400.  
  401.     function parseLongInteger&$longInt )
  402.     {
  403.         if !MMSDecoder::parseShortLength$length ) ) return 0;
  404.         return MMSDecoder::parseMultiOctetInteger$longInt,$length );
  405.     }
  406.  
  407.     function parseMediaType&$encoding )
  408.     {
  409.         $res MMSDecoder::parseWellKnownMedia$encoding );
  410.         if (!$res$res    MMSDecoder::parseExtensionMedia$encoding );
  411.         return $res;
  412.     }
  413.  
  414.     function parseMessageClass()
  415.     {
  416.         if ($this->data[$this->curp]<128 || $this->data[$this->curp]>131die"parseMessageClass not fully implemented" );
  417.         $this->messageClass = $this->data[$this->curp++];
  418.     }
  419.  
  420.     function parseMessageType()
  421.     {
  422.         if (!($this->data[$this->curp0x80)) return 0;
  423.         $this->messageType = $this->data[$this->curp];
  424.         $this->curp++;
  425.         return 1;
  426.     }
  427.  
  428.     function parseMMSHeader()
  429.     {
  430.         if !MMSDecoder::parseShortInteger$mmsFieldName ) ) return 0;
  431.         switch ($mmsFieldName)
  432.         {
  433.             case BCC:
  434.                 MMSDecoder::parseBcc();
  435.                 break;
  436.             case CC:
  437.                 MMSDecoder::parseCc();
  438.                 break;
  439.             case CONTENT_LOCATION:
  440.                 MMSDecoder::parseContentLocation();
  441.                 break;
  442.             case CONTENT_TYPE:
  443.                 MMSDecoder::parseContentType$this->contentType );
  444.                 break;
  445.             case DATE:
  446.                 MMSDecoder::parseDate$this->date );
  447.                 break;
  448.             case DELIVERY_REPORT:
  449.                 MMSDecoder::parseDeliveryReport();
  450.                 break;
  451.             case DELIVERY_TIME:
  452.                 MMSDecoder::parseDeliveryTime();
  453.                 break;
  454.             case EXPIRY:
  455.                 MMSDecoder::parseExpiry();
  456.                 break;
  457.             case FROM:
  458.                 MMSDecoder::parseFrom();
  459.                 break;
  460.             case MESSAGE_CLASS:
  461.                 MMSDecoder::parseMessageClass();
  462.                 break;
  463.             case MESSAGE_ID:
  464.                 MMSDecoder::parseMessageId();
  465.                 break;
  466.             case MESSAGE_TYPE:
  467.                 MMSDecoder::parseMessageType();
  468.                 break;
  469.             case MMS_VERSION:
  470.                 MMSDecoder::parseMmsVersion();
  471.                 break;
  472.             case MESSAGE_SIZE:
  473.                 MMSDecoder::parseMessageSize();
  474.                 break;
  475.             case PRIORITY:
  476.                 MMSDecoder::parsePriority();
  477.                 break;
  478.             case READ_REPLY:
  479.                 MMSDecoder::parseReadReply();
  480.                 break;
  481.             case REPORT_ALLOWED:
  482.                 MMSDecoder::parseReportAllowed();
  483.                 break;
  484.             case RESPONSE_STATUS:
  485.                 MMSDecoder::parseResponseStatus();
  486.                 break;
  487.             case SENDER_VISIBILITY:
  488.                 MMSDecoder::parseSenderVisibility();
  489.                 break;
  490.             case STATUS:
  491.                 MMSDecoder::parseStatus();
  492.                 break;
  493.             case SUBJECT:
  494.                 MMSDecoder::parseSubject();
  495.                 break;
  496.             case TO:
  497.                 MMSDecoder::parseTo();
  498.                 break;
  499.             case TRANSACTION_ID:
  500.                 MMSDecoder::parseTransactionId();
  501.                 break;
  502.             default:
  503.                 break;
  504.         }
  505.         return 1;
  506.     }
  507.  
  508.     function parseMmsVersion()
  509.     {
  510.         MMSDecoder::parseShortInteger$this->mmsVersion );
  511.     }
  512.  
  513.     function parseMultiOctetInteger&$moint$noctets )
  514.     {
  515.         $moint=0;
  516.         for $i 0$i $noctets$i++ )
  517.         {
  518.             $moint $moint << 8;
  519.             $moint |= $this->data[$this->curp];
  520.             $this->curp++;
  521.         }
  522.         return 1;
  523.     }
  524.  
  525.     function parsePart$i )
  526.     {
  527.         $part new Part;
  528.         MMSDecoder::parseUintvar$headersLen );
  529.         MMSDecoder::parseUintvar$dataLen );
  530.         $part->dataLen $dataLen;
  531.         $tmp $this->curp;
  532.         MMSDecoder::parseContentType$part->contentType );
  533.         $this->curp = $tmp+$headersLen;
  534.         for $j 0$j $dataLen$j++ )
  535.         {
  536.             $part->data[$j$this->data[$this->curp];
  537.             $this->curp++;
  538.         }
  539.         $this->parts[$i]=$part;
  540.     }
  541.  
  542.     function parsePriority()
  543.     {
  544.         $this->priority = $this->data[$this->curp++];
  545.     }
  546.  
  547.     function parseReadReply()
  548.     {
  549.         $this->readReply = $this->data[$this->curp++];
  550.     }    
  551.  
  552.     function parseSenderVisibility()
  553.     {
  554.         $this->senderVisibility = $this->data[$this->curp++];
  555.     }
  556.  
  557.     function parseShortInteger(&$shortInt)
  558.     {
  559.         if !$this->data[$this->curp0x80 ) ) return 0;
  560.         $shortInt $this->data[$this->curp0x7f;
  561.         $this->curp++;
  562.         return 1;
  563.     }
  564.  
  565.     function parseShortLength&$shortLength )
  566.     {
  567.         $shortLength $this->data[$this->curp];
  568.         if ($shortLength>30return 0;
  569.         $this->curp++;
  570.         return 1;
  571.     }
  572.  
  573.     function parseStatus()
  574.     {
  575.         $this->status = $this->data[$this->curp++];
  576.     }
  577.  
  578.     function parseSubject()
  579.     {
  580.         MMSDecoder::parseEncodedString$this->subject );
  581.     }
  582.  
  583.     function parseTextString&$textString )
  584.     {
  585.         if $this->data[$this->curp== 127 $this->curp++;
  586.         while $this->data[$this->curp)
  587.         {
  588.             $textString .= chr$this->data[$this->curp);
  589.             $this->curp++;
  590.         }
  591.         $this->curp++;
  592.         return 1;
  593.     }
  594.  
  595.     function parseTo({
  596.         MMSDecoder::parseEncodedString$this->to );
  597.     }
  598.  
  599.     function parseToken(&$token{
  600.         if $this->data[$this->curp<= 31 || MMSDecoder::isSeparator$this->data[$this->curp) ) return 0;
  601.         while $this->data[$this->curp31 && !MMSDecoder::isSeparator($this->data[$this->curp) )
  602.         {
  603.             $token .= chr$this->data[$this->curp);
  604.             $this->curp++;
  605.         }
  606.         return 1;
  607.     }
  608.  
  609.     function parseTransactionId()
  610.     {    
  611.         MMSDecoder::parseTextString$this->transactionId );
  612.     }
  613.  
  614.     function parseUintvar&$uintvar {
  615.         $uintvar 0;
  616.         while $this->data[$this->curp0x80 )
  617.         {
  618.             $uintvar=$uintvar << 7;
  619.             $uintvar |= $this->data[$this->curp0x7f;
  620.             $this->curp++;
  621.         }
  622.         $uintvar $uintvar << 7;
  623.         $uintvar |= $this->data[$this->curp0x7f;
  624.         $this->curp++;
  625.     }
  626.  
  627.     function parseValueLength&$length {
  628.         $lengthFound=MMSDecoder::parseShortLength$length );
  629.         if !$lengthFound {
  630.             if $this->data[$this->curp== 31)
  631.             {
  632.                 $this->curp++;
  633.                 MMSDecoder::parseUintvar$length );
  634.                 return 1;
  635.             }
  636.         }
  637.         return $lengthFound;
  638.     }
  639.  
  640.     function parseWellKnownMedia&$encoding {
  641.         return MMSDecoder::parseInteger$encoding );
  642.     }
  643.  
  644. }
  645.  
  646. /**
  647.  * @package htsrv
  648.  */
  649. class Part
  650. {
  651.  
  652.     var $contentType;
  653.     var $dataLen;
  654.     var $data;
  655.  
  656.     function writeToFile$fileName )
  657.     {
  658.         $fp fopen$fileName"wb" );
  659.         for $i 0$i $this->dataLen$i++ fwrite$fpchr$this->data[$i));
  660.         fclose($fp);
  661.     }
  662.  
  663. }
  664.  
  665.  
  666. $md new MMSDecoder$HTTP_RAW_POST_DATA );
  667. $md->parse();
  668.  
  669. // $from_ip = $_SERVER['REMOTE_ADDR'];
  670. // $recipient = $md->to;
  671.  
  672. $post_title $md->subject;
  673. $text extractText$md );
  674.  
  675. if strlen$post_title == )
  676. {
  677.     if strlen$text 0$post_title substr$text012 "...";
  678.     else $post_title date'H:i'$localtimenow );
  679. }
  680.  
  681. $parts=$md->parts;
  682. $content $text '<br />';
  683.  
  684. for $i 0$i sizeof$parts )$i++ )
  685. {
  686.     $part $parts[$i];
  687.     $ext getExtension$part->contentType );
  688.     $size $part->dataLen;
  689.     $type contentTypeToString$part->contentType );
  690.     if $ext != '.smil' )
  691.     {
  692.         $filename 'mms' mktime($ext;
  693.         $part->writeToFile $fileupload_realpath '/' $filename );
  694.         $content .= '<img src="' $fileupload_url '/' $filename '" border="0" alt="" /><br />';
  695.     }
  696. }
  697. // $sizeofparts = calcSize( $md ) / 1024;
  698.  
  699. $post_title format_to_posttrim$post_title )0);
  700. $content format_to_posttrim$content )$Settings->get('AutoBR'));
  701.  
  702. $post_date date('Y-m-d H:i:s'$localtimenow);
  703.  
  704. $post_ID bpost_create$current_User->ID$post_title$content$post_date$post_categoryarray()'published'$current_User->locale''$Settings->get('AutoBR')true );
  705.  
  706. if isset$sleep_after_edit && $sleep_after_edit 
  707. {
  708.     sleep$sleep_after_edit );
  709. }
  710.  
  711.  
  712. /* Pinging turned off for now because of causing invalid server response
  713. $blogparams = get_blogparams_by_ID( $blog );
  714. pingback( true, $content, $post_title, '', $post_ID, $blogparams, false );
  715. pingb2evonet( $blogparams, $post_ID, $post_title, false );
  716. pingWeblogs( $blogparams, false );
  717. pingBlogs( $blogparams );
  718. pingTechnorati($blogparams);
  719. */
  720.  
  721. exit;
  722.  
  723. ?>

Documentation generated on Tue, 20 May 2008 01:51:52 +0200 by phpDocumentor 1.4.2