$security_error = true; } $res = icms::$xoopsDB->query("SELECT COUNT(*) FROM " . icms::$xoopsDB->prefix("users") . " WHERE uid='". (int) ($_POST['to_userid']) . "'"); list($count) = icms::$xoopsDB->fetchRow($res); if ($count != 1) { echo "<br /><br /><div><h4>" . _PM_USERNOEXIST . "<br />" . _PM_PLZTRYAGAIN . "</h4><br />"; if (isset($security_error) && $security_error == true) { echo implode('<br />', icms::$security->getErrors()); } echo "[ <a href='javascript:history.go(-1)'>" . _PM_GOBACK . "</a> ]</div>"; } else { $pm_handler = icms::handler('icms_data_privmessage'); $pm =& $pm_handler->create(); $pm->setVar("subject", icms_core_DataFilter::filterTextareaInput($_POST['subject'])); $pm->setVar("msg_text", icms_core_DataFilter::filterHTMLinput($_POST['message'], TRUE, TRUE, TRUE)); $pm->setVar("to_userid", (int) ($_POST['to_userid'])); $pm->setVar("from_userid", (int) (icms::$user->getVar("uid"))); if (!$pm_handler->insert($pm)) { echo $pm->getHtmlErrors() . "<br /><a href='javascript:history.go(-1)'>" . _PM_GOBACK . "</a>"; } else { // Send a Private Message email notification $userHandler = icms::handler('icms_member_user'); $toUser =& $userHandler->get((int) ($_POST['to_userid'])); // Only send email notif if notification method is mail if ($toUser->getVar('notify_method') == 2) { $xoopsMailer = new icms_messaging_Handler(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($toUser->getVar('email'));