Exemplo n.º 1
0
function set_options_gafa()
{
    /* EJEMPLO
    	$home				= get_last_post('opciones_home');
    
    	define('HOME',		$home);
    	*/
    define('OPCIONES_MAILINGS', get_last_post("opciones_mailings"));
}
Exemplo n.º 2
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.º 3
0
function forum($rowQ1)
{
    global $user, $subscribe, $theme, $NPDS_Prefix, $admin, $adminforum;
    //==> droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    $adminforum = false;
    if ($admin) {
        $adminX = base64_decode($admin);
        $adminR = explode(':', $adminX);
        $Q = sql_fetch_assoc(sql_query("SELECT * FROM " . $NPDS_Prefix . "authors WHERE aid='{$adminR['0']}' LIMIT 1"));
        if ($Q['radminsuper'] == 1) {
            $adminforum = 1;
        } else {
            $R = sql_query("SELECT fnom, fid, radminsuper FROM " . $NPDS_Prefix . "authors a LEFT JOIN " . $NPDS_Prefix . "droits d ON a.aid = d.d_aut_aid LEFT JOIN " . $NPDS_Prefix . "fonctions f ON d.d_fon_fid = f.fid WHERE a.aid='{$adminR['0']}' AND f.fid BETWEEN 13 AND 15");
            if (sql_num_rows($R) >= 1) {
                $adminforum = 1;
            }
        }
    }
    //<== droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    if ($user) {
        $userX = base64_decode($user);
        $userR = explode(':', $userX);
        $tab_groupe = valid_group($user);
    }
    if ($ibid = theme_image("forum/icons/red_folder.gif")) {
        $imgtmpR = $ibid;
    } else {
        $imgtmpR = "images/forum/icons/red_folder.gif";
    }
    if ($ibid = theme_image("forum/icons/folder.gif")) {
        $imgtmp = $ibid;
    } else {
        $imgtmp = "images/forum/icons/folder.gif";
    }
    $linked = "onmouseover=\"this.className='lignb'; this.style.cursor='default';\" " . " onmouseout=\"this.className='ligna';\"";
    // preparation de la gestion des folders
    $result = sql_query("SELECT forum_id, COUNT(topic_id) AS total FROM " . $NPDS_Prefix . "forumtopics GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][0] = $total;
        // Topic
    }
    $result = sql_query("SELECT forum_id, COUNT(DISTINCT topicid) AS total FROM " . $NPDS_Prefix . "forum_read WHERE uid='{$userR['0']}' AND topicid>'0' AND status!='0' GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][1] = $total;
        // Folder
    }
    // préparation de la gestion des abonnements
    $result = sql_query("SELECT forumid FROM " . $NPDS_Prefix . "subscribe WHERE uid='{$userR['0']}'");
    while (list($forumid) = sql_fetch_row($result)) {
        $tab_subscribe[$forumid] = true;
    }
    // preparation du compteur total_post
    $rowQ0 = Q_Select("SELECT forum_id, COUNT(post_aff) AS total FROM " . $NPDS_Prefix . "posts GROUP BY forum_id", 600);
    while (list(, $row0) = each($rowQ0)) {
        $tab_total_post[$row0['forum_id']] = $row0['total'];
    }
    if ($subscribe and $user) {
        $colspanX = 7;
    } else {
        $colspanX = 6;
    }
    $ibid = '';
    if ($rowQ1) {
        while (list(, $row) = each($rowQ1)) {
            $title_aff = true;
            $rowQ2 = Q_Select("SELECT * FROM " . $NPDS_Prefix . "forums WHERE cat_id = '" . $row['cat_id'] . "' AND SUBSTRING(forum_name,1,3)!='<!>' ORDER BY forum_index,forum_id", 21600);
            if ($rowQ2) {
                while (list(, $myrow) = each($rowQ2)) {
                    // Gestion des Forums Cachés aux non-membres
                    if ($myrow['forum_type'] != "9" or $userR) {
                        // Gestion des Forums réservés à un groupe de membre
                        if ($myrow['forum_type'] == "7" or $myrow['forum_type'] == "5") {
                            $ok_affich = groupe_forum($myrow['forum_pass'], $tab_groupe);
                            if (isset($admin) and $adminforum == 1) {
                                $ok_affich = true;
                            }
                            // to see when admin mais pas assez precis
                        } else {
                            $ok_affich = true;
                        }
                        if ($ok_affich) {
                            if ($title_aff) {
                                $title = stripslashes($row['cat_title']);
                                if (file_exists("themes/{$theme}/html/forum-cat" . $row['cat_id'] . ".html") or file_exists("themes/default/html/forum-cat" . $row['cat_id'] . ".html")) {
                                    $ibid .= '
         <tr valign="top">
            <td colspan="' . $colspanX . '" class="lignb"><a href="forum.php?catid=' . $row['cat_id'] . '">' . $title . '</a></td>
         </tr>';
                                } else {
                                    $ibid .= '
         <tr valign="top">
            <td colspan="' . $colspanX . '" class="lignb">' . $title . '</td>
         </tr>';
                                }
                                $title_aff = false;
                            }
                            $forum_moderator = explode(" ", get_moderator($myrow['forum_moderator']));
                            $Mmod = false;
                            for ($i = 0; $i < count($forum_moderator); $i++) {
                                if ($userR[1] == $forum_moderator[$i]) {
                                    $Mmod = true;
                                }
                            }
                            $last_post = get_last_post($myrow['forum_id'], "forum", "infos", $Mmod);
                            $ibid .= '
         <tr align="left" valign="top">';
                            if ($tab_folder[$myrow['forum_id']][0] - $tab_folder[$myrow['forum_id']][1] > 0) {
                                $ibid .= '
            <td class="lignb" align="center" valign="middle" width="5%"><img src="' . $imgtmpR . '" border="" alt="" /></td>';
                            } else {
                                $ibid .= '
            <td class="lignb" align="center" valign="middle" width="5%"><img src="' . $imgtmp . '" border="" alt="" /></td>';
                            }
                            $name = stripslashes($myrow['forum_name']);
                            $redirect = false;
                            if (strstr(strtoupper($name), "<a HREF")) {
                                if ($colspanX == 7) {
                                    $ibid .= '
            <td width="40%" class="ligna" ' . $linked . '>' . $name;
                                } else {
                                    $ibid .= '
            <td width="45%" class="ligna" ' . $linked . '>' . $name;
                                }
                                $redirect = true;
                            } else {
                                if ($colspanX == 7) {
                                    $ibid .= '
            <td width="40%" class="ligna" ' . $linked . ' onclick=\'window.location.href="viewforum.php?forum=' . $myrow['forum_id'] . '"\'><a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                                } else {
                                    $ibid .= '
            <td width="45%" class="ligna" ' . $linked . ' onclick=\'window.location.href="viewforum.php?forum=' . $myrow['forum_id'] . '"\'><a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                                }
                            }
                            $desc = stripslashes(meta_lang($myrow['forum_desc']));
                            $ibid .= '<br />' . $desc . '</td>';
                            // Subscribe
                            if ($subscribe and $user) {
                                if (!$redirect) {
                                    if ($tab_subscribe[$myrow['forum_id']]) {
                                        $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle"><input type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" checked="checked" /></td>';
                                    } else {
                                        $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle"><input type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" /></td>';
                                    }
                                } else {
                                    $ibid .= '
            <td class="lignb" width="5%" align="center" valign="middle">&nbsp;</td>';
                                }
                            }
                            if (!$redirect) {
                                $ibid .= '
            <td width="15%" align="center" valign="middle" class="ligna">';
                                if ($myrow['forum_access'] == "0" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Free for All");
                                }
                                if ($myrow['forum_type'] == "1") {
                                    $ibid .= translate("Private");
                                }
                                if ($myrow['forum_type'] == "5") {
                                    $ibid .= "PHP Script + " . translate("Group");
                                }
                                if ($myrow['forum_type'] == "6") {
                                    $ibid .= "PHP Script";
                                }
                                if ($myrow['forum_type'] == "7") {
                                    $ibid .= translate("Group");
                                }
                                if ($myrow['forum_type'] == "8") {
                                    $ibid .= translate("Extended Text");
                                }
                                if ($myrow['forum_type'] == "9") {
                                    $ibid .= translate("Hidden");
                                }
                                if ($myrow['forum_access'] == "1" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Registered User");
                                }
                                if ($myrow['forum_access'] == "2" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Moderator");
                                }
                                if ($myrow['forum_access'] == "9") {
                                    $ibid .= ' <strong>' . translate("Closed") . '</strong>';
                                }
                                $ibid .= '</td>
            <td width="10%" align="center" valign="middle" class="lignb">' . $tab_folder[$myrow['forum_id']][0] . '</td>
            <td width="10%" align="center" valign="middle" class="ligna">' . $tab_total_post[$myrow['forum_id']] . '</td>
            <td width="15%" align="center" valign="middle" class="lignb">' . $last_post . '</td>
         </tr>';
                            } else {
                                $ibid .= '
            <td width="15%" align="center" valign="middle" class="ligna">&nbsp;</td>
            <td width="10%" align="center" valign="middle" class="lignb">&nbsp;</td>
            <td width="10%" align="center" valign="middle" class="ligna">&nbsp;</td>
            <td width="15%" align="center" valign="middle" class="ligna">&nbsp;</td>
         </tr>';
                            }
                        }
                    }
                }
            }
        }
    }
    return $ibid;
}
Exemplo n.º 4
0
                 if (!$Mmod) {
                     echo '<td>&nbsp;</td>';
                 } else {
                     echo "<td>[ <a href=\"{$hrefX}?topic=" . $myrow['topic_id'] . "&amp;forum={$forum}\">" . translate("Edit") . "</a> ]</td>";
                 }
                 echo '<td>&nbsp;</td>';
             } else {
                 $rowQ1 = Q_Select("SELECT uname FROM " . $NPDS_Prefix . "users WHERE uid='" . $myrow['topic_poster'] . "'", 3600);
                 $uname = $rowQ1[0]['uname'];
                 echo '<td>' . $uname . '</td>';
                 echo '<td>' . $myrow['topic_views'] . '</td>';
             }
             if ($Sredirection) {
                 echo '<td>&nbsp;</td></tr>';
             } else {
                 echo "<td>" . get_last_post($myrow['topic_id'], "topic", "infos", $Mmod) . "</td></tr>";
             }
         }
     } while ($myrow = sql_fetch_assoc($result));
     sql_free_result($result);
 } else {
     if ($forum_access != 9) {
         echo '
      <td colspan="7"><span class="text-danger">' . translate("There are no topics for this forum. ") . '</span><br /><a href="newtopic.php?forum=' . $forum . '" >' . translate("You can post one here.") . '</a></td></tr>';
     }
 }
 echo '
      </tbody>
   </table>';
 if ($user) {
     echo '<br /><p><a href="viewforum.php?op=mark&amp;forum=' . $forum . '"><i class="fa fa-lg fa-check-square-o"></i></a>&nbsp;' . translate("Mark all Topics to Read") . '</p>';
Exemplo n.º 5
0
    $post_id = intval($_GET['post_id']);
    $myrow = Database::get()->querySingle("SELECT f.id, f.name, p.post_time, p.poster_id, t.locked FROM forum f, forum_topic t, forum_post p\n            WHERE f.id = ?d\n            AND t.id = ?d\n            AND p.id = ?d\n            AND t.forum_id = f.id\n            AND p.topic_id = t.id\n            AND f.course_id = ?d", $forum, $topic, $post_id, $course_id);
} else {
    $myrow = Database::get()->querySingle("SELECT f.id, f.name, t.locked FROM forum f, forum_topic t\n            WHERE f.id = ?d\n            AND t.id = ?d\n            AND t.forum_id = f.id\n            AND f.course_id = ?d", $forum, $topic, $course_id);
}
if (!$myrow) {
    $tool_content .= "<div class='alert alert-warning'>{$langErrorTopicSelect}</div>";
    draw($tool_content, 2);
    exit;
}
$forum_name = $myrow->name;
$forum = $myrow->id;
$topic_locked = $myrow->locked;
$total = get_total_posts($topic);
if (isset($_GET['delete']) && isset($post_id) && $is_editor) {
    $last_post_in_thread = get_last_post($topic);
    $this_post_time = $myrow->post_time;
    $this_post_author = $myrow->poster_id;
    Database::get()->query("DELETE FROM forum_post WHERE id = ?d", $post_id);
    Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_FORUMPOST, $post_id);
    //orphan replies get -1 to parent_post_id
    Database::get()->query("UPDATE forum_post SET parent_post_id = -1 WHERE parent_post_id = ?d", $post_id);
    $forum_user_stats = Database::get()->querySingle("SELECT COUNT(*) as c FROM forum_post\n                        INNER JOIN forum_topic ON forum_post.topic_id = forum_topic.id\n                        INNER JOIN forum ON forum.id = forum_topic.forum_id\n                        WHERE forum_post.poster_id = ?d AND forum.course_id = ?d", $this_post_author, $course_id);
    Database::get()->query("DELETE FROM forum_user_stats WHERE user_id = ?d AND course_id = ?d", $this_post_author, $course_id);
    if ($forum_user_stats->c != 0) {
        Database::get()->query("INSERT INTO forum_user_stats (user_id, num_posts, course_id) VALUES (?d,?d,?d)", $this_post_author, $forum_user_stats->c, $course_id);
    }
    if ($total == 1) {
        // if exists one post in topic
        Database::get()->query("DELETE FROM forum_topic WHERE id = ?d AND forum_id = ?d", $topic, $forum);
        Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_FORUMTOPIC, $topic);
Exemplo n.º 6
0
function forum($rowQ1)
{
    global $user, $subscribe, $theme, $NPDS_Prefix, $admin, $adminforum;
    //==> droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    $adminforum = false;
    if ($admin) {
        $adminX = base64_decode($admin);
        $adminR = explode(':', $adminX);
        $Q = sql_fetch_assoc(sql_query("SELECT * FROM " . $NPDS_Prefix . "authors WHERE aid='{$adminR['0']}' LIMIT 1"));
        if ($Q['radminsuper'] == 1) {
            $adminforum = 1;
        } else {
            $R = sql_query("SELECT fnom, fid, radminsuper FROM " . $NPDS_Prefix . "authors a LEFT JOIN " . $NPDS_Prefix . "droits d ON a.aid = d.d_aut_aid LEFT JOIN " . $NPDS_Prefix . "fonctions f ON d.d_fon_fid = f.fid WHERE a.aid='{$adminR['0']}' AND f.fid BETWEEN 13 AND 15");
            if (sql_num_rows($R) >= 1) {
                $adminforum = 1;
            }
        }
    }
    //<== droits des admin sur les forums (superadmin et admin avec droit gestion forum)
    if ($user) {
        $userX = base64_decode($user);
        $userR = explode(':', $userX);
        $tab_groupe = valid_group($user);
    }
    if ($ibid = theme_image("forum/icons/red_folder.gif")) {
        $imgtmpR = $ibid;
    } else {
        $imgtmpR = "images/forum/icons/red_folder.gif";
    }
    if ($ibid = theme_image("forum/icons/folder.gif")) {
        $imgtmp = $ibid;
    } else {
        $imgtmp = "images/forum/icons/folder.gif";
    }
    // preparation de la gestion des folders
    $result = sql_query("SELECT forum_id, COUNT(topic_id) AS total FROM " . $NPDS_Prefix . "forumtopics GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][0] = $total;
        // Topic
    }
    $result = sql_query("SELECT forum_id, COUNT(DISTINCT topicid) AS total FROM " . $NPDS_Prefix . "forum_read WHERE uid='{$userR['0']}' AND topicid>'0' AND status!='0' GROUP BY (forum_id)");
    while (list($forumid, $total) = sql_fetch_row($result)) {
        $tab_folder[$forumid][1] = $total;
        // Folder
    }
    // préparation de la gestion des abonnements
    $result = sql_query("SELECT forumid FROM " . $NPDS_Prefix . "subscribe WHERE uid='{$userR['0']}'");
    while (list($forumid) = sql_fetch_row($result)) {
        $tab_subscribe[$forumid] = true;
    }
    // preparation du compteur total_post
    $rowQ0 = Q_Select("SELECT forum_id, COUNT(post_aff) AS total FROM " . $NPDS_Prefix . "posts GROUP BY forum_id", 600);
    while (list(, $row0) = each($rowQ0)) {
        $tab_total_post[$row0['forum_id']] = $row0['total'];
    }
    $ibid = '';
    if ($rowQ1) {
        while (list(, $row) = each($rowQ1)) {
            $title_aff = true;
            $rowQ2 = Q_Select("SELECT * FROM " . $NPDS_Prefix . "forums WHERE cat_id = '" . $row['cat_id'] . "' AND SUBSTRING(forum_name,1,3)!='<!>' ORDER BY forum_index,forum_id", 21600);
            if ($rowQ2) {
                while (list(, $myrow) = each($rowQ2)) {
                    // Gestion des Forums Cachés aux non-membres
                    if ($myrow['forum_type'] != "9" or $userR) {
                        // Gestion des Forums réservés à un groupe de membre
                        if ($myrow['forum_type'] == "7" or $myrow['forum_type'] == "5") {
                            $ok_affich = groupe_forum($myrow['forum_pass'], $tab_groupe);
                            if (isset($admin) and $adminforum == 1) {
                                $ok_affich = true;
                            }
                            // to see when admin mais pas assez precis
                        } else {
                            $ok_affich = true;
                        }
                        if ($ok_affich) {
                            if ($title_aff) {
                                $title = stripslashes($row['cat_title']);
                                if (file_exists("themes/{$theme}/html/forum-cat" . $row['cat_id'] . ".html") or file_exists("themes/default/html/forum-cat" . $row['cat_id'] . ".html")) {
                                    $ibid .= '
                           <div class="list-group mt-1" id="catfo_' . $row['cat_id'] . '" >
                              <a class="list-group-item list-group-item-action active" href="forum.php?catid=' . $row['cat_id'] . '"><h5 class="list-group-item-heading" >' . $title . '</h5></a>';
                                } else {
                                    $ibid .= '
                           <div class="list-group mt-1" id="catfo_' . $row['cat_id'] . '">
                              <div class="list-group-item list-group-item-action active"><h5 class="list-group-item-heading" >' . $title . '</h5></div>';
                                }
                                $title_aff = false;
                            }
                            $forum_moderator = explode(' ', get_moderator($myrow['forum_moderator']));
                            $Mmod = false;
                            for ($i = 0; $i < count($forum_moderator); $i++) {
                                if ($userR[1] == $forum_moderator[$i]) {
                                    $Mmod = true;
                                }
                            }
                            $last_post = get_last_post($myrow['forum_id'], "forum", "infos", $Mmod);
                            $ibid .= '<p class="list-group-item list-group-item-action">';
                            if ($tab_folder[$myrow['forum_id']][0] - $tab_folder[$myrow['forum_id']][1] > 0) {
                                $ibid .= '<i class="fa fa-folder text-primary fa-lg" title="' . translate("New Posts since your last visit.") . '" data-toggle="tooltip" data-placement="right"></i>';
                            } else {
                                $ibid .= '<i class="fa fa-folder-o text-primary fa-lg" title="' . translate("No New Posts since your last visit.") . '" data-toggle="tooltip" data-placement="right"></i>';
                            }
                            $name = stripslashes($myrow['forum_name']);
                            $redirect = false;
                            if (strstr(strtoupper($name), "<a HREF")) {
                                $redirect = true;
                            } else {
                                $ibid .= '
                        <a href="viewforum.php?forum=' . $myrow['forum_id'] . '" >' . $name . '</a>';
                            }
                            if (!$redirect) {
                                $ibid .= ' 
            <span class="tag tag-default ml-1" style=" position: relative; float: right;" title="' . translate("Posts") . '" data-toggle="tooltip">' . $tab_total_post[$myrow['forum_id']] . '</span>
            <span class="tag tag-default " style=" position: relative; float: right;" title="' . translate("Topics") . '" data-toggle="tooltip">' . $tab_folder[$myrow['forum_id']][0] . '</span>';
                            }
                            $desc = stripslashes(meta_lang($myrow['forum_desc']));
                            if ($desc != '') {
                                $ibid .= '<br />' . $desc;
                            }
                            if (!$redirect) {
                                $ibid .= '<br />[ ';
                                if ($myrow['forum_access'] == "0" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Free for All");
                                }
                                if ($myrow['forum_type'] == "1") {
                                    $ibid .= translate("Private");
                                }
                                if ($myrow['forum_type'] == "5") {
                                    $ibid .= "PHP Script + " . translate("Group");
                                }
                                if ($myrow['forum_type'] == "6") {
                                    $ibid .= "PHP Script";
                                }
                                if ($myrow['forum_type'] == "7") {
                                    $ibid .= translate("Group");
                                }
                                if ($myrow['forum_type'] == "8") {
                                    $ibid .= translate("Extended Text");
                                }
                                if ($myrow['forum_type'] == "9") {
                                    $ibid .= translate("Hidden");
                                }
                                if ($myrow['forum_access'] == "1" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Registered User");
                                }
                                if ($myrow['forum_access'] == "2" && $myrow['forum_type'] == "0") {
                                    $ibid .= translate("Moderator");
                                }
                                if ($myrow['forum_access'] == "9") {
                                    $ibid .= ' <strong class="text-danger">' . translate("Closed") . '</strong>';
                                }
                                $ibid .= ' ]';
                                $ibid .= '<br />';
                                // Subscribe
                                if ($subscribe and $user) {
                                    if (!$redirect) {
                                        if ($tab_subscribe[$myrow['forum_id']]) {
                                            $ibid .= '<input class="n-ckbf" type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" checked="checked" title="" data-toggle="tooltip" />';
                                        } else {
                                            $ibid .= '<input class="n-ckbf" type="checkbox" name="Subforumid[' . $myrow['forum_id'] . ']" title="' . translate("Check me and click on OK button to receive an Email when is a new submission in this forum.") . '" data-toggle="tooltip" data-placement="right" />';
                                        }
                                    }
                                }
                                $ibid .= '<span class="float-xs-right">' . $last_post . '</span><br />';
                            } else {
                                $ibid .= '';
                            }
                        }
                    }
                }
                if ($ok_affich) {
                    $ibid .= '
            </p>
         </div>';
                }
            }
        }
    }
    if ($subscribe and $user and $ok_affich) {
        $ibid .= '<input type="checkbox" id="ckball_f" />&nbsp;<span class=" text-muted" id="ckb_status_f">Tout cocher</span>';
    }
    return $ibid;
}
Exemplo n.º 7
0
 echo "<th>" . translate("Forum") . "</th>";
 echo "<th>" . translate("Topics") . "</th>";
 echo "<th>" . translate("Posts") . "</th>";
 echo "<th>" . translate("Last Posts") . "</th></tr></thead>";
 $result = sql_query("SELECT * FROM " . $NPDS_Prefix . "catagories ORDER BY cat_id");
 $num_for = 0;
 while (list($cat_id, $cat_title) = sql_fetch_row($result)) {
     $sub_sql = "SELECT f.*, u.uname FROM " . $NPDS_Prefix . "forums f, " . $NPDS_Prefix . "users u WHERE f.cat_id = '{$cat_id}' AND f.forum_moderator = u.uid ORDER BY forum_index,forum_id";
     if (!($sub_result = sql_query($sub_sql))) {
         forumerror('0022');
     }
     if ($myrow = sql_fetch_assoc($sub_result)) {
         echo "<tbody><tr><td class=\"active\" colspan=\"7\">" . stripslashes($cat_title) . "</td></tr>";
         do {
             $num_for++;
             $last_post = get_last_post($myrow['forum_id'], "forum", "infos", true);
             echo "<tr>";
             $total_topics = get_total_topics($myrow['forum_id']);
             echo "<td><i class=\"fa fa-lg fa-file-text-o\"></i></td>";
             $name = stripslashes($myrow['forum_name']);
             $xfile .= "\$xforum[{$num_for}][1] = \"{$name}\";\n";
             $xfile .= "\$xforum[{$num_for}][2] = {$total_topics};\n";
             echo "<td><a href=\"viewforum.php?forum=" . $myrow['forum_id'] . "\" class=\"noir\"><span class=\"rouge\">" . $xforum[$num_for][1] . "</span> -/- {$name} </a>\n";
             $desc = stripslashes($myrow['forum_desc']);
             echo "<br />{$desc}</td>\n";
             echo "<td><span class=\"rouge\">" . $xforum[$num_for][2] . "</span> -/- {$total_topics}</td>\n";
             $total_posts = get_total_posts($myrow['forum_id'], "", "forum", false);
             $xfile .= "\$xforum[{$num_for}][3] = {$total_posts};\n";
             echo "<td><span class=\"rouge\">" . $xforum[$num_for][3] . "</span> -/- {$total_posts}</td>\n";
             echo "<td>{$last_post}</td>\n";
         } while ($myrow = sql_fetch_assoc($sub_result));