Example #1
0
         // Notify for newtopic
         d3forum_trigger_event($mydirname, 'global', 0, 'newtopic', $tags, $users2notify);
         d3forum_trigger_event($mydirname, 'category', $cat_id, 'newtopic', $tags, $users2notify);
         d3forum_trigger_event($mydirname, 'forum', $forum_id, 'newtopic', $tags, $users2notify);
     }
     // Notify for newpost
     d3forum_trigger_event($mydirname, 'global', 0, 'newpost', $tags, $users2notify);
     d3forum_trigger_event($mydirname, 'category', $cat_id, 'newpost', $tags, $users2notify);
     d3forum_trigger_event($mydirname, 'forum', $forum_id, 'newpost', $tags, $users2notify);
     d3forum_trigger_event($mydirname, 'topic', $topic_id, 'newpost', $tags, $users2notify);
     // special event (the meaning of "ALL&FULL POSTS" contains self-post)
     d3forum_trigger_event($mydirname, 'global', 0, 'newpostfull', $tags, $users2notify, 0);
 }
 if (!empty($need_admin_notify)) {
     // Notify for new waiting approval
     d3forum_trigger_event($mydirname, 'global', 0, 'waiting', $tags, $users2notify);
 }
 // If user checked notification box, subscribe them to the
 // appropriate event; if unchecked, then unsubscribe
 if (!empty($xoopsUser) && !empty($xoopsModuleConfig['notification_enabled']) && in_array('topic-newpost', @$xoopsModuleConfig['notification_events'])) {
     if (!empty($_POST['notify'])) {
         $notification_handler->subscribe('topic', $topic_id, 'newpost');
     } else {
         $notification_handler->unsubscribe('topic', $topic_id, 'newpost');
     }
 }
 // topic_solved of the topic
 if (empty($xoopsModuleConfig['use_solved'])) {
     $db->query("UPDATE " . $db->prefix($mydirname . "_topics") . " SET topic_solved=1 WHERE topic_id={$topic_id}");
 } else {
     if ($isadminormod) {
    if (!$isadmin) {
        $_POST['options'] = '';
        $_POST['weight'] = 0;
    }
    // create a record for forum and forum_access
    list($forum_id, $forum_title) = d3forum_makeforum($mydirname, $cat_id, $isadmin);
    // Define tags for notification message
    $tags = array('FORUM_TITLE' => $forum_title, 'FORUM_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?forum_id={$forum_id}", 'CAT_TITLE' => $cat_row['cat_title'], 'CAT_URL' => XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}");
    // Notify for newforum
    $notification_handler =& xoops_gethandler('notification');
    $users2notify = d3forum_get_users_can_read_forum($mydirname, $forum_id, $cat_id);
    if (empty($users2notify)) {
        $users2notify = array(0);
    }
    d3forum_trigger_event($mydirname, 'global', 0, 'newforum', $tags, $users2notify);
    d3forum_trigger_event($mydirname, 'category', $cat_id, 'newforum', $tags, $users2notify);
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}", 2, _MD_D3FORUM_MSG_FORUMMADE);
    exit;
}
// FORM PART
include dirname(dirname(__FILE__)) . '/include/constant_can_override.inc.php';
$options4html = '';
foreach ($xoopsModuleConfig as $key => $val) {
    if (isset($d3forum_configs_can_be_override[$key])) {
        $options4html .= htmlspecialchars($key, ENT_QUOTES) . ':' . htmlspecialchars($val, ENT_QUOTES) . "\n";
    }
}
$forum4assign = array('id' => 0, 'title' => '', 'weight' => 0, 'desc' => '', 'options' => '', 'option_desc' => d3forum_main_get_categoryoptions4edit($d3forum_configs_can_be_override));
// dare to set 'template_main' after header.php (for disabling cache)
include XOOPS_ROOT_PATH . "/header.php";
$xoopsOption['template_main'] = $mydirname . '_main_forum_form.html';