Jump to content
WebFlake
  • 0

Contact form 2.1.2 problem


Oturo

Question

I have a problem with hook Contact Form 2.1.2 when i try to sent a test message it get errors

 

Warning: Illegal string offset 'member_id' in
/home//******/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php
on line 452

Warning: Illegal string offset 'member_id' in
/home/******//public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php
on line 452

Warning: Illegal string offset 'member_id' in
/home/******/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php
on line 452

 

www.****** (i remove the website name) Driver Error

 

 

How to fix this problem ???

Edited by Oturo
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Since it is only a warning you could add 

//Report runtime errors error_reporting(E_ERROR |  E_PARSE);

 

before this line

        foreach ( $toMemberData as $row )

 

If you want to see what may be causing it, add 

echo "<br><pre>";var_dump($toMemberData);die("here's your memberata");

 

in front of that line instead and run it once then remove that line and post the results here.

  • Upvote 1
Link to comment
Share on other sites

  • 0

Check the sql error logs in the acp ..

 

 

Date: Sun, 01 Sep 2013 15:51:05 +0000

 Error: 1054 - Unknown column 'department' in 'field list'

 IP Address: ************* - /index.php?/contactus/

 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 mySQL query error: SELECT cid, title, description, obrigatorio, charlimit, cposition, department FROM contato_customfields WHERE department=1 AND visivel=1 ORDER BY cposition DESC

 .--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.

 | File | Function   | Line No.   |

 |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|

 | admin/applications_addon/other/contactus/modules_public/contato/form.php | [public_contactus_contato_form].form   | 33   |

 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'

 | admin/sources/base/ipsController.php | [public_contactus_contato_form].doExecute | 306 |

 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'

Now there is other problem

 

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

 

 

 

 

 

This is the line 503

 

 

    $messengerFunctions->sendNewPersonalTopic(  $row['member_id'], 

 

 

 

and the whole txt

 

 <?php/*** @author -RAW-* @copyright 2012* @link http://rawcodes.net* @filesource Contact Form* @version 2.2.0*/if ( ! defined( 'IN_IPB' ) ){print"<h1>Incorrect access</h1>You cannot access this filedirectly. If you have recently upgraded, make sure you upgraded all therelevant files.";exit();}class public_contactus_contato_form extends ipsCommand{protected $output = '';protected $pageTitle = '';public function doExecute( ipsRegistry $registry ){switch( $this->request['code'] ){case 'submit':$this->dosubmit();break;case 'sent':$this->messageSent();break;default:$this->form();break;}}private function form(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus', 'contactus' ) );$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );if ( !$this->settings['contato_systemon'] ){$this->registry->output->showError( $this->lang->words['systemoff'] );}if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['contato_grupos'] ) ) ){$this->registry->output->showError( $this->lang->words['erro_permissao'] );}if ( !$this->settings['contato_gruposstaff'] ){$this->registry->output->showError( $this->lang->words['mpnone_admin'] );}$emails = $this->DB->buildAndFetch( array( 'select' => 'id','from' => 'contato_emails') );if ( ($this->settings['contato_forma'] == 3 OR $this->settings['contato_forma'] == 4 ) AND !$emails['id'] ){$this->registry->output->showError( $this->lang->words['depemails_none_admin'] );}$this->DB->build( array('select' => 'id, nome','from' => 'contato_departamentos','order' => 'id') );$depart = $this->DB->execute();if ( $this->DB->getTotalRows( $depart ) ){while ( $r = $this->DB->fetch( $depart ) ){$dep[] = array( 'id' => $r['id'], 'title' => $r['nome'] );}}else{$this->registry->output->showError( $this->lang->words['departamentos_none_admin'] );}$regra= $this->settings['contato_regra'] == 1 AND$this->settings['contato_regratexto'] != "" ? $regra = "<pclass='message'>".IPSText::getTextClass( 'bbcode')->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse($this->settings['contato_regratexto'] ) )."</p><br />" :$regra = "";/* New just in case first id is deleted */$firstid = $this->DB->buildAndFetch( array( 'select' => 'id, nome','from' => 'contato_departamentos','order' => 'id ASC','limit' => array(0,1) ));$id = intval( $this->request['id'] );if ( !$id ){$thewhere = "department={$firstid['id']} AND visivel=1";}else{$thewhere = "department={$id} AND visivel=1";}$this->DB->build( array('select' => 'cid, title, description, obrigatorio, charlimit, cposition, department','from' => 'contato_customfields','order' => 'cposition DESC','where' => $thewhere,) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$customfields[]= array( 'id' => $r['cid'], 'title' => $r['title'], 'description'=> $r['description'], 'charlimit' => $r['charlimit'], 'required'=> $r['obrigatorio']);}}if ( $this->settings['contato_questions'] == 1 ){$pergunta = array();$query = $this->DB->buildAndFetch( array('select' => 'qid, question','from' => 'contato_antispam','order' => 'rand()','limit' => array(0,1)) );if ( $this->DB->getTotalRows() ){$pergunta = array( 'qid' => $query['qid'], 'question' => $query['question'] );}}if( $this->settings['contato_captcha'] ){$captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();}$this->registry->output->addNavigation( $this->lang->words['title'], '' );$this->output.= $this->registry->output->getTemplate( 'contato' )->form($dep, $regra, $pergunta, $customfields, $captchaHTML, $firstid );/* Don't be asshole! Do not remove it! */$this->output.= '<p style="padding: 10px;font-size: 11px;position:relative;color:#848484;text-align:right;text-shadow: 0px 1px 0px#fff;">Powered by <b>(RC34) Contact Form'.$this->caches['app_cache']['contactus']['app_version'].'</b>&copy; '.date('Y').'&nbsp;&nbsp;<a target="_blank" href="http://www.rawcodes.net/">Rawcodes.net</a></p>';$this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];$this->registry->output->setTitle( $this->pageTitle );$this->registry->output->addContent( $this->output );$this->registry->output->sendOutput();}private function dosubmit(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );if ( !$this->settings['contato_systemon'] ){$this->registry->output->showError( $this->lang->words['systemoff'] );}if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['contato_grupos'] ) ) ){$this->registry->output->showError( $this->lang->words['erro_permissao'] );}if ( !$this->request['name'] ){$this->registry->output->showError( $this->lang->words[ 'no_name' ] );}if ( !$this->request['email'] ){$this->registry->output->showError( $this->lang->words[ 'no_email' ] );}if( !IPSText::checkEmailAddress( $this->request['email'] ) ){$this->registry->output->showError( $this->lang->words['no_email'] );}/* Department */if ( $this->request['departamento'] == '-1' ){$this->registry->output->showError( $this->lang->words['no_department'] );}if ( !$this->request['assunto'] ){$this->registry->output->showError( $this->lang->words[ 'no_assunto' ] );}if ( !$this->request['mensagem'] ){$this->registry->output->showError( $this->lang->words[ 'no_mensagem' ] );}if ( IPSText::mbstrlen( $this->request['mensagem'] ) < 10 ){$this->lang->words['short_mensagem']= sprintf( $this->lang->words['short_mensagem'],$this->settings['contato_tamanho'] );$this->registry->output->showError( $this->lang->words[ 'short_mensagem' ] );}if ( IPSText::mbstrlen( $this->request['mensagem'] ) > $this->settings['contato_tamanho'] * 1024 ){$this->lang->words['post_too_long']= sprintf( $this->lang->words['post_too_long'],$this->settings['contato_tamanho'] );$this->registry->output->showError( $this->lang->words['post_too_long'] );}/* Testar custom fields, se tiver algum com preenchimento obrigatσrio *//* o_O ok did some changes here */$id = intval( $this->request['departamento']);$this->DB->build( array('select' => '*','from' => 'contato_customfields','where' => "department={$id} AND visivel=1",) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){if ( $r['obrigatorio'] == 1 ){$campo = 'cf_'.$r["cid"];if ( empty( $this->request[ $campo ] ) ){$this->registry->output->showError( $this->lang->words['cf_obrigatorio'] );}}}}/* Testar peguntas anti-spam, se habilitado */if ( $this->settings['contato_questions'] ){if ( !$this->request['pergunta'] ){$this->registry->output->showError( $this->lang->words['antispam_branco'] );}$query = $this->DB->buildAndFetch( array( 'select' => 'answer','from' => 'contato_antispam','where' => 'qid='.$this->request['qid']) );if ( strtolower($this->request['pergunta']) != strtolower($query['answer']) ){$this->registry->output->showError( $this->lang->words['antispam_errado'] );}}/* Testar captcha, se habilitado */if ( $this->settings['contato_captcha'] ){if ( $this->registry->getClass('class_captcha')->validate() !== TRUE ){$this->registry->output->showError( $this->lang->words['captcha_errado'] );}}switch ( $this->settings['contato_forma'] ){case 1:$this->createTopic();break;case 2:$this->sendPM();break;case 3:$this->sendEmail();break;case 4:$this->createTopic();$this->sendPM();$this->sendEmail();break;}$this->registry->class_localization->loadLanguageFile( array( 'public_contactus', 'contactus' ) );$this->registry->output->redirectScreen($this->lang->words['formulario_enviado'],$this->settings['base_url_with_app'] ."&module=contato&section=form&code=sent" );}public function createTopic(){require_once( IPSLib::getAppDir('forums') . '/sources/classes/moderate.php' );$this->moderatorLibrary = new moderatorLibrary( $this->registry );$autor= $this->settings['contato_topicauthor'] == 1 ?$this->memberData['member_id'] : $this->settings['contato_autor'];$autortopico = IPSMember::load( $autor );$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields','where' => "department={$this->request['departamento']} and visivel = 1") );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= "<b>".$r['title']."</b> ".$this->request[$campo]."<br />";}}$dep = $this->DB->buildAndFetch( array('select' => 'id, nome, forum_id','from' => 'contato_departamentos','where' => 'id='.$this->request['departamento']) );$forum_id = $dep['forum_id'];require_once( IPSLib::getAppDir('forums') . '/sources/classes/post/classPost.php' );$this->post = new classPost( $this->registry );$find = array( "{member_name}","{birth_death}" );$replace = array( $mem['members_display_name'] , $dateB . " - " . $dateD );$t_title = str_replace( $find, $replace, $this->settings['memorial_t_title'] );$this->topic = array('title' => $this->settings['contato_prefixo']." ".$this->request['assunto'],'state' => "open",'posts' => 0,'starter_id' => $autortopico['member_id'],'starter_name' => $autortopico['members_display_name'],'start_date' => time(),'last_poster_id' => $autortopico['member_id'],'last_poster_name' => $autortopico['members_display_name'],'last_post' => time(),'author_mode' => 1,'poll_state' => 0,'last_vote' => 0,'views' => 0,'forum_id' => $forum_id,'approved' => 1,'pinned' => 0);$this->DB->insert( 'topics', $this->topic );$this->topic['tid'] = $this->DB->getInsertId();$find = array( "{name}", "{email}", "{ip}", "{date}", "{customfields}", "{department}", "{content}" );$replace= array( $this->request['name'], $this->request['email'],$this->member->ip_address,$this->registry->getClass('class_localization')->getDate(time(), 'LONG', 1 ), $customfields, $dep['nome'],$this->request['mensagem'] );$mensagem = str_replace( $find, $replace, $this->settings['contato_template'] );$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );$parser = new $classToLoad();$parser->set( array( 'parseArea' => 'contactus','memberData' => $this->memberData,'parseBBCode' => 1,'parseHtml' => 0,'parseEmoticons' => 1 ) );$post_content = $parser->display( $mensagem );/* Insert data */$post = array('author_id' => $autortopico['member_id'],'use_sig' => 1,'use_emo' => 1,'ip_address' => $autortopicor['ip_address'],'post_date' => time(),'post' => $post_content,'author_name' => $autortopico['members_display_name'],'topic_id' => $this->topic['tid'],'queued' => 0,'post_htmlstate' => 0,'post_key' => md5( microtime() ),);$this->DB->insert( 'posts', $post );$post['pid'] = $this->DB->getInsertId();$this->moderatorLibrary->rebuildTopic( $this->topic['tid'], false );$this->moderatorLibrary->forumRecount( $this->topic['forum_id'] );}public function sendPM(){if ( !$this->settings['contato_gruposstaff'] ){return false;}$toMemberData = array();$fromMemberData = array();require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );$messengerFunctions = new messengerFunctions( $this->registry );/* Algum Custom Field para ser impresso ? */$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields',//'where' => 'visivel = 1''where' => "department={$this->request['departamento']} AND visivel=1",) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= "".$r['title']." ".$this->request[$campo]."<br />";}}$dep = $this->DB->buildAndFetch( array('select' => 'nome','from' => 'contato_departamentos','where' => 'id='.$this->request['departamento']) );$find = array( "{name}", "{email}", "{ip}", "{date}", "{customfields}", "{department}", "{content}" );$replace= array( $this->request['name'], $this->request['email'],$this->member->ip_address,$this->registry->getClass('class_localization')->getDate(time(), 'LONG', 1 ), $customfields, $dep['nome'],$this->request['mensagem'] );$mensagem = str_replace( $find, $replace, $this->settings['contato_template'] );$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );$_editor = new $classToLoad();/* Parsing stuff */IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;IPSText::getTextClass( 'bbcode' )->parse_html = 0;IPSText::getTextClass( 'bbcode' )->parse_nl2br = 0;IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;IPSText::getTextClass( 'bbcode' )->parsing_section = 'contact';IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];$mensagem = IPSText::getTextClass('bbcode')->preDbParse( $mensagem );$this->DB->build( array('select' => 'member_id','from' => 'members','where' => 'member_group_id in('.$this->settings['contato_gruposstaff'].')',) );$outer = $this->DB->execute();if ( $this->DB->getTotalRows( $outer ) ){while ( $r = $this->DB->fetch( $outer ) ){$toMemberData[] = $r['member_id'];}}//-----------------------------------------// First off, load the to and from members//-----------------------------------------//$_members = IPSMember::load( array( $toMemberID, $fromMemberID ), 'groups,extendedProfile' );if(!$this->settings['contato_autor']){$author = $this->memberData['member_id'];}else{$author = $this->settings['contato_autor'];}foreach ( $toMemberData as $row ){try{$messengerFunctions->sendNewPersonalTopic( $row['member_id'],$this->memberData['member_id'],array(),$this->settings['contato_prefixo']." ".$this->request['assunto'],IPSText::getTextClass('editor')->method != 'rte' ? IPSText::br2nl($mensagem) : $mensagem,array( 'origMsgID' => 0,'fromMsgID' => 0,'postKey' => md5(microtime()),'trackMsg' => 0,'addToSentFolder' => 0,'hideCCUser' => 0,'forcePm' => 1,'isSystem' => TRUE,) );}catch( Exception $error ){$msg = $error->getMessage();$toMember = IPSMember::load( $member_id, 'groups,extendedProfile' );if ( strstr( $msg, 'BBCODE_' ) ){$msg = str_replace( 'BBCODE_', '', $msg );$this->registry->output->showError( $msg, 10252 );}else if ( isset($this->lang->words[ 'err_' . $msg ]) ){$this->lang->words[ 'err_' . $msg ] = $this->lang->words[ 'err_' . $msg ];$this->lang->words['err_' . $msg ] = str_replace( '#NAMES#' , implode( ",",$messengerFunctions->exceptionData ), $this->lang->words['err_' . $msg ] );$this->lang->words[ 'err_' . $msg ] =str_replace( '#TONAME#' , $toMember['members_display_name'] ,$this->lang->words[ 'err_' . $msg ] );$this->lang->words['err_' . $msg ] = str_replace( '#FROMNAME#',$this->memberData['members_display_name'], $this->lang->words['err_' . $msg ] );$this->registry->output->showError( 'err_' . $msg, 10253 );}else if( $msg != 'CANT_SEND_TO_SELF' ){$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;$this->registry->output->showError( $_msgString, 10254 );}}} //aqui}public function sendEmail(){if ( !$this->settings['contato_gruposstaff'] ){return false;}$toMemberData = array();$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields','where' => 'visivel = 1') );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= $r['title']." ".$this->request[ $campo ].'n';}}$dep = $this->DB->build( array('select' => 'email','from' => 'contato_emails','where' => 'dep_id='.$this->request['departamento']) );$outer = $this->DB->execute();if ( $this->DB->getTotalRows( $outer ) ){while ( $r = $this->DB->fetch( $outer ) ){$toMemberData[] = $r;}}$date = $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 );foreach ( $toMemberData as $row ){IPSText::getTextClass('email')->getTemplate("email_staff");IPSText::getTextClass('email')->buildMessage( array( 'NOME' => $this->request['name'],'EMAIL' => $this->request['email'],'IP' => $this->member->ip_address,'DATA' => $date,'CUSTOMFIELDS' => $customfields,'CONTEUDO' => nl2br($this->request['mensagem'])) );IPSText::getTextClass('email')->subject = $this->settings['contato_prefixo']." ".$this->request['assunto'];IPSText::getTextClass('email')->to = $row['email'];IPSText::getTextClass('email')->from = $this->request['email'];IPSText::getTextClass('email')->sendMail();}if ( isset( $this->request['contato_copia'] ) AND $this->request['contato_copia'] == 1 ){IPSText::getTextClass('email')->getTemplate("email_copiaautor");IPSText::getTextClass('email')->buildMessage( array( 'NOME' => $this->request['name'],'EMAIL' => $this->request['email'],'IP' => $this->member->ip_address,'DATA' => $date,'CUSTOMFIELDS' => $customfields,'CONTEUDO' => nl2br($this->request['mensagem'])) );IPSText::getTextClass('email')->subject = $this->settings['contato_prefixo']." ".$this->request['assunto'];IPSText::getTextClass('email')->to = $this->request['email'];IPSText::getTextClass('email')->sendMail();}}public function messageSent(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );$this->registry->output->addNavigation( $this->lang->words['title'], '' );$this->output .= $this->registry->output->getTemplate( 'contato' )->formSent();$this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];$this->registry->output->setTitle( $this->pageTitle );$this->registry->output->addContent( $this->output );$this->registry->output->sendOutput();}}?> 

Edited by Oturo
Link to comment
Share on other sites

  • 0

edit the post and put  the code in a spoiler bbcode in a code bbcode not quote bbcode.

 

Answered this same problem here 

 

I did edit the posts as you said

 

This is the answer for the contact us version 2.1.2

 

But i unistalled the 2.1.2 and installed the 2.2.0 version and the problem now is that is showing me a error when press sent message next

 

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

Warning: Illegal string offset 'member_id' in /home/*******************/public_html/admin/applications_addon/other/contactus/modules_public/contato/form.php on line 503

 

 

I go to the file form.php and find the line 503 and it is the next one

 

    $messengerFunctions->sendNewPersonalTopic(  $row['member_id'],

 

 

The whole code of the file is the next

 <?php/*** @author -RAW-* @copyright 2012* @link http://rawcodes.net* @filesource Contact Form* @version 2.2.0*/if ( ! defined( 'IN_IPB' ) ){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 public_contactus_contato_form extends ipsCommand{protected $output = '';protected $pageTitle = '';public function doExecute( ipsRegistry $registry ){switch( $this->request['code'] ){case 'submit':$this->dosubmit();break;case 'sent':$this->messageSent();break;default:$this->form();break;}}private function form(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus', 'contactus' ) );$this->registry->getClass('class_localization')->loadLanguageFile( array( 'public_post' ), 'forums' );if ( !$this->settings['contato_systemon'] ){$this->registry->output->showError( $this->lang->words['systemoff'] );}if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['contato_grupos'] ) ) ){$this->registry->output->showError( $this->lang->words['erro_permissao'] );}if ( !$this->settings['contato_gruposstaff'] ){$this->registry->output->showError( $this->lang->words['mpnone_admin'] );}$emails = $this->DB->buildAndFetch( array( 'select' => 'id','from' => 'contato_emails') );if ( ($this->settings['contato_forma'] == 3 OR $this->settings['contato_forma'] == 4 ) AND !$emails['id'] ){$this->registry->output->showError( $this->lang->words['depemails_none_admin'] );}$this->DB->build( array('select' => 'id, nome','from' => 'contato_departamentos','order' => 'id') );$depart = $this->DB->execute();if ( $this->DB->getTotalRows( $depart ) ){while ( $r = $this->DB->fetch( $depart ) ){$dep[] = array( 'id' => $r['id'], 'title' => $r['nome'] );}}else{$this->registry->output->showError( $this->lang->words['departamentos_none_admin'] );}$regra = $this->settings['contato_regra'] == 1 AND $this->settings['contato_regratexto'] != "" ? $regra = "<p class='message'>".IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $this->settings['contato_regratexto'] ) )."</p><br />" : $regra = "";/* New just in case first id is deleted */$firstid = $this->DB->buildAndFetch( array( 'select' => 'id, nome','from' => 'contato_departamentos','order' => 'id ASC','limit' => array(0,1) ));$id = intval( $this->request['id'] );if ( !$id ){$thewhere = "department={$firstid['id']} AND visivel=1";}else{$thewhere = "department={$id} AND visivel=1";}$this->DB->build( array('select' => 'cid, title, description, obrigatorio, charlimit, cposition, department','from' => 'contato_customfields','order' => 'cposition DESC','where' => $thewhere,) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$customfields[] = array( 'id' => $r['cid'], 'title' => $r['title'], 'description' => $r['description'], 'charlimit' => $r['charlimit'], 'required' => $r['obrigatorio']);}}if ( $this->settings['contato_questions'] == 1 ){$pergunta = array();$query = $this->DB->buildAndFetch( array('select' => 'qid, question','from' => 'contato_antispam','order' => 'rand()','limit' => array(0,1)) );if ( $this->DB->getTotalRows() ){$pergunta = array( 'qid' => $query['qid'], 'question' => $query['question'] );}}if( $this->settings['contato_captcha'] ){$captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();}$this->registry->output->addNavigation( $this->lang->words['title'], '' );$this->output .= $this->registry->output->getTemplate( 'contato' )->form( $dep, $regra, $pergunta, $customfields, $captchaHTML, $firstid );/* Don't be asshole! Do not remove it! */$this->output .= '<p style="padding: 10px;font-size: 11px;position: relative;color:#848484;text-align:right;text-shadow: 0px 1px 0px #fff;">Powered by <b>(RC34) Contact Form '.$this->caches['app_cache']['contactus']['app_version'].'</b> &copy; '.date('Y').'&nbsp;&nbsp;<a target="_blank" href="http://www.rawcodes.net/">Rawcodes.net</a></p>';$this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];$this->registry->output->setTitle( $this->pageTitle );$this->registry->output->addContent( $this->output );$this->registry->output->sendOutput();}private function dosubmit(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );if ( !$this->settings['contato_systemon'] ){$this->registry->output->showError( $this->lang->words['systemoff'] );}if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['contato_grupos'] ) ) ){$this->registry->output->showError( $this->lang->words['erro_permissao'] );}if ( !$this->request['name'] ){$this->registry->output->showError( $this->lang->words[ 'no_name' ] );}if ( !$this->request['email'] ){$this->registry->output->showError( $this->lang->words[ 'no_email' ] );}if( !IPSText::checkEmailAddress( $this->request['email'] ) ){$this->registry->output->showError( $this->lang->words['no_email'] );}/* Department */if ( $this->request['departamento'] == '-1' ){$this->registry->output->showError( $this->lang->words['no_department'] );}if ( !$this->request['assunto'] ){$this->registry->output->showError( $this->lang->words[ 'no_assunto' ] );}if ( !$this->request['mensagem'] ){$this->registry->output->showError( $this->lang->words[ 'no_mensagem' ] );}if ( IPSText::mbstrlen( $this->request['mensagem'] ) < 10 ){$this->lang->words['short_mensagem'] = sprintf( $this->lang->words['short_mensagem'], $this->settings['contato_tamanho'] );$this->registry->output->showError( $this->lang->words[ 'short_mensagem' ] );}if ( IPSText::mbstrlen( $this->request['mensagem'] ) > $this->settings['contato_tamanho'] * 1024 ){$this->lang->words['post_too_long'] = sprintf( $this->lang->words['post_too_long'], $this->settings['contato_tamanho'] );$this->registry->output->showError( $this->lang->words['post_too_long'] );}/* Testar custom fields, se tiver algum com preenchimento obrigatσrio *//* o_O ok did some changes here */$id = intval( $this->request['departamento']);$this->DB->build( array('select' => '*','from' => 'contato_customfields','where' => "department={$id} AND visivel=1",) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){if ( $r['obrigatorio'] == 1 ){$campo = 'cf_'.$r["cid"];if ( empty( $this->request[ $campo ] ) ){$this->registry->output->showError( $this->lang->words['cf_obrigatorio'] );}}}}/* Testar peguntas anti-spam, se habilitado */if ( $this->settings['contato_questions'] ){if ( !$this->request['pergunta'] ){$this->registry->output->showError( $this->lang->words['antispam_branco'] );}$query = $this->DB->buildAndFetch( array( 'select' => 'answer','from' => 'contato_antispam','where' => 'qid='.$this->request['qid']) );if ( strtolower($this->request['pergunta']) != strtolower($query['answer']) ){$this->registry->output->showError( $this->lang->words['antispam_errado'] );}}/* Testar captcha, se habilitado */if ( $this->settings['contato_captcha'] ){if ( $this->registry->getClass('class_captcha')->validate() !== TRUE ){$this->registry->output->showError( $this->lang->words['captcha_errado'] );}}switch ( $this->settings['contato_forma'] ){case 1:$this->createTopic();break;case 2:$this->sendPM();break;case 3:$this->sendEmail();break;case 4:$this->createTopic();$this->sendPM();$this->sendEmail();break;}$this->registry->class_localization->loadLanguageFile( array( 'public_contactus', 'contactus' ) );$this->registry->output->redirectScreen( $this->lang->words['formulario_enviado'], $this->settings['base_url_with_app'] . "&module=contato&section=form&code=sent" );}public function createTopic(){require_once( IPSLib::getAppDir('forums') . '/sources/classes/moderate.php' );$this->moderatorLibrary = new moderatorLibrary( $this->registry );$autor = $this->settings['contato_topicauthor'] == 1 ? $this->memberData['member_id'] : $this->settings['contato_autor'];$autortopico = IPSMember::load( $autor );$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields','where' => "department={$this->request['departamento']} and visivel = 1") );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= "<b>".$r['title']."</b> ".$this->request[$campo]."<br />";}}$dep = $this->DB->buildAndFetch( array('select' => 'id, nome, forum_id','from' => 'contato_departamentos','where' => 'id='.$this->request['departamento']) );$forum_id = $dep['forum_id'];require_once( IPSLib::getAppDir('forums') . '/sources/classes/post/classPost.php' );$this->post = new classPost( $this->registry );$find = array( "{member_name}","{birth_death}" );$replace = array( $mem['members_display_name'] , $dateB . " - " . $dateD );$t_title = str_replace( $find, $replace, $this->settings['memorial_t_title'] );$this->topic = array('title' => $this->settings['contato_prefixo']." ".$this->request['assunto'],'state' => "open",'posts' => 0,'starter_id' => $autortopico['member_id'],'starter_name' => $autortopico['members_display_name'],'start_date' => time(),'last_poster_id' => $autortopico['member_id'],'last_poster_name' => $autortopico['members_display_name'],'last_post' => time(),'author_mode' => 1,'poll_state' => 0,'last_vote' => 0,'views' => 0,'forum_id' => $forum_id,'approved' => 1,'pinned' => 0);$this->DB->insert( 'topics', $this->topic );$this->topic['tid'] = $this->DB->getInsertId();$find = array( "{name}", "{email}", "{ip}", "{date}", "{customfields}", "{department}", "{content}" );$replace = array( $this->request['name'], $this->request['email'], $this->member->ip_address, $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 ), $customfields, $dep['nome'], $this->request['mensagem'] );$mensagem = str_replace( $find, $replace, $this->settings['contato_template'] );$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser' );$parser = new $classToLoad();$parser->set( array( 'parseArea' => 'contactus','memberData' => $this->memberData,'parseBBCode' => 1,'parseHtml' => 0,'parseEmoticons' => 1 ) );$post_content = $parser->display( $mensagem );/* Insert data */$post = array('author_id' => $autortopico['member_id'],'use_sig' => 1,'use_emo' => 1,'ip_address' => $autortopicor['ip_address'],'post_date' => time(),'post' => $post_content,'author_name' => $autortopico['members_display_name'],'topic_id' => $this->topic['tid'],'queued' => 0,'post_htmlstate' => 0,'post_key' => md5( microtime() ),);$this->DB->insert( 'posts', $post );$post['pid'] = $this->DB->getInsertId();$this->moderatorLibrary->rebuildTopic( $this->topic['tid'], false );$this->moderatorLibrary->forumRecount( $this->topic['forum_id'] );}public function sendPM(){if ( !$this->settings['contato_gruposstaff'] ){return false;}$toMemberData = array();$fromMemberData = array();require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );$messengerFunctions = new messengerFunctions( $this->registry );/* Algum Custom Field para ser impresso ? */$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields',//'where' => 'visivel = 1''where' => "department={$this->request['departamento']} AND visivel=1",) );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= "".$r['title']." ".$this->request[$campo]."<br />";}}$dep = $this->DB->buildAndFetch( array('select' => 'nome','from' => 'contato_departamentos','where' => 'id='.$this->request['departamento']) );$find = array( "{name}", "{email}", "{ip}", "{date}", "{customfields}", "{department}", "{content}" );$replace = array( $this->request['name'], $this->request['email'], $this->member->ip_address, $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 ), $customfields, $dep['nome'], $this->request['mensagem'] );$mensagem = str_replace( $find, $replace, $this->settings['contato_template'] );$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );$_editor = new $classToLoad();/* Parsing stuff */IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;IPSText::getTextClass( 'bbcode' )->parse_html = 0;IPSText::getTextClass( 'bbcode' )->parse_nl2br = 0;IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;IPSText::getTextClass( 'bbcode' )->parsing_section = 'contact';IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];$mensagem = IPSText::getTextClass('bbcode')->preDbParse( $mensagem );$this->DB->build( array('select' => 'member_id','from' => 'members','where' => 'member_group_id in('.$this->settings['contato_gruposstaff'].')',) );$outer = $this->DB->execute();if ( $this->DB->getTotalRows( $outer ) ){while ( $r = $this->DB->fetch( $outer ) ){$toMemberData[] = $r['member_id'];}}//-----------------------------------------// First off, load the to and from members//-----------------------------------------//$_members = IPSMember::load( array( $toMemberID, $fromMemberID ), 'groups,extendedProfile' );if(!$this->settings['contato_autor']){$author = $this->memberData['member_id'];}else{$author = $this->settings['contato_autor'];}foreach ( $toMemberData as $row ){try{$messengerFunctions->sendNewPersonalTopic( $row['member_id'],$this->memberData['member_id'],array(),$this->settings['contato_prefixo']." ".$this->request['assunto'],IPSText::getTextClass('editor')->method != 'rte' ? IPSText::br2nl($mensagem) : $mensagem,array( 'origMsgID' => 0,'fromMsgID' => 0,'postKey' => md5(microtime()),'trackMsg' => 0,'addToSentFolder' => 0,'hideCCUser' => 0,'forcePm' => 1,'isSystem' => TRUE,) );}catch( Exception $error ){$msg = $error->getMessage();$toMember = IPSMember::load( $member_id, 'groups,extendedProfile' );if ( strstr( $msg, 'BBCODE_' ) ){$msg = str_replace( 'BBCODE_', '', $msg );$this->registry->output->showError( $msg, 10252 );}else if ( isset($this->lang->words[ 'err_' . $msg ]) ){$this->lang->words[ 'err_' . $msg ] = $this->lang->words[ 'err_' . $msg ];$this->lang->words[ 'err_' . $msg ] = str_replace( '#NAMES#' , implode( ",", $messengerFunctions->exceptionData ), $this->lang->words[ 'err_' . $msg ] );$this->lang->words[ 'err_' . $msg ] = str_replace( '#TONAME#' , $toMember['members_display_name'] , $this->lang->words[ 'err_' . $msg ] );$this->lang->words[ 'err_' . $msg ] = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $this->lang->words[ 'err_' . $msg ] );$this->registry->output->showError( 'err_' . $msg, 10253 );}else if( $msg != 'CANT_SEND_TO_SELF' ){$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;$this->registry->output->showError( $_msgString, 10254 );}}} //aqui}public function sendEmail(){if ( !$this->settings['contato_gruposstaff'] ){return false;}$toMemberData = array();$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );$customfields = "";$this->DB->build( array('select' => 'cid, title','from' => 'contato_customfields','where' => 'visivel = 1') );$custom = $this->DB->execute();if ( $this->DB->getTotalRows( $custom ) ){while ( $r = $this->DB->fetch( $custom ) ){$campo = 'cf_'.$r["cid"];$customfields .= $r['title']." ".$this->request[ $campo ].'n';}}$dep = $this->DB->build( array('select' => 'email','from' => 'contato_emails','where' => 'dep_id='.$this->request['departamento']) );$outer = $this->DB->execute();if ( $this->DB->getTotalRows( $outer ) ){while ( $r = $this->DB->fetch( $outer ) ){$toMemberData[] = $r;}}$date = $this->registry->getClass('class_localization')->getDate( time(), 'LONG', 1 );foreach ( $toMemberData as $row ){IPSText::getTextClass('email')->getTemplate("email_staff");IPSText::getTextClass('email')->buildMessage( array( 'NOME' => $this->request['name'],'EMAIL' => $this->request['email'],'IP' => $this->member->ip_address,'DATA' => $date,'CUSTOMFIELDS' => $customfields,'CONTEUDO' => nl2br($this->request['mensagem'])) );IPSText::getTextClass('email')->subject = $this->settings['contato_prefixo']." ".$this->request['assunto'];IPSText::getTextClass('email')->to = $row['email'];IPSText::getTextClass('email')->from = $this->request['email'];IPSText::getTextClass('email')->sendMail();}if ( isset( $this->request['contato_copia'] ) AND $this->request['contato_copia'] == 1 ){IPSText::getTextClass('email')->getTemplate("email_copiaautor");IPSText::getTextClass('email')->buildMessage( array( 'NOME' => $this->request['name'],'EMAIL' => $this->request['email'],'IP' => $this->member->ip_address,'DATA' => $date,'CUSTOMFIELDS' => $customfields,'CONTEUDO' => nl2br($this->request['mensagem'])) );IPSText::getTextClass('email')->subject = $this->settings['contato_prefixo']." ".$this->request['assunto'];IPSText::getTextClass('email')->to = $this->request['email'];IPSText::getTextClass('email')->sendMail();}}public function messageSent(){$this->registry->class_localization->loadLanguageFile( array( 'public_contactus' ) );$this->registry->output->addNavigation( $this->lang->words['title'], '' );$this->output .= $this->registry->output->getTemplate( 'contato' )->formSent();$this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];$this->registry->output->setTitle( $this->pageTitle );$this->registry->output->addContent( $this->output );$this->registry->output->sendOutput();}}?> 

 

How i fix this error?

Edited by Oturo
Link to comment
Share on other sites

  • 0

 

 

If you want to see what may be causing it, add 

echo "<br><pre>";var_dump($toMemberData);die("here's your memberata");

 

in front of that line instead and run it once then remove that line and post the results here.

 

 

 

 

 

I add like you said and the result when run is

 

array(3) {[0]=>string(1) "1"[1]=>string(2) "64"[2]=>string(3) "218"}here's your memberata
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...