<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_Api_Vb4_visitormessage extends vB_Api { public function message($message, $userid) { $cleaner = vB::getCleaner(); $message = $cleaner->clean($message, vB_Cleaner::TYPE_STR); $userid = $cleaner->clean($userid, vB_Cleaner::TYPE_STR); $parentid = vB_Api::instanceInternal('node')->fetchVMChannel(); $data = array( 'title' => '(Untitled)', 'parentid' => $parentid, 'channelid' => '', 'nodeid' => '', 'setfor' => $userid, 'rawtext' => $message, ); $result = vB_Api::instanceInternal('content_text')->add($data, array('wysiwyg' => false)); if (!empty($result['errors'])) { return array('response' => array('postpreview' => array('invalidid'))); } return array('response' => array('errormessage' => array('visitormessagethanks'))); } } 