$row['user_id'] = $events[$i]['event_author_id'];
    $row['username'] = $events[$i]['event_author'];
    $row['post_username'] = $events[$i]['event_author'];
    $row['topic_time'] = $events[$i]['event_time'];
    $row['id2'] = $events[$i]['event_last_author_id'];
    $row['post_username2'] = $events[$i]['event_last_author'];
    $row['user2'] = $events[$i]['event_last_author'];
    $row['topic_last_post_id'] = $events[$i]['event_last_id'];
    $row['topic_views'] = $events[$i]['event_views'];
    $row['forum_id'] = $events[$i]['event_forum_id'];
    $row['forum_name'] = $events[$i]['event_forum_name'];
    $row['topic_calendar_time'] = $events[$i]['event_calendar_time'];
    $row['topic_calendar_duration'] = $events[$i]['event_calendar_duration'];
    $row['topic_icon'] = $events[$i]['event_icon'];
    $topic_rowset[] = $row;
}
$split_type = false;
$display_nav_tree = intval($config['calendar_forum']) == 1;
$footer = $s_forum_list . '&nbsp;<input type="submit" value="' . $lang['Go'] . '" class="liteoption" />';
topic_list('TOPIC_LIST_SCHEDULER', 'topics_list_box', $topic_rowset, $title, $split_type, $display_nav_tree, $footer);
// system
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
$s_hidden_fields .= '<input type="hidden" name="date" value="' . $date . '" />';
$s_hidden_fields .= '<input type="hidden" name="start" value="' . $start . '" />';
$nav_separator = empty($nav_separator) ? empty($lang['Nav_Separator']) ? '&nbsp;&raquo;&nbsp;' : $lang['Nav_Separator'] : $nav_separator;
$total = $topics_count;
if ($total == 0) {
    $total++;
}
$template->assign_vars(array('PAGINATION' => generate_pagination('calendar_scheduler.' . PHP_EXT . '?d=' . $date . '&amp;mode=' . $mode, $total, $config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $config['topics_per_page']) + 1, ceil($topics_count / $config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page'], 'NAV_SEPARATOR' => $nav_separator, 'S_ACTION' => append_sid('calendar_scheduler.' . PHP_EXT), 'S_HIDDEN_FIELDS' => $s_hidden_fields));
full_page_generation('calendar_scheduler_body.tpl', $lang['Calendar'], '', '');
Example #2
0
         $topic_rowset[] = $row;
     }
 }
 // topics list parameters
 $box = 'MERGE_BOX';
 $tpl = '';
 $list_title = $select_from ? $lang['Merge_topic_from'] : $lang['Merge_topic_to'];
 $split_type = true;
 $display_nav_tree = false;
 $footer = '<input type="submit" name="submit" value="' . $lang['Select'] . '" class="mainoption" />';
 $footer .= '&nbsp;<input type="submit" name="cancel" value="' . $lang['Cancel'] . '" class="liteoption" />';
 $inbox = false;
 $select_field = 'topic_selected';
 $select_type = 2;
 $select_formname = 'post';
 topic_list($box, $tpl, $topic_rowset, $list_title, $split_type, $display_nav_tree, $footer, $inbox, $select_field, $select_type, $select_formname);
 // system
 $s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
 $s_hidden_fields .= '<input type="hidden" name="topic_title" value="' . addslashes($topic_title) . '" />';
 $s_hidden_fields .= '<input type="hidden" name="from_topic" value="' . $from_topic . '" />';
 $s_hidden_fields .= '<input type="hidden" name="to_topic" value="' . $to_topic . '" />';
 $s_hidden_fields .= '<input type="hidden" name="submit" value="1" />';
 if ($shadow) {
     $s_hidden_fields .= '<input type="hidden" name="shadow" value="1" />';
 }
 if ($select_from) {
     $s_hidden_fields .= '<input type="hidden" name="select_from" value="1" />';
 }
 if ($select_to) {
     $s_hidden_fields .= '<input type="hidden" name="select_to" value="1" />';
 }
function announces_from_forums($cur = 'Root', $force_prune = false)
{
    global $db, $template, $board_config, $userdata, $phpEx, $lang, $images, $HTTP_COOKIE_VARS;
    global $tree;
    // fix and prune announces
    announces_prune($force_prune);
    // get the start point
    $type = POST_CAT_URL;
    $id = 0;
    if ($cur != 'Root') {
        $type = substr($cur, 0, 1);
        $id = intval(substr($cur, 1));
        if ($id == 0) {
            $type = POST_CAT_URL;
        }
    }
    // configuration
    $announce_index = isset($board_config['announcement_display']) ? intval($board_config['announcement_display']) : true;
    $announce_forum = isset($board_config['announcement_display_forum']) ? intval($board_config['announcement_display_forum']) : true;
    $announce = $type == POST_CAT_URL && $announce_index || $type == POST_FORUM_URL && $announce_forum;
    if (!$announce) {
        return false;
    }
    // read the forums authorized
    $auth_forum_ids = array();
    $tree_forum_ids = array();
    // get the current item selected
    $cid = $type . $id;
    // get the list of authorized forums except the current one
    for ($i = 0; $i < count($tree['id']); $i++) {
        $fid = $tree['type'][$i] . $tree['id'][$i];
        if ($fid != $cid && $tree['type'][$i] == POST_FORUM_URL && $tree['auth'][$fid]['auth_read']) {
            $auth_forum_ids[] = $tree['id'][$i];
        }
    }
    // no forums authed, return an error
    if (empty($auth_forum_ids)) {
        return false;
    }
    // get auth key
    $keys = array();
    $keys = get_auth_keys($cur, true, -1, -1, 'auth_read');
    $tree_forum_ids = array();
    for ($i = 1; $i < count($keys['id']); $i++) {
        $idx = $keys['idx'][$i];
        $fid = $keys['id'][$i];
        if ($fid != $cid && $tree['type'][$idx] == POST_FORUM_URL && $tree['auth'][$fid]['auth_read']) {
            $tree_forum_ids[] = $tree['id'][$idx];
        }
    }
    // go to root on this branch
    if (isset($tree['main'][$tree['keys'][$cur]])) {
        $fid = $tree['main'][$tree['keys'][$cur]];
        while ($fid != 'Root') {
            $idx = $tree['keys'][$fid];
            if ($fid != $cur && $tree['type'][$idx] == POST_FORUM_URL && $tree['auth'][$fid]['auth_read']) {
                $tree_forum_ids[] = $tree['id'][$idx];
            }
            $fid = isset($tree['main'][$idx]) ? $tree['main'][$idx] : 'Root';
        }
    }
    // select global
    $sql_where = '(t.topic_type=' . POST_GLOBAL_ANNOUNCE . ' AND t.forum_id IN (' . implode(', ', $auth_forum_ids) . '))';
    // select annonces
    if (!empty($tree_forum_ids)) {
        $sql_where .= ' OR (t.topic_type=' . POST_ANNOUNCE . ' AND t.forum_id IN (' . implode(', ', $tree_forum_ids) . '))';
    }
    // get topics data
    $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username, f.forum_name\n\t\t\tFROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2, " . FORUMS_TABLE . " f\n\t\t\tWHERE ({$sql_where})\n\t\t\t\tAND t.topic_poster = u.user_id\n\t\t\t\tAND p.post_id = t.topic_last_post_id\n\t\t\t\tAND p.poster_id = u2.user_id\n\t\t\t\tAND f.forum_id = t.forum_id\n\t\t\tORDER BY t.topic_type DESC, t.topic_last_post_id DESC ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result)) {
        $row['topic_id'] = POST_TOPIC_URL . $row['topic_id'];
        $topic_rowset[] = $row;
    }
    $db->sql_freeresult($result);
    if (count($topic_rowset) <= 0) {
        return false;
    }
    // send the list
    $footer = '';
    $allow_split_type = intval($board_config['announcement_split']) == 1;
    $display_nav_tree = intval($board_config['announcement_forum']) == 1;
    $inbox = false;
    topic_list('BOARD_ANNOUNCES', 'topics_list_box', $topic_rowset, $lang['Board_announcement'], $allow_split_type, $display_nav_tree, $footer, $inbox);
}
 $footer = $lang['Submit_period'] . ':&nbsp;' . $select_msg_days;
 $footer .= '&nbsp;<input type="submit" class="liteoption" name="submitperiod" value="' . $lang['Go'] . '" />';
 if (!empty($topic_rowset)) {
     $footer .= '&nbsp;&nbsp;&nbsp;<input type="submit" name="submit_unwatched" class="liteoption" value="' . $lang['Stop_watching_selected_topics'] . '" />';
 }
 // save template state
 $sav_tpl = $template->_tpldata;
 // send the list
 $list_title = $lang['New_subscribed_topic'];
 $split_type = true;
 $display_nav_tree = true;
 $inbox = false;
 $select_field = 'select_unwatch';
 $select_type = 1;
 $select_formname = 'post';
 topic_list('_topics_watched_box', 'topics_list_box', $topic_rowset, $list_title, $split_type, $display_nav_tree, $footer, $inbox, $select_field, $select_type, $select_formname, $select_unwatched);
 // get back the result
 $res = $template->_tpldata['.'][0]['_topics_watched_box'];
 // restore template saved state
 $template->_tpldata = $sav_tpl;
 // init right part of the home panel
 if (!$right_part) {
     $template->assign_block_vars('right_part', array());
     $right_part = true;
 }
 // send result to template
 $template->assign_block_vars('right_part.box', array('BOX' => $res));
 // hidden fields
 $s_hidden_fields .= '<input type="hidden" name="topics_watched_start" value="' . $topics_watched_start . '" />';
 // fix pagination display bug
 if ($topics_watched_total == 0) {