Exemplo n.º 1
0
function forums_news()
{
    require_once AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = 'SELECT E.approved, E.last_cid, C.* FROM ' . TABLE_PREFIX . 'course_enrollment E, ' . TABLE_PREFIX . 'courses C WHERE C.course_id in ' . $enrolled_courses . '  AND E.member_id=' . $_SESSION['member_id'] . ' AND E.course_id=C.course_id ORDER BY C.title';
    $rows_en_courses = queryDB($sql, array());
    if (count($rows_en_courses) > 0) {
        foreach ($rows_en_courses as $row) {
            $all_forums = get_forums($row['course_id']);
            if (is_array($all_forums)) {
                foreach ($all_forums as $forums) {
                    if (is_array($forums)) {
                        foreach ($forums as $forum_obj) {
                            $forum_obj['course_id'] = $row['course_id'];
                            $link_title = $forum_obj['title'];
                            $news[] = array('time' => $forum_obj['last_post'], 'object' => $forum_obj, 'alt' => _AT('forum'), 'thumb' => 'images/pin.png', 'course' => $system_courses[$row['course_id']]['title'], 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'pu=' . urlencode('mods/_standard/forums/forum/index.php?fid=' . $forum_obj['forum_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'forums.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'forums.title') . '</a>');
                        }
                    }
                }
            }
        }
    }
    return $news;
}
 public function get_foruns_id($username, $password, $course_code)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $course_db = CourseManager::get_course_information($course_code);
         $foruns_info = get_forums($id = '', $course_db['code']);
         $foruns_id = '#';
         foreach ($foruns_info as $forum) {
             if (isset($forum['forum_id'])) {
                 $foruns_id .= $forum['forum_id'] . "#";
             }
         }
         return $foruns_id;
     } else {
         return get_lang('InvalidId');
     }
 }
Exemplo n.º 3
0
function forums_news()
{
    global $db, $enrolled_courses, $system_courses;
    $news = array();
    if ($enrolled_courses == '') {
        return $news;
    }
    $sql = 'SELECT E.approved, E.last_cid, C.* FROM ' . TABLE_PREFIX . 'course_enrollment E, ' . TABLE_PREFIX . 'courses C WHERE C.course_id in ' . $enrolled_courses . '  AND E.member_id=' . $_SESSION['member_id'] . ' AND E.course_id=C.course_id ORDER BY C.title';
    $rows_en_courses = queryDB($sql, array());
    if (count($rows_en_courses) > 0) {
        foreach ($rows_en_courses as $row) {
            $all_forums = get_forums($row['course_id']);
            if (is_array($all_forums)) {
                foreach ($all_forums as $forums) {
                    if (is_array($forums)) {
                        foreach ($forums as $forum_obj) {
                            $latest_post = get_last_post($forum_obj['forum_id']);
                            $forum_obj['course_id'] = $row['course_id'];
                            $link_title = $forum_obj['title'];
                            // attached the first 120 characters of the message to the news item
                            if (strlen($latest_post[0]['body']) > 120) {
                                $last_post = substr($latest_post[0]['body'], 0, 120) . '...';
                            } else {
                                $last_post = $latest_post[0]['body'];
                            }
                            // if this is the only message in a thread, replace parent_id with the post_id
                            if ($latest_post[0]['parent_id'] == 0) {
                                $latest_post[0]['parent_id'] = $latest_post[0]['post_id'];
                            }
                            if ($latest_post[0]['subject'] != '') {
                                $news[] = array('time' => $forum_obj['last_post'], 'object' => $forum_obj, 'alt' => _AT('forum'), 'thumb' => 'images/pin.png', 'course' => $system_courses[$row['course_id']]['title'], 'link' => '<a href="bounce.php?course=' . $row['course_id'] . SEP . 'pu=' . urlencode('mods/_standard/forums/forum/view.php?fid=' . $forum_obj['forum_id'] . SEP . 'pid=' . $latest_post[0]['parent_id']) . '"' . (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="' . AT_print($link_title, 'forums.title') . '"' : '') . '>' . AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'forums.title') . ': ' . $latest_post[0]['subject'] . ' </a> - ' . $last_post);
                            }
                        }
                    }
                }
            }
        }
    }
    return $news;
}
Exemplo n.º 4
0
    /**
     * Creates a list with all the forums in it
     *
     * @return string
     */
    function get_forums()
    {
        global $charset;
        include '../forum/forumfunction.inc.php';
        include '../forum/forumconfig.inc.php';
        global $table_forums, $table_threads, $table_posts, $table_item_property, $table_users;
        $table_forums = Database::get_course_table(TABLE_FORUM);
        $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
        $table_posts = Database::get_course_table(TABLE_FORUM_POST);
        $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
        $table_users = Database::get_main_table(TABLE_MAIN_USER);
        $a_forums = get_forums();
        /* 	$return .= '<div class="lp_resource_header"' . " onclick=\"if(document.getElementById('forums').style.display == 'block') {document.getElementById('forums').style.display = 'none';} else {document.getElementById('forums').style.display = 'block';}\"" . '><img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />' . get_lang('Forums') . '</div>';
            $return .= '<div class="lp_resource_elements"  style="border:1px solid #999999;" id="forums">'; */
        $forum_lang_var = api_convert_encoding(get_lang('Forum'), $charset, api_get_system_encoding());
        $close_lang_var = api_convert_encoding(get_lang('Close'), $charset, api_get_system_encoding());
        $return = '<a href="#" onclick="javascript:popup(\'popUpDiv2\');" class="big_button four_buttons rounded grey_border forum_button">' . $forum_lang_var . '</a>';
        $return .= '<div id="popUpDiv2" class="popUpDiv author_popup gradient rounded_10 grey_border" style="display:none;">' . '<span class="title">' . $forum_lang_var . '</span>' . '<a href="#" onclick="javascript:popup(\'popUpDiv2\');" class="close">' . $close_lang_var . '</a>';
        // TODO use get_lang()
        $return .= '<div id="resDoc" class="content" >';
        $return .= '<script type="text/javascript">
						function toggle_forum(forum_id){
							if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
								document.getElementById("forum_"+forum_id+"_content").style.display = "block";
								document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
							}
							else {
								document.getElementById("forum_"+forum_id+"_content").style.display = "none";
								document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
							}
						}
					</script>
					';
        foreach ($a_forums as $forum) {
            $return .= '<div class="lp_resource_element">';
            if (!empty($forum['forum_id'])) {
                $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholdericon actionforum ', 'style' => 'margin-right:5px;', 'title' => ''));
                $return .= '<a style="cursor:hand" onclick="toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle"><img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" /></a>
									<a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_FORUM . '&amp;forum_id=' . $forum['forum_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . api_convert_encoding($forum['forum_title'], $charset, api_get_system_encoding()) . '</a><ul style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
            }
            $a_threads = get_threads($forum['forum_id']);
            if (is_array($a_threads)) {
                foreach ($a_threads as $thread) {
                    $return .= '<li><a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_THREAD . '&amp;thread_id=' . $thread['thread_id'] . '&amp;lp_id=' . $this->lp_id . '">' . api_convert_encoding($thread['thread_title'], $charset, api_get_system_encoding()) . '</a></li>';
                }
            }
            $return .= '</ul></div>';
        }
        $return .= '<br/>';
        $return .= '<div class="lp_resource_element">';
        $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholdericon actionnewlist', 'style' => 'margin-right:5px;', 'title' => ''));
        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&amp;content=forum&lp_id=' . $this->lp_id . '" title="' . api_convert_encoding(get_lang('CreateANewForum')) . '">' . api_convert_encoding(get_lang('CreateANewForum'), $charset, api_get_system_encoding()) . '</a>';
        $return .= '</div>';
        $return .= '</div>';
        $return .= '</div>';
        // ending div#popUpDiv2
        return $return;
    }
Exemplo n.º 5
0
}
get_whats_new();
$whatsnew_post_info = Session::read('whatsnew_post_info');
/* TRACKING */
Event::event_access_tool(TOOL_FORUM);
/*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
    note: we do this here just after het handling of the actions to be
    sure that we already incorporate the latest changes
*/
// Step 1: We store all the forum categories in an array $forum_categories.
$forumCategories = get_forum_categories();
// Step 2: We find all the forums (only the visible ones if it is a student).
// display group forum in general forum tool depending to configuration option
$setting = api_get_setting('display_groups_forum_in_general_tool');
$forum_list = get_forums('', '', $setting == 'true');
$user_id = api_get_user_id();
/* RETRIEVING ALL GROUPS AND THOSE OF THE USER */
// The groups of the user.
$groups_of_user = array();
$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id);
// All groups in the course (and sorting them as the
// id of the group = the key of the array).
if (!api_is_anonymous()) {
    $all_groups = GroupManager::get_group_list();
    if (is_array($all_groups)) {
        foreach ($all_groups as $group) {
            $all_groups[$group['id']] = $group;
        }
    }
}
if ($action_forums == 'notify' && isset($_GET['content']) && isset($_GET['id'])) {
    $return_message = set_notification($_GET['content'], $_GET['id']);
    Display::display_confirmation_message($return_message, false);
}
if ($action_forums != 'add') {
    /*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
    Note: We do this here just after het handling of the actions to be sure that we already incorporate the
    latest changes.
    */
    // Step 1: We store all the forum categories in an array $forum_categories.
    $forum_categories = array();
    $forum_category = get_forum_categories($_GET['forumcategory']);
    // Step 2: We find all the forums.
    $forum_list = array();
    $forum_list = get_forums();
    /* RETRIEVING ALL GROUPS AND THOSE OF THE USER */
    // The groups of the user.
    $groups_of_user = array();
    $groups_of_user = GroupManager::get_group_ids($_course['real_id'], $_user['user_id']);
    // All groups in the course (and sorting them as the id of the group = the key of the array.
    $all_groups = GroupManager::get_group_list();
    if (is_array($all_groups)) {
        foreach ($all_groups as $group) {
            $all_groups[$group['id']] = $group;
        }
    }
    /* CLEAN GROUP ID FOR AJAXFILEMANAGER */
    if (isset($_SESSION['_gid'])) {
        unset($_SESSION['_gid']);
    }
Exemplo n.º 7
0
 /**
  * Creates a list with all the forums in it
  * @return string
  */
 public function get_forums()
 {
     require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
     require_once api_get_path(SYS_CODE_PATH) . 'forum/forumconfig.inc.php';
     $a_forums = get_forums();
     $return = '<ul class="lp_resource">';
     //First add link
     $return .= '<li class="lp_resource_element">';
     $return .= Display::return_icon('forum_new_small.gif');
     $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&amp;content=forum&amp;origin=learnpath&amp;lp_id=' . $this->lp_id . '" title="' . get_lang('CreateANewForum') . '">
                 ' . get_lang('CreateANewForum') . '</a>';
     $return .= '</li>';
     $return .= '<script>
                 function toggle_forum(forum_id){
                     if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
                         document.getElementById("forum_"+forum_id+"_content").style.display = "block";
                         document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
                     } else {
                         document.getElementById("forum_"+forum_id+"_content").style.display = "none";
                         document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
                     }
                 }
             </script>';
     foreach ($a_forums as $forum) {
         $return .= '<li class="lp_resource_element" data_id="' . $forum['forum_id'] . '" data_type="' . TOOL_FORUM . '" title="' . $forum['forum_title'] . '" >';
         if (!empty($forum['forum_id'])) {
             $return .= '<a class="moved" href="#">';
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
             $return .= ' </a>';
             $return .= Display::return_icon('lp_forum.gif');
             $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
                             <img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
                         </a>
                         <a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;action=add_item&amp;type=' . TOOL_FORUM . '&amp;forum_id=' . $forum['forum_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . Security::remove_XSS($forum['forum_title']) . '</a>';
         }
         $return .= '</li>';
         $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
         $a_threads = get_threads($forum['forum_id']);
         if (is_array($a_threads)) {
             foreach ($a_threads as $thread) {
                 $return .= '<li class="lp_resource_element" data_id="' . $thread['thread_id'] . '" data_type="' . TOOL_THREAD . '" title="' . $thread['thread_title'] . '" >';
                 $return .= '&nbsp;<a class="moved" href="#">';
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
                 $return .= ' </a>';
                 $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
                 $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;action=add_item&amp;type=' . TOOL_THREAD . '&amp;thread_id=' . $thread['thread_id'] . '&amp;lp_id=' . $this->lp_id . '">' . Security::remove_XSS($thread['thread_title']) . '</a>';
                 $return .= '</li>';
             }
         }
         $return .= '</div>';
     }
     $return .= '</ul>';
     return $return;
 }
Exemplo n.º 8
0
if (isset($_GET['edit'], $_GET['id'])) {
    header('Location: forum_edit.php?forum=' . $_GET['id']);
    exit;
} else {
    if (isset($_GET['delete'], $_GET['id'])) {
        header('Location: forum_delete.php?forum=' . $_GET['id']);
        exit;
    } else {
        if (isset($_GET['delete']) || isset($_GET['edit'])) {
            $msg->addError('NO_ITEM_SELECTED');
        }
    }
}
include AT_INCLUDE_PATH . '../mods/_standard/forums/lib/forums.inc.php';
require AT_INCLUDE_PATH . 'header.inc.php';
$all_forums = get_forums(0);
$num_shared = count($all_forums['shared']);
$num_nonshared = count($all_forums['nonshared']);
$shared_forums = array();
$i = 0;
if ($num_shared) {
    foreach ($all_forums['shared'] as $forum) {
        $shared_forums[$i]["id"] = $forum['forum_id'];
        $shared_forums[$i]["title"] = AT_print($forum['title'], 'forums.title');
        $shared_forums[$i]["desc"] = AT_print($forum['description'], 'forums.description');
        $courses = array();
        //create an empty array
        $sql = "SELECT F.course_id FROM " . TABLE_PREFIX . "forums_courses F WHERE F.forum_id={$forum['forum_id']}";
        $c_result = mysql_query($sql, $db);
        while ($course = mysql_fetch_assoc($c_result)) {
            $courses[] = $system_courses[$course['course_id']]['title'];
Exemplo n.º 9
0
/**
 * @param string $user_id
 * @param int $courseId
 * @param int $sessionId
 *
 * @return array
 */
function getForumCreatedByUser($user_id, $courseId, $sessionId)
{
    $items = api_get_item_property_list_by_tool_by_user($user_id, 'forum', $courseId, $sessionId);
    $courseInfo = api_get_course_info_by_id($courseId);
    $forumList = array();
    if (!empty($items)) {
        foreach ($items as $forum) {
            $forumInfo = get_forums($forum['ref'], $courseInfo['code'], true, $sessionId);
            $forumList[] = array($forumInfo['forum_title'], api_get_local_time($forum['insert_date']), api_get_local_time($forum['lastedit_date']));
        }
    }
    return $forumList;
}
Exemplo n.º 10
0
?>
" />
<input type="hidden" name="pid" value="<?php 
echo $_REQUEST['pid'];
?>
" />
<input type="hidden" name="ppid" value="<?php 
echo $_REQUEST['ppid'];
?>
" />

<div class="input-form">
	<div class="row">
		<?php 
echo _AT('move_thread_to');
$all_forums = get_forums($_SESSION['course_id']);
?>
		<ul style="list-style: none">
		<?php 
foreach ($all_forums['nonshared'] as $row) {
    ?>
			<li>
				<input type="radio" name="new_fid" value="<?php 
    echo $row['forum_id'];
    ?>
" id="f<?php 
    echo $row['forum_id'];
    ?>
" <?php 
    if ($row['forum_id'] == $_REQUEST['fid']) {
        echo 'checked="checked"';
Exemplo n.º 11
0
    $return_message = set_notification($_GET['content'], $_GET['id']);
    Display::display_confirmation_message($return_message, false);
}
get_whats_new();
$whatsnew_post_info = Session::read('whatsnew_post_info');
/* TRACKING */
Event::event_access_tool(TOOL_FORUM);
/*
    RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS
    note: we do this here just after het handling of the actions to be sure that we already incorporate the
    latest changes
*/
// Step 1: We store all the forum categories in an array $forum_categories.
$forumCategories = get_forum_categories();
// Step 2: We find all the forums (only the visible ones if it is a student).
$forum_list = get_forums('', '', apiGetDisplayGroupsForumInGeneralTool());
$user_id = api_get_user_id();
/* RETRIEVING ALL GROUPS AND THOSE OF THE USER */
// The groups of the user.
$groups_of_user = array();
$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id);
// All groups in the course (and sorting them as the id of the group = the key of the array).
if (!api_is_anonymous()) {
    $all_groups = GroupManager::get_group_list();
    if (is_array($all_groups)) {
        foreach ($all_groups as $group) {
            $all_groups[$group['id']] = $group;
        }
    }
}
/* CLEAN GROUP ID FOR AJAXFILEMANAGER */
Exemplo n.º 12
0
function get_forums($parentid = -1, &$forums)
{
    global $vbulletin, $db, $foruminfo, $forumperms, $threadinfo, $postinfo, $vbphrase;
    if (empty($vbulletin->iforumcache)) {
        // get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
        cache_ordered_forums(0, 1);
    }
    if (is_array($vbulletin->iforumcache[$parentid])) {
        foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
            $forumperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
            if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
                continue;
            } else {
                // set $forum from the $vbulletin->forumcache
                $forum = $vbulletin->forumcache["{$forumid}"];
                $optionvalue = $forumid;
                $optiontitle = $forum[title];
                $ok = true;
                if ($forum['link']) {
                    $ok = false;
                } else {
                    if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'])) {
                        $ok = false;
                    } else {
                        if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) {
                            $ok = false;
                        }
                    }
                }
                if ($ok) {
                    $forums[] = array('id' => $forumid, 'title' => prepare_utf8_string($optiontitle));
                }
                get_forums($forumid, $forums);
            }
            // if can view
        }
        // end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)
    }
}
Exemplo n.º 13
0
/**
 * This function gets all the post written by an user
 * @param int user id
 * @param string db course name
 * @return string
 */
function get_all_post_from_user($user_id, $course_code)
{
    $j = 0;
    $forums = get_forums('', $course_code);
    krsort($forums);
    $forum_results = '';
    foreach ($forums as $forum) {
        if ($forum['visibility'] == 0) {
            continue;
        }
        if ($j <= 4) {
            $threads = get_threads($forum['forum_id'], $course_code);
            if (is_array($threads)) {
                $i = 0;
                $hand_forums = '';
                $post_counter = 0;
                foreach ($threads as $thread) {
                    if ($thread['visibility'] == 0) {
                        continue;
                    }
                    if ($i <= 4) {
                        $post_list = get_thread_user_post_limit($course_code, $thread['thread_id'], $user_id, 1);
                        $post_counter = count($post_list);
                        if (is_array($post_list) && count($post_list) > 0) {
                            $hand_forums .= '<div id="social-thread">';
                            $hand_forums .= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM);
                            $hand_forums .= '&nbsp;' . Security::remove_XSS($thread['thread_title'], STUDENT);
                            $hand_forums .= '</div>';
                            foreach ($post_list as $posts) {
                                $hand_forums .= '<div id="social-post">';
                                $hand_forums .= '<strong>' . Security::remove_XSS($posts['post_title'], STUDENT) . '</strong>';
                                $hand_forums .= '<br / >';
                                $hand_forums .= Security::remove_XSS($posts['post_text'], STUDENT);
                                $hand_forums .= '</div>';
                                $hand_forums .= '<br / >';
                            }
                        }
                    }
                    $i++;
                }
                $forum_results .= '<div id="social-forum">';
                $forum_results .= '<div class="clear"></div><br />';
                $forum_results .= '<div id="social-forum-title">' . Display::return_icon('forum.gif', get_lang('Forum')) . '&nbsp;' . Security::remove_XSS($forum['forum_title'], STUDENT) . '<div style="float:right;margin-top:-35px">
                                        <a href="../forum/viewforum.php?cidReq=' . $course_code . '&amp;gidReq=&amp;forum=' . $forum['forum_id'] . ' " >' . get_lang('SeeForum') . '</a>
                                    </div></div>';
                $forum_results .= '<br / >';
                if ($post_counter > 0) {
                    $forum_results .= $hand_forums;
                }
                $forum_results .= '</div>';
            }
            $j++;
        }
    }
    return $forum_results;
}
Exemplo n.º 14
0
function private_forums_admin_page()
{
    $forums = get_forums();
    $private_forums_options = bb_get_option('private_forums_options');
    $private_forums = $private_forums_options['private_forums'];
    ?>
		<h2>Private Forums</h2>
		<form method="post" name="private_forum_form" id="private_forum_form">
			<table class="widefat">
				<thead>
					<tr>
						<th>Forum</th>
						<th>Restrict to Role</th>
					</tr>
				</thead>
				<tbody>
					<?php 
    foreach ($forums as $forum) {
        ?>
						<tr>
							<td><label for="private_forums_<?php 
        echo $forum->forum_id;
        ?>
"><?php 
        echo $forum->forum_name;
        ?>
</label></td>
							<td><?php 
        private_forums_display_role_dropdown('private_forums', $forum->forum_id, $private_forums[$forum->forum_id]);
        ?>
</td>
						</tr>
						<?php 
    }
    ?>
				</tbody>
			</table>
			<p class="submit"><input type="submit" name="submit" value="Submit"></p>
		<h2>Privacy Options</h2>
		<?php 
    $checked = "checked='checked'";
    if ('SHOW_PRIVATE' == private_forums_custom_get_options('hide_show_flag')) {
        $sp = $checked;
    } else {
        $h = $checked;
    }
    ?>
			<p>
				<input type="radio" id="hide_show_flag_1" name="hide_show_flag" value="HIDE" <?php 
    echo $h;
    ?>
/> <label for="hide_show_flag_1">Hide Private Forums and Topics</label>
			</p>
			<p>
				<input type="radio" id="hide_show_flag_2" name="hide_show_flag" value="SHOW_PRIVATE" <?php 
    echo $sp;
    ?>
/>
				<label for="hide_show_flag_2">Mark Private Forums and Topics with</label>
				<input type="text" onfocus="document.private_forum_form.hide_show_flag[1].checked=true"
				name="private_text"
				value="<?php 
    $text = private_forums_custom_get_options('private_text');
    if (empty($text) && 'SHOW_PRIVATE' == private_forums_custom_get_options('hide_show_flag')) {
        echo 'private';
    } else {
        echo private_forums_custom_get_options('private_text');
    }
    ?>
"/>
			</p>
			<p class="submit"><input type="submit" name="submit" value="Submit"></p>
		<h2>Error Options</h2>

			<p>When a user tries to access a private forum without having access
			he will be redirected to a error page with the following text.</p>
			<p><strong>Usage:</strong><br/>
				<ul>
					<li>Use '%s' for the context of the error. If the error occurs when the user tries to access a private forum, '%s' will be replaces by 'forum'.</li>
					<li>Word 'login' will be replaced by a link to the login page.</li>
				</ul>
			</p>


			<textarea name="failure_msg" id="failure_msg" style="width: 98%;" rows="3" cols="50"><?php 
    echo private_forums_custom_get_options('failure_msg');
    ?>
</textarea>

			<p class="submit"><input type="submit" name="submit" value="Submit"></p>
		</form>
		<?php 
}
Exemplo n.º 15
0
if ($wf_curspart == 1) {
    $start = $wf_perpage * ($_G['page'] - 1);
    $subperpage = $wf_init_num;
} else {
    if ($wf_curspart <= $wf_spart_num) {
        $avgloads = intval(($wf_perpage - $wf_init_num) / ($wf_spart_num - 1));
        $subperpage = $wf_curspart == $wf_spart_num ? $wf_perpage - $wf_init_num - $avgloads * ($wf_curspart - 2) : $avgloads;
        $start = $wf_curspart == $wf_spart_num ? $wf_perpage * ($_G['page'] - 1) + $wf_perpage - $subperpage : $wf_perpage * ($_G['page'] - 1) + $wf_init_num + $subperpage * ($wf_curspart - 2);
    } else {
        header('HTTP/1.1 404 Not Found');
        header('status: 404 Not Found');
        exit;
    }
}
loadcache('stamps');
$forums = get_forums();
$sid = in_array($_GET['sid'], array(1, 2, 3, 4, 5)) ? $_GET['sid'] : 0;
$type = in_array($_GET['type'], array('top', 'hot', 'digest')) ? $_GET['type'] : 'new';
$hc = $block_must_cover_on || !empty($_GET['hc']);
$minvalue = $view == 'hot' ? $view_hot_value : 0;
$data = array();
if ($view == 'all') {
    $data[$view]['threadlist'] = getthreadlist(0, $type, $wf_forum_limit, $sid, $hc, 1, $start, $subperpage);
    $data[$view]['threadcount'] = C::t('#singcere_waterfall#dx')->count_thread($type, $minvalue, $wf_forum_limit, $sid, $hc);
    $theurl = 'plugin.php?id=singcere_waterfall&mod=stroll&view=' . $view;
} else {
    if ($view == 'forum') {
        $gid = empty($_GET['gid']) ? 0 : $_GET['gid'];
        $fid = empty($_GET['fid']) ? 0 : $_GET['fid'];
        $fids = array();
        if ($gid && empty($fid)) {