<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("calendar_do_addevent_end", "createthread");
function ragtek_eventcalendar_info()
{
/**
* Array of information about the plugin.
* name: The name of the plugin
* description: Description of what the plugin does
* website: The website the plugin is maintained at (Optional)
* author: The name of the author of the plugin
* authorsite: The URL to the website of the author (Optional)
* version: The version number of the plugin
* guid: Unique ID issued by the MyBB Mods site for version checking
* compatibility: A CSV list of MyBB versions supported. Ex, "121,123", "12*". Wildcards supported.
*/
return array(
"name" => "ragtek_eventcalendar",
"description" => "A sample plugin that prints hello world and prepends the content of each post to 'Hello world!'",
"website" => "http://www.mybboard.net",
"author" => "MyBB Group",
"authorsite" => "http://www.mybboard.net",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
function createthread()
{
///daniel
require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";
$posthandler->admin_override = true; // Optional, ich habe es lieber drin ^^
$uid = $mybb->user[uid];
$username = $mybb->user[username];
$message = $mybb->input['description'];
$subject = $event['start_date']['day'] .' ' . $event['name'];
$new_thread = array(
"fid" => 2,
"subject" => $subject,
"uid" => $uid,
"username" => $username,
"message" => $message,
"ipaddress" => get_ip(),
);
$posthandler->set_data($new_thread);
$validate = $posthandler->validate_thread();
if ($validate)
{
$tinfo = $posthandler->insert_thread();}
///daniel
}
?>