DM Shadow
05-19-2007, 10:59 AM
There have some ppl wondering about how the gimp works so I pasted a sample of the code. This is just one of 13 pages.
<?php
define ("MY_VERSION", "THE GIMP");
// ### Require Backend Files #############################################
require_once('./includes/functions_databuild.php');
// #### CHECK SCRIPT HAS BEEN LOADED PROPERLY ############################
if (!defined("THIS_SCRIPT") || (THIS_SCRIPT!="newreply" && THIS_SCRIPT!="newthread") )
{
die("This page is not designed to be access directly.");
}
// Lets see if the bot is even active.
if ($vbulletin->options['ewt_talkerbot_active'] == "1") {
// #### UNPACK TOPICIDS AND FORUMIDS #####################################
$forumids = explode(",", $vbulletin->options['ewt_talkerbot_mforumids']);
$pforumids = explode(",", $vbulletin->options['ewt_talkerbot_pforumids']);
// #### GET THE BOT USERNAME ##############################################
$botname = "";
// $getbotname = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($vbulletin->options['ewt_talkerbot_botuid']));
$botinfo = fetch_userinfo($vbulletin->options['ewt_talkerbot_botuid']);
if (is_array($botinfo))
{
$botname = $botinfo['username'];
} else
{
echo "<b>Warning</b> \$botuserid is not set to a proper member ID<br/>";
}
// #### CHECK IF WE NEED TO MONITOR POST ###################################
if (( (in_array("*", $forumids) || in_array($foruminfo["forumid"], $forumids) ) || ($threadinfo["id"]!="")) && $botname!="" && ($vbulletin->userinfo['userid']!=$vbulletin->options['ewt_talkerbot_botuid']))
{
// #### POST REQUIRED, FORMATTING POST INPUT #############################
$botinput = strip_quotes($post["message"]);
$botinput = preg_replace("#\[.+?\]#", "", $botinput);
$botinput = preg_replace("#\r|\n#", "", $botinput);
if (! ($botoutput = file_get_contents($vbulletin->options['bburl'] . "/alice/src/talk.php?vbid=" . $vbulletin->userinfo['userid'] . "&input=" . urlencode($botinput)) ) )
{
$botoutput = "I was not able to connect to my database. Please try again later.";
}
if($botoutput=='')
{
$botoutput = 'I was unable to form a reply right now. Please try again later.';
}
$botoutput = preg_replace("#\r$#", "", $botoutput);
$botoutput = preg_replace("#\n$#", "", $botoutput);
$botoutput = str_replace("<br></br>", '', $botoutput);
if ($vbulletin->options['ewt_talkerbot_quotemsg'] == "1")
{
$message = strip_quotes($post['message']);
$botoutput = "}]\n{$message}\n\n$botoutput";
}
$botoutput = fetch_censored_text($botoutput);
$botoutput = convert_url_to_bbcode($botoutput);
$botoutput = fetch_removed_sessionhash($botoutput);
//This is where we do the reply if we are supposed to since we can just monitor the forum as well. ;)
if (in_array("*", $pforumids) || in_array($foruminfo["forumid"], $pforumids))
{
if ($vbulletin->options['ewt_talkerbot_userateofposting']==1)
{
$randnumber = rand(1,100);
if ($foruminfo['mimicbotrop'] >= $randnumber)
{
$set1 = 1;
$posthash = md5($post['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
if ($type == 'thread')
{
$parentid = $post['postid'];
}
$botsposttime = time();
// disable flood check
$keep = $vbulletin->options['floodchecktime'];
$vbulletin->options['floodchecktime'] = 0;
$dataman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman->set_info('preview', $post['preview']);
$dataman->set_info('parseurl', $post['parseurl']);
$dataman->set_info('posthash', $posthash);
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('thread', $threadinfo);
$dataman->set('dateline', $botsposttime);
$dataman->setr('showsignature', $set1);
$dataman->setr('allowsmilie', $set1);
$dataman->setr('userid', $vbulletin->options['ewt_talkerbot_botuid']);
$dataman->setr('title', $post['title']);
$dataman->setr('pagetext', $botoutput);
$dataman->setr('iconid', $post['iconid']);
$dataman->set('visible', 1);
$dataman->setr('parentid', $parentid);
$dataman->setr('threadid', $threadinfo['threadid']);
$dataman->pre_save();
if (!$dataman->errors) // should not occur
{
$dataman->save();
build_forum_counters($foruminfo["forumid"]);
// Check if we have a bot session in the session table. If so then lets update it. If not lets add it in.
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."session SET lastactivity = '". TIMENOW ."' WHERE (userid = '".$vbulletin->options['ewt_talkerbot_botuid']."')");
if ($vbulletin->db->affected_rows() == 0)
{
$ip = "127.0.0.1";
$vbulletin->db->query_write("INSERT INTO ".TABLE_PREFIX."session (userid,lastactivity,host) VALUES ('".$vbulletin->options['ewt_talkerbot_botuid']."',".TIMENOW.",'$ip')");
}
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($botinfo);
$userdata->set('lastactivity', TIMENOW);
$userdata->set('lastvisit', TIMENOW - 1);
$userdata->save();
}
// restore flood check
$vbulletin->options['floodchecktime'] = $keep;
}
}
else
{
$set1 = 1;
$posthash = md5($post['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
if ($type == 'thread')
{
$parentid = $post['postid'];
}
$botsposttime = time();
// disable flood check
$keep = $vbulletin->options['floodchecktime'];
$vbulletin->options['floodchecktime'] = 0;
$dataman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman->set_info('preview', $post['preview']);
$dataman->set_info('parseurl', $post['parseurl']);
$dataman->set_info('posthash', $posthash);
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('thread', $threadinfo);
$dataman->set('dateline', $botsposttime);
$dataman->setr('showsignature', $set1);
$dataman->setr('allowsmilie', $set1);
$dataman->setr('userid', $vbulletin->options['ewt_talkerbot_botuid']);
$dataman->setr('title', $post['title']);
$dataman->setr('pagetext', $botoutput);
$dataman->setr('iconid', $post['iconid']);
$dataman->set('visible', 1);
$dataman->setr('parentid', $parentid);
$dataman->setr('threadid', $threadinfo['threadid']);
$dataman->pre_save();
if (!$dataman->errors) // should not occur
{
$dataman->save();
build_forum_counters($foruminfo["forumid"]);
// Check if we have a bot session in the session table. If so then lets update it. If not lets add it in.
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."session SET lastactivity = '". TIMENOW ."' WHERE (userid = '".$vbulletin->options['ewt_talkerbot_botuid']."')");
if ($vbulletin->db->affected_rows() == 0)
{
$ip = "127.0.0.1";
$vbulletin->db->query_write("INSERT INTO ".TABLE_PREFIX."session (userid,lastactivity,host) VALUES ('".$vbulletin->options['ewt_talkerbot_botuid']."',".TIMENOW.",'$ip')");
}
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($botinfo);
$userdata->set('lastactivity', TIMENOW);
$userdata->set('lastvisit', TIMENOW - 1);
$userdata->save();
}
// restore flood check
$vbulletin->options['floodchecktime'] = $keep;
}
}
}
}
?>
<?php
define ("MY_VERSION", "THE GIMP");
// ### Require Backend Files #############################################
require_once('./includes/functions_databuild.php');
// #### CHECK SCRIPT HAS BEEN LOADED PROPERLY ############################
if (!defined("THIS_SCRIPT") || (THIS_SCRIPT!="newreply" && THIS_SCRIPT!="newthread") )
{
die("This page is not designed to be access directly.");
}
// Lets see if the bot is even active.
if ($vbulletin->options['ewt_talkerbot_active'] == "1") {
// #### UNPACK TOPICIDS AND FORUMIDS #####################################
$forumids = explode(",", $vbulletin->options['ewt_talkerbot_mforumids']);
$pforumids = explode(",", $vbulletin->options['ewt_talkerbot_pforumids']);
// #### GET THE BOT USERNAME ##############################################
$botname = "";
// $getbotname = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($vbulletin->options['ewt_talkerbot_botuid']));
$botinfo = fetch_userinfo($vbulletin->options['ewt_talkerbot_botuid']);
if (is_array($botinfo))
{
$botname = $botinfo['username'];
} else
{
echo "<b>Warning</b> \$botuserid is not set to a proper member ID<br/>";
}
// #### CHECK IF WE NEED TO MONITOR POST ###################################
if (( (in_array("*", $forumids) || in_array($foruminfo["forumid"], $forumids) ) || ($threadinfo["id"]!="")) && $botname!="" && ($vbulletin->userinfo['userid']!=$vbulletin->options['ewt_talkerbot_botuid']))
{
// #### POST REQUIRED, FORMATTING POST INPUT #############################
$botinput = strip_quotes($post["message"]);
$botinput = preg_replace("#\[.+?\]#", "", $botinput);
$botinput = preg_replace("#\r|\n#", "", $botinput);
if (! ($botoutput = file_get_contents($vbulletin->options['bburl'] . "/alice/src/talk.php?vbid=" . $vbulletin->userinfo['userid'] . "&input=" . urlencode($botinput)) ) )
{
$botoutput = "I was not able to connect to my database. Please try again later.";
}
if($botoutput=='')
{
$botoutput = 'I was unable to form a reply right now. Please try again later.';
}
$botoutput = preg_replace("#\r$#", "", $botoutput);
$botoutput = preg_replace("#\n$#", "", $botoutput);
$botoutput = str_replace("<br></br>", '', $botoutput);
if ($vbulletin->options['ewt_talkerbot_quotemsg'] == "1")
{
$message = strip_quotes($post['message']);
$botoutput = "}]\n{$message}\n\n$botoutput";
}
$botoutput = fetch_censored_text($botoutput);
$botoutput = convert_url_to_bbcode($botoutput);
$botoutput = fetch_removed_sessionhash($botoutput);
//This is where we do the reply if we are supposed to since we can just monitor the forum as well. ;)
if (in_array("*", $pforumids) || in_array($foruminfo["forumid"], $pforumids))
{
if ($vbulletin->options['ewt_talkerbot_userateofposting']==1)
{
$randnumber = rand(1,100);
if ($foruminfo['mimicbotrop'] >= $randnumber)
{
$set1 = 1;
$posthash = md5($post['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
if ($type == 'thread')
{
$parentid = $post['postid'];
}
$botsposttime = time();
// disable flood check
$keep = $vbulletin->options['floodchecktime'];
$vbulletin->options['floodchecktime'] = 0;
$dataman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman->set_info('preview', $post['preview']);
$dataman->set_info('parseurl', $post['parseurl']);
$dataman->set_info('posthash', $posthash);
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('thread', $threadinfo);
$dataman->set('dateline', $botsposttime);
$dataman->setr('showsignature', $set1);
$dataman->setr('allowsmilie', $set1);
$dataman->setr('userid', $vbulletin->options['ewt_talkerbot_botuid']);
$dataman->setr('title', $post['title']);
$dataman->setr('pagetext', $botoutput);
$dataman->setr('iconid', $post['iconid']);
$dataman->set('visible', 1);
$dataman->setr('parentid', $parentid);
$dataman->setr('threadid', $threadinfo['threadid']);
$dataman->pre_save();
if (!$dataman->errors) // should not occur
{
$dataman->save();
build_forum_counters($foruminfo["forumid"]);
// Check if we have a bot session in the session table. If so then lets update it. If not lets add it in.
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."session SET lastactivity = '". TIMENOW ."' WHERE (userid = '".$vbulletin->options['ewt_talkerbot_botuid']."')");
if ($vbulletin->db->affected_rows() == 0)
{
$ip = "127.0.0.1";
$vbulletin->db->query_write("INSERT INTO ".TABLE_PREFIX."session (userid,lastactivity,host) VALUES ('".$vbulletin->options['ewt_talkerbot_botuid']."',".TIMENOW.",'$ip')");
}
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($botinfo);
$userdata->set('lastactivity', TIMENOW);
$userdata->set('lastvisit', TIMENOW - 1);
$userdata->save();
}
// restore flood check
$vbulletin->options['floodchecktime'] = $keep;
}
}
else
{
$set1 = 1;
$posthash = md5($post['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
if ($type == 'thread')
{
$parentid = $post['postid'];
}
$botsposttime = time();
// disable flood check
$keep = $vbulletin->options['floodchecktime'];
$vbulletin->options['floodchecktime'] = 0;
$dataman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman->set_info('preview', $post['preview']);
$dataman->set_info('parseurl', $post['parseurl']);
$dataman->set_info('posthash', $posthash);
$dataman->set_info('forum', $foruminfo);
$dataman->set_info('thread', $threadinfo);
$dataman->set('dateline', $botsposttime);
$dataman->setr('showsignature', $set1);
$dataman->setr('allowsmilie', $set1);
$dataman->setr('userid', $vbulletin->options['ewt_talkerbot_botuid']);
$dataman->setr('title', $post['title']);
$dataman->setr('pagetext', $botoutput);
$dataman->setr('iconid', $post['iconid']);
$dataman->set('visible', 1);
$dataman->setr('parentid', $parentid);
$dataman->setr('threadid', $threadinfo['threadid']);
$dataman->pre_save();
if (!$dataman->errors) // should not occur
{
$dataman->save();
build_forum_counters($foruminfo["forumid"]);
// Check if we have a bot session in the session table. If so then lets update it. If not lets add it in.
$vbulletin->db->query_write("UPDATE ".TABLE_PREFIX."session SET lastactivity = '". TIMENOW ."' WHERE (userid = '".$vbulletin->options['ewt_talkerbot_botuid']."')");
if ($vbulletin->db->affected_rows() == 0)
{
$ip = "127.0.0.1";
$vbulletin->db->query_write("INSERT INTO ".TABLE_PREFIX."session (userid,lastactivity,host) VALUES ('".$vbulletin->options['ewt_talkerbot_botuid']."',".TIMENOW.",'$ip')");
}
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($botinfo);
$userdata->set('lastactivity', TIMENOW);
$userdata->set('lastvisit', TIMENOW - 1);
$userdata->save();
}
// restore flood check
$vbulletin->options['floodchecktime'] = $keep;
}
}
}
}
?>