if (!$faqObj->store()) { redirect_header("javascript:history.go(-1)", 3, _MD_SF_SUBMIT_ERROR . sf_formatErrors($faqObj->getErrors())); exit; } // Storing the answer object in the database if (!$newAnswerObj->store()) { redirect_header("javascript:history.go(-1)", 3, _MD_SF_SUBMIT_ERROR . sf_formatErrors($newAnswerObj->getErrors())); exit; } $notification_handler =& xoops_gethandler('notification'); switch ($notifCase) { case 1: // Question submitted, auto-approved; became Q&A, auto-approved // We do not not subscribe user to notification on publish since we publish it right away // Send notifications $faqObj->sendNotifications(array(_SF_NOT_FAQ_PUBLISHED)); break; case 2: // Answer for an open question submitted, auto-approved; became Q&A, need approbation if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; $notification_handler->subscribe('faq', $faqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); } // Send notifications $faqObj->sendNotifications(array(_SF_NOT_FAQ_SUBMITTED)); break; case 3: // Answer submitted, needs approbation if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; $notification_handler->subscribe('question', $newAnswerObj->answerid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
$notifToDo_answer = array(_SF_NOT_ANSWER_APPROVED); break; } // Storing the FAQ object in the database if (!$faqObj->store()) { redirect_header("javascript:history.go(-1)", 2, _AM_SF_ERROR_FAQ_NOT_SAVED); exit; } // Storing the answer object in the database if (!$answerObj->store()) { redirect_header("javascript:history.go(-1)", 2, _AM_SF_ERROR_ANSWER_NOT_SAVED); exit; } // Send FAQ notifications if (!empty($notifToDo_faq)) { $faqObj->sendNotifications($notifToDo_faq); } // Send answer notifications if (!empty($notifToDo_answer)) { $answerObj->sendNotifications($notifToDo_answer); } redirect_header("index.php", 2, $redirect_msg); exit; break; case "del": global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB; $faqid = isset($_POST['faqid']) ? intval($_POST['faqid']) : 0; $faqid = isset($_GET['faqid']) ? intval($_GET['faqid']) : $faqid; $answerid = isset($_POST['answerid']) ? intval($_POST['answerid']) : 0; $answerid = isset($_GET['answerid']) ? intval($_GET['answerid']) : $answerid; $confirm = isset($_POST['confirm']) ? intval($_POST['confirm']) : 0;