I installed a Shoutbox Bot to remind people to follow the rules and also to promote the forums VIP package. But when I go to add the messages I run into this error.
messages.php
<?php
/**
* @author -RAW-
* @copyright 2012
* @link http://invisionlegacy.com
* @filesource Shoutbox Bot
* @version 1.0.1
*/
if ( !defined('IN_ACP') )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class admin_shoutbox_bot_messages_messages extends ipsCommand
{
public $html;
public function doExecute( ipsRegistry $registry )
{
/* Load Skin and Lang */
$this->html = $this->registry->output->loadTemplate( 'cp_skin_messages' );
$this->html->form_code = '&module=messages&section=messages';
$this->html->form_code_js = '&module=messages§ion=messages';
$this->registry->class_localization->loadLanguageFile( array( 'admin_shoutbox_bot' ), 'shoutbox_bot' );
switch ( $this->request['do'] )
{
case 'add':
$this->form('add');
break;
case 'doadd':
$this->form('doadd');
break;
case 'edit':
$this->form('edit');
break;
case 'doedit':
$this->form('doedit');
break;
case 'delete':
$this->form('delete');
break;
case 'manage':
default:
//$this->registry->output->html .= $this->html->manage($form);
$this->manage();
break;
}
/* Output */
$this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
$this->registry->output->sendOutput();
}
public function manage()
{
$start = intval( $this->request['st'] ) >= 0 ? intval( $this->request['st'] ) : 0;
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'shoutbox_bot_messages' ) );
$pagination = $this->registry->output->generatePagination( array(
'totalItems' => $count['cnt'],
'itemsPerPage' => 10,
'currentStartValue' => $start,
'baseUrl' => $this->settings['base_url'] . "&" . $this->html->form_code,
)
);
$this->DB->build( array('select' => 's.*',
'from' => array( 'shoutbox_bot_messages' => 's' ),
'order' => 's.shout_id DESC',
'limit' => array( $start, 10 ),
'add_join' => array( 0 => array( 'select' => 'm.member_id, m.member_group_id, m.members_display_name, m.members_seo_name, mgroup_others',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=s.shout_mid',
'type' => 'left'))) );
$this->DB->execute();
/* Any PM? */
if ( $this->DB->getTotalRows() )
{
while ( $row = $this->DB->fetch() )
{
$allShouts[] = $row;
}
}
/* Show page */
$this->registry->output->html .= $this->html->manage( $allShouts, $pagination );
}
public function form( $type = 'add' )
{
$form = array();
$st = $this->request['st'];
if ( $type == 'add' )
{
$formContent['shout_message'] = IPSText::getTextClass( 'editor' )->showEditor( $data['shout_message'], 'shout_message' );
$formContent['shout_enable'] = $this->registry->output->formYesNo( 'shout_enable', 1 );
$this->registry->output->html .= $this->html->add( $formContent );
}
if ( $type == 'doadd' )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$_editor = new $classToLoad();
$_editor->setAllowHtml( $this->memberData['g_dohtml'] );
$_editor->setRteEnabled( true );
$text = $_editor->process( $_POST['shout_message'] );
/* Parse post */
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;//$this->memberData['g_dohtml'];
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
$text = IPSText::getTextClass( 'bbcode' )->preDbParse( $text );
$saveArray = array( 'shout_message' => $text,
'shout_enable' => $this->request['shout_enable']);
$this->DB->insert( 'shoutbox_bot_messages', $saveArray );
$message = "{$this->lang->words['sbBot_msgadded']}";
$this->registry->output->redirect( $this->settings['base_url'].$this->html->form_code. "&st=" . $this->request['st'], $message );
}
if ( $type == 'delete' )
{
/* INIT */
$id = intval( $this->request['id'] );
if ( ! $id )
{
$this->registry->output->showError( $this->lang->words['errorNoId'], 'MP001' );
}
/* Delete it */
$this->DB->delete( 'shoutbox_bot_messages', 'shout_id='.$id );
/* Set message */
$message = "{$this->lang->words['sbBot_msgdeleted']}";
$this->registry->output->redirect( $this->settings['base_url'].$this->html->form_code. "&st=" . $this->request['st'], $message );
$this->registry->output->redirect( $this->settings['base_url'].$this->html->form_code. "&st=" . $this->request['st'], $message );
}
if ( $type == 'edit' )
{
$data = $this->DB->buildAndFetch( array( 'select' => '*',
'from' => 'shoutbox_bot_messages',
'where' => "shout_id='".$this->request['id']."'",) );
$formContent['shout_enable'] = $this->registry->output->formYesNo( 'shout_enable', $data['shout_enable'] );
$formContent['shout_message'] = IPSText::getTextClass( 'editor' )->showEditor( $data['shout_message'], 'shout_message' );
$this->registry->output->html .= $this->html->edit( $formContent,$memb );
}
if ( $type == 'doedit')
{
$messageId = intval( $this->request['id'] );
/* Set BBCode parser */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
$_editor = new $classToLoad();
$_editor->setAllowHtml( $this->memberData['g_dohtml'] );
$_editor->setRteEnabled( true );
$text = $_editor->process( $_POST['shout_message'] );
/* Parse post */
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;//$this->memberData['g_dohtml'];
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
$text = IPSText::getTextClass( 'bbcode' )->preDbParse( $text );
$saveArray = array( 'shout_message' => $text,
'shout_enable' => $this->request['shout_enable']);
$this->DB->update( 'shoutbox_bot_messages', $saveArray, 'shout_id=' . $messageId );
$message = "{$this->lang->words['sbBot_msgupdated']}";
$this->registry->output->redirect( $this->settings['base_url'].$this->html->form_code. "&st=" . $this->request['st'], $message );
}
}
}