Итого, что мы имеем: в файле admin.content.php интеграцией был добавлен кусок кода примерно 690 строка
/*
bbpixel plugin
- post new topic to vBulletin forum
*/
if($row->version==1){
global $mosConfig_absolute_path, $mosConfig_live_site;
require_once($mosConfig_absolute_path."/pluginservices_config.php");
//get vbb forum id
$fc_vbnews = $mosConfig_absolute_path."/administrator/components/com_vbbnews/vbbnews_config.php";
if (file_exists($fc_vbnews)) {
require_once($fc_vbnews);
}
// NewsBridge is working?
$turnoff = false;
if(!isset($bbpixel_turn_on) or $bbpixel_turn_on==0 or !isset($bbpixel_mb_vb_news) or !is_array($bbpixel_mb_vb_news)){
$turnoff = true;
}
$forum_id = $bbpixel_mb_vb_news[$row->catid];
//$forum_id = $bbpixel_mb_vb_news[$row->sectionid];
if($forum_id>0 and !$turnoff){
//get VBB DB config
require_once($VB_ROOT_PATH."/includes/config.php");
$vbb_table_prefix = $config['Database']['tableprefix'];
require_once($VB_ROOT_PATH."/includes/functions.php");
require_once($VB_ROOT_PATH."/includes/functions_wysiwyg.php");
require_once($VB_ROOT_PATH."/includes/functions_newpost.php");
$title = $row->title;
$pagetext = $row->introtext."<br/>".$row->fulltext;
//Page break and images
$pagetext = str_replace("{mospagebreak}","<br/><br/>", $pagetext);
$strQuery = "SELECT images FROM #__content WHERE id='{$row->id}'";
$database->setQuery($strQuery);
$database->query();
$result = $database->loadRow();
$imgArr = preg_split("/[\s,]+/", $result[0]);
if(is_array($imgArr)){
foreach ($imgArr as $imgInfoStr) {
echo $imgInfoStr;
if (preg_match("/|/", $imgInfoStr)) {
$imgInfoArr = explode('|', $imgInfoStr);
}
if(is_array($imgInfoArr) and (count($imgInfoArr)>4)){
$strImg = "<img src='{$mosConfig_live_site}/images/stories/{$imgInfoArr[0]}' align='{$imgInfoArr[1]}' border='{$imgInfoArr[3]}' alt='{$imgInfoArr[4]}'/>";
} else {
$strImg = "<img src='{$mosConfig_live_site}/images/stories/{$imgInfoStr}' border='' alt=''/>";
}
$pagetext = preg_replace("#{mosimage}#", $strImg, $pagetext, 1);
}
}
$pagetext = str_replace("{mosimage}", "", $pagetext);
$pagetext = bbpixelConvertWysiwyg2Bbcode($pagetext, 1);
//user
$user_id = $my->id;
$user_name = $my->username;
// OTHER SANITY CHECKS
$user_name = preg_replace('#\s+#', ' ', $user_name);
//addslah
$title = addslashes($title);
$pagetext = addslashes($pagetext);
//get max thread id
$query = "SELECT MAX(threadid) AS threadmax FROM {$vbb_table_prefix}thread";
$database->setQuery($query);
$database->query();
$result = $database->loadRow();
$this_time = time();
$thread_id = $result[0] + 1;
$mymsg .= "<hr/>THREAD ID MAX = ".$result[0];
$mymsg .= "<hr/>".$pagetext;
$mymsg .= "<hr/>USER_ID: $user_id & USER_NAME: $user_name ";
//save post
$query = "INSERT INTO {$vbb_table_prefix}post(postid, threadid, parentid, username, userid, title, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible, attach)
VALUES(
'',
'$thread_id',
'0',
'$user_name',
'$user_id',
'$title',
'$this_time',
'$pagetext',
'1',
'1',
'',
'0',
'1',
'0'
)
";
$database->setQuery($query);
$database->query();
$post_id = $database->insertid();
$mymsg .= "<hr/>".$query;
//save thread
$query = "INSERT INTO {$vbb_table_prefix}thread(threadid, title, firstpostid, lastpost, forumid, pollid, open, replycount, postusername, postuserid, lastposter, dateline, views, iconid, notes, visible, sticky, votenum, votetotal, attach, similar)
VALUES(
'$thread_id',
'$title',
'$post_id',
'$this_time',
'$forum_id',
'0',
'1',
'0',
'$user_name',
'$user_id',
'$user_name',
'$this_time',
'1',
'0',
'',
'1',
'0',
'0',
'0',
'0',
''
)
";
$database->setQuery($query);
$database->query();
$mymsg .= "<hr/>".$query;
//update forum
$query="UPDATE {$vbb_table_prefix}forum
SET
lastpost='$this_time',
lastposter='$user_name',
lastthread='$title',
lastthreadid='$thread_id',
lasticonid='0',
threadcount=threadcount+1
WHERE forumid='$forum_id'
";
$database->setQuery($query);
$mymsg .= "<hr/>".$query;
$database->query();
$mymsg .= "<hr/>".$query;
//relationship
$query = "INSERT INTO #__vbbnews_topic_relation (mb_topic_id, vb_topic_id)
VALUES(
'$row->id',
'$thread_id'
)";
$database->setQuery($query);
$mymsg .= "<hr/>".$query;
$database->query();
}
//test
//echo $mymsg;
//exit();
}
//endbbpixel