if (!empty($_POST['batch_action_turnsolvedon'])) {
        d3forum_transact_turnsolvedon_in_category($mydirname, $cat_id);
    }
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}", 2, _MD_D3FORUM_MSG_CATEGORYUPDATED);
    exit;
}
if (isset($_POST['categoryman_delete']) && count($children) == 0) {
    if (!$xoopsGTicket->check(true, 'd3forum')) {
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
    }
    d3forum_delete_category($mydirname, $cat_id);
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php", 2, _MD_D3FORUM_MSG_CATEGORYDELETED);
    exit;
}
// FORM PART
include dirname(dirname(__FILE__)) . '/include/constant_can_override.inc.php';
$options4html = '';
$category_configs = @unserialize($cat_row['cat_options']);
if (is_array($category_configs)) {
    foreach ($category_configs as $key => $val) {
        if (isset($d3forum_configs_can_be_override[$key])) {
            $options4html .= htmlspecialchars($key, ENT_QUOTES) . ':' . htmlspecialchars($val, ENT_QUOTES) . "\n";
        }
    }
}
$category4assign = array('id' => $cat_id, 'title' => htmlspecialchars($cat_row['cat_title'], ENT_QUOTES), 'weight' => intval($cat_row['cat_weight']), 'desc' => htmlspecialchars($cat_row['cat_desc'], ENT_QUOTES), 'options' => $options4html, '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_category_form.html';
$xoopsTpl->assign(array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'category' => $category4assign, 'page' => 'categorymanager', 'formtitle' => _MD_D3FORUM_LINK_CATEGORYMANAGER, 'children_count' => count($children), 'cat_jumpbox_options' => d3forum_make_cat_jumpbox_options($mydirname, $whr_read4cat, $cat_row['pid']), 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'd3forum'), 'xoops_module_header' => "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . str_replace('{mod_url}', XOOPS_URL . '/modules/' . $mydirname, $xoopsModuleConfig['css_uri']) . "\" />" . $xoopsTpl->get_template_vars("xoops_module_header"), 'xoops_pagetitle' => _MD_D3FORUM_CATEGORYMANAGER, 'xoops_breadcrumbs' => array_merge($xoops_breadcrumbs, array(array('name' => _MD_D3FORUM_CATEGORYMANAGER)))));
include XOOPS_ROOT_PATH . '/footer.php';
Ejemplo n.º 2
0
    // get last visit each forums
    if ($uid > 0) {
        $sql = 'SELECT u2t.u2t_time FROM ' . $db->prefix($mydirname . '_posts') . ' p LEFT JOIN ' . $db->prefix($mydirname . '_users2topics') . ' u2t ON u2t.topic_id=p.topic_id WHERE p.post_id=' . intval($forum_row['forum_last_post_id']) . ' AND u2t.uid=' . $uid;
        list($u2t_time) = $db->fetchRow($db->query($sql));
    }
    if (empty($u2t_time)) {
        $u2t_time = 0;
    }
    // get last poster's object
    $user_handler =& xoops_gethandler('user');
    $last_poster_obj =& $user_handler->get(intval($forum_row['uid']));
    if (is_object($last_poster_obj)) {
        // naao from
        //$last_post_uname = $last_poster_obj->getVar( 'uname' ) ;
        if ($xoopsModuleConfig['use_name'] == 1 && $last_poster_obj->getVar('name')) {
            $last_post_uname = $last_poster_obj->getVar('name');
        } else {
            $last_post_uname = $last_poster_obj->getVar('uname');
        }
        // naao to
    } else {
        $last_post_uname = $xoopsConfig['anonymous'];
    }
    // forums array
    $forums[] = array('id' => $forum_row['forum_id'], 'title' => $myts->makeTboxData4Show($forum_row['forum_title']), 'desc' => $myts->displayTarea($forum_row['forum_desc']), 'external_link_format' => htmlspecialchars($forum_row['forum_external_link_format'], ENT_QUOTES), 'topics_count' => intval($forum_row['forum_topics_count']), 'posts_count' => intval($forum_row['forum_posts_count']), 'last_post_time' => intval($forum_row['forum_last_post_time']), 'last_post_time_formatted' => formatTimestamp($forum_row['forum_last_post_time'], 'm'), 'last_post_id' => intval($forum_row['forum_last_post_id']), 'bit_new' => $forum_row['forum_last_post_time'] > $u2t_time && !empty($forum_row['forum_topics_count']) ? 1 : 0, 'last_post_icon' => intval($forum_row['icon']), 'last_post_subject' => $myts->makeTboxData4Show($forum_row['subject']), 'last_post_uid' => intval($forum_row['uid']), 'last_post_uname' => htmlspecialchars($last_post_uname), 'last_post_gname' => htmlspecialchars($forum_row['guest_name']), 'moderate_groups' => d3forum_get_forum_moderate_groups4show($mydirname, $forum_row['forum_id']), 'moderate_users' => d3forum_get_forum_moderate_users4show($mydirname, $forum_row['forum_id']), 'can_post' => (bool) $forum_permissions[$forum_row['forum_id']]['can_post'], 'isadminormod' => (bool) $forum_permissions[$forum_id]['is_moderator'] || $isadmin);
}
$xoopsOption['template_main'] = $mydirname . '_main_listforums.html';
include XOOPS_ROOT_PATH . '/header.php';
unset($xoops_breadcrumbs[sizeof($xoops_breadcrumbs) - 1]['url']);
$xoopsTpl->assign(array('total_topics_count' => $total_topics_count, 'total_posts_count' => $total_posts_count, 'lastvisit' => $last_visit, 'lastvisit_formatted' => formatTimestamp($last_visit, 'm'), 'currenttime' => time(), 'currenttime_formatted' => formatTimestamp(time(), 'm'), 'forums' => $forums, 'cat_jumpbox_options' => d3forum_make_cat_jumpbox_options($mydirname, $whr_read4cat, $cat_id), 'subcategories' => $subcategories, 'category' => $category4assign, 'page' => 'listforums', 'xoops_pagetitle' => join(' - ', array($category4assign['title'], $xoopsModule->getVar('name'))), 'xoops_breadcrumbs' => $xoops_breadcrumbs));
    if (!(include dirname(dirname(__FILE__)) . '/include/process_this_category.inc.php')) {
        die(_MD_D3FORUM_ERR_READCATEGORY);
    }
}
// special check for makecategory
if (!$isadmin) {
    die(_MD_D3FORUM_ERR_CREATECATEGORY);
}
// TRANSACTION PART
// permissions will be set same as the parent category. (also moderator)
require_once dirname(dirname(__FILE__)) . '/include/transact_functions.php';
if (isset($_POST['categoryman_post'])) {
    // create a record for category and category_access
    $new_cat_id = d3forum_makecategory($mydirname, $cat_id);
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}", 2, _MD_D3FORUM_MSG_CATEGORYMADE);
    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";
    }
}
$category4assign = 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_category_form.html';
$xoopsTpl->assign(array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'category' => $category4assign, 'page' => 'makecategory', 'formtitle' => _MD_D3FORUM_LINK_MAKECATEGORY, 'cat_jumpbox_options' => d3forum_make_cat_jumpbox_options($mydirname, $whr_read4cat, $cat_id), 'xoops_module_header' => "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . str_replace('{mod_url}', XOOPS_URL . '/modules/' . $mydirname, $xoopsModuleConfig['css_uri']) . "\" />" . $xoopsTpl->get_template_vars("xoops_module_header"), 'xoops_pagetitle' => _MD_D3FORUM_LINK_MAKECATEGORY, 'xoops_breadcrumbs' => array_merge($xoops_breadcrumbs, array(array('name' => _MD_D3FORUM_LINK_MAKECATEGORY)))));
include XOOPS_ROOT_PATH . '/footer.php';