Esempio n. 1
0
function ancre($forum_id, $topic_id, $post_id, $posts_per_page)
{
    global $NPDS_Prefix;
    $rowQ1 = Q_Select("SELECT post_id FROM " . $NPDS_Prefix . "posts WHERE forum_id='{$forum_id}' AND topic_id='{$topic_id}' ORDER BY post_id ASC", 600);
    if (!$rowQ1) {
        forumerror('0015');
    }
    $i = 0;
    while (list(, $row) = each($rowQ1)) {
        if ($row['post_id'] == $post_id) {
            break;
        }
        $i++;
    }
    $start = $i - $i % $posts_per_page;
    return "&ancre=1&start={$start}#" . $forum_id . $topic_id . $post_id;
}
Esempio n. 2
0
}
include 'functions.php';
if ($SuperCache) {
    $cache_obj = new cacheManager();
} else {
    $cache_obj = new SuperCacheEmpty();
}
global $NPDS_Prefix;
include 'auth.php';
$rowQ1 = Q_Select("SELECT forum_id FROM " . $NPDS_Prefix . "forumtopics WHERE topic_id='{$topic}'", 3600);
if (!$rowQ1) {
    forumerror('0001');
}
list(, $myrow) = each($rowQ1);
$forum = $myrow['forum_id'];
$rowQ1 = Q_Select("SELECT forum_name, forum_moderator, forum_type, forum_pass, forum_access, arbre FROM " . $NPDS_Prefix . "forums WHERE forum_id = '{$forum}'", 3600);
if (!$rowQ1) {
    forumerror('0001');
}
list(, $myrow) = each($rowQ1);
$forum_name = $myrow['forum_name'];
$mod = $myrow['forum_moderator'];
$forum_type = $myrow['forum_type'];
$forum_access = $myrow['forum_access'];
if ($forum_type == 1 and $Forum_passwd != $myrow['forum_pass']) {
    header("Location: forum.php");
}
if ($forum_type == 5 or $forum_type == 7) {
    $ok_affiche = false;
    $tab_groupe = valid_group($user);
    $ok_affiche = groupe_forum($myrow['forum_pass'], $tab_groupe);
Esempio 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;
}
Esempio n. 4
0
function RecentForumPosts_fab($title, $maxforums, $maxtopics, $displayposter, $topicmaxchars, $hr)
{
    global $parse, $user;
    global $NPDS_Prefix;
    $topics = 0;
    settype($maxforums, "integer");
    if ($maxforums == 0) {
        $lim = "";
    } else {
        $lim = " LIMIT {$maxforums}";
    }
    if ($user) {
        $query = "SELECT * FROM " . $NPDS_Prefix . "forums ORDER BY cat_id,forum_index,forum_id" . $lim;
    } else {
        $query = "SELECT * FROM " . $NPDS_Prefix . "forums WHERE forum_type!='9' AND forum_type!='7' AND forum_type!='5' ORDER BY cat_id,forum_index,forum_id" . $lim;
    }
    $result = sql_query($query);
    if (!$result) {
        exit;
    }
    $premier = false;
    $boxstuff = "<ul>\n";
    while ($row = sql_fetch_row($result)) {
        if ($row[6] == "5" or $row[6] == "7") {
            $ok_affich = false;
            $tab_groupe = valid_group($user);
            $ok_affich = groupe_forum($row[7], $tab_groupe);
        } else {
            $ok_affich = true;
        }
        if ($ok_affich) {
            $forumid = $row[0];
            $forumname = $row[1];
            $forum_desc = $row[2];
            if ($hr) {
                $boxstuff .= "<hr class=\"titboxcont\" />";
            }
            if ($parse == 0) {
                $forumname = FixQuotes($forumname);
                $forum_desc = FixQuotes($forum_desc);
            } else {
                $forumname = stripslashes($forumname);
                $forum_desc = stripslashes($forum_desc);
            }
            $res = sql_query("SELECT * FROM " . $NPDS_Prefix . "forumtopics WHERE forum_id = '{$forumid}' ORDER BY topic_time DESC");
            $ibidx = sql_num_rows($res);
            $boxstuff .= "<li><a href=\"viewforum.php?forum={$forumid}\" title=\"" . strip_tags($forum_desc) . "\">{$forumname}</a> ({$ibidx}) </li>\n";
            $topics = 0;
            while ($topics < $maxtopics && ($topicrow = sql_fetch_row($res))) {
                $topicid = $topicrow[0];
                $tt = $topictitle = $topicrow[1];
                $date = $topicrow[3];
                $replies = 0;
                $postquery = "SELECT COUNT(*) AS total FROM " . $NPDS_Prefix . "posts WHERE topic_id = '{$topicid}'";
                if ($pres = sql_query($postquery)) {
                    if ($myrow = sql_fetch_assoc($pres)) {
                        $replies = $myrow['total'];
                    }
                }
                if (strlen($topictitle) > $topicmaxchars) {
                    $topictitle = substr($topictitle, 0, $topicmaxchars);
                    $topictitle .= "..";
                }
                if ($displayposter) {
                    $posterid = $topicrow[2];
                    $RowQ1 = Q_Select("SELECT uname FROM " . $NPDS_Prefix . "users WHERE uid = '{$posterid}'", 3600);
                    list(, $myrow) = each($rowQ1);
                    $postername = $myrow['uname'];
                }
                if ($parse == 0) {
                    $tt = strip_tags(FixQuotes($tt));
                    $topictitle = FixQuotes($topictitle);
                } else {
                    $tt = strip_tags(stripslashes($tt));
                    $topictitle = stripslashes($topictitle);
                }
                $boxstuff .= "<a href=\"viewtopic.php?topic={$topicid}&amp;forum={$forumid}\" title=\"{$tt}\">\"{$topictitle}\"</a> ({$replies})";
                $boxstuff .= "</li>";
                if ($displayposter) {
                    $boxstuff .= "<br />&nbsp;&nbsp;- {$postername}";
                }
                $topics++;
            }
        }
    }
    $boxstuff .= "</ul>\n";
    return $boxstuff;
}
Esempio n. 5
0
                     for ($x = 0; $x < $replys + 1; $x += $posts_per_page) {
                         $pages++;
                     }
                     $last_post_url = "{$hrefX}?topic=" . $myrow['topic_id'] . "&amp;forum={$forum}&amp;start=" . ($pages - 1) * $posts_per_page;
                 }
                 echo "<td>{$replys}&nbsp;<a href=\"" . $last_post_url . "#last-post\"><img src=\"{$imgtmpRi}\" border=\"0\" align=\"center\" alt=\"" . translate("Last Posts") . "\" /></a>&nbsp;&nbsp;&nbsp;</td>";
             }
             if ($Sredirection) {
                 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 '
Esempio n. 6
0
         </ul>
      </p>';
    // sections
} elseif ($type == "sections") {
    $result = sql_query("SELECT artid, secid, title, content FROM " . $NPDS_Prefix . "seccont WHERE (title LIKE '%{$query_title}%' OR content LIKE '%{$query_body}%') ORDER BY artid DESC LIMIT {$min},{$offset}");
    if ($result) {
        $nrows = sql_num_rows($result);
    }
    $x = 0;
    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
    if ($nrows > 0) {
        while (list($artid, $secid, $title, $content) = sql_fetch_row($result)) {
            $rowcolor = tablos();
            $rowQ2 = Q_Select("SELECT secname, rubid FROM " . $NPDS_Prefix . "sections WHERE secid='{$secid}'", 3600);
            list(, $row2) = each($rowQ2);
            $rowQ3 = Q_Select("SELECT rubname FROM " . $NPDS_Prefix . "rubriques WHERE rubid='" . $row2['rubid'] . "'", 3600);
            list(, $row3) = each($rowQ3);
            if ($row3['rubname'] != "Divers" and $row3['rubname'] != "Presse-papiers") {
                $surl = "sections.php?op=listarticles&amp;secid={$secid}";
                $furl = "sections.php?op=viewarticle&amp;artid={$artid}";
                echo "<tr {$rowcolor}><td><a href=\"{$furl}\" class=\"noir\">" . aff_langue($title) . "</a> " . translate("in the sub-section") . " <a href=\"{$surl}\" class=\"noir\">" . aff_langue($row2['secname']) . "</a></td></tr>\n";
                echo "<tr><td><hr noshade=\"noshade\" class=\"ongl\" /></td></tr>";
                $x++;
            }
        }
        if ($x == 0) {
            echo "<tr><td align=\"center\" class=\"rouge\">" . translate("No matches found to your query") . "<br />";
            echo "</td></tr>";
        }
    } else {
        echo "<tr><td align=\"center\" class=\"rouge\">" . translate("No matches found to your query") . "<br />";
Esempio n. 7
0
    $rank2 = $myrow['rank2'];
    $rank3 = $myrow['rank3'];
    $rank4 = $myrow['rank4'];
    $rank5 = $myrow['rank5'];
    $anti_flood = $myrow['anti_flood'];
    $solved = $myrow['solved'];
}
settype($forum, 'integer');
if ($allow_upload_forum) {
    $rowQ1 = Q_Select("SELECT attachement FROM " . $NPDS_Prefix . "forums WHERE forum_id='{$forum}'", 3600);
    if ($rowQ1) {
        list(, $myrow) = each($rowQ1);
        $allow_upload_forum = $myrow['attachement'];
    }
}
$rowQ1 = Q_Select("SELECT forum_pass FROM " . $NPDS_Prefix . "forums WHERE forum_id='{$forum}' and forum_type='1'", 3600);
if ($rowQ1) {
    if (isset($Forum_Priv[$forum])) {
        $Xpasswd = base64_decode($Forum_Priv[$forum]);
        list(, $myrow) = each($rowQ1);
        $forum_xpass = $myrow['forum_pass'];
        if (md5($forum_xpass) == $Xpasswd) {
            $Forum_passwd = $forum_xpass;
        } else {
            setcookie("Forum_Priv[{$forum}]", "", 0);
        }
    } else {
        if (isset($Forum_passwd)) {
            list(, $myrow) = each($rowQ1);
            if ($myrow['forum_pass'] == $Forum_passwd) {
                setcookie("Forum_Priv[{$forum}]", base64_encode(md5($Forum_passwd)), time() + 900);
Esempio n. 8
0
/************************************************************************/
if (!function_exists("Mysql_Connexion")) {
    include "mainfile.php";
}
include "powerpack_f.php";
global $powerpack;
$powerpack = true;
settype($op, 'string');
switch ($op) {
    // Instant Members Message
    case "instant_message":
        Form_instant_message($to_userid);
        break;
    case "write_instant_message":
        if ($user) {
            $rowQ1 = Q_Select("SELECT uid FROM " . $NPDS_Prefix . "users WHERE uname='{$cookie['1']}'", 3600);
            list(, $uid) = each($rowQ1);
            $from_userid = $uid['uid'];
            if ($subject != "" or $message != "") {
                $subject = FixQuotes($subject) . "";
                $messages = FixQuotes($messages) . "";
                writeDB_private_message($to_userid, "", $subject, $from_userid, $message, $copie);
            }
        }
        Header("Location: index.php");
        break;
        // Instant Members Message
        // Purge Chat Box
    // Instant Members Message
    // Purge Chat Box
    case "admin_chatbox_write":
Esempio n. 9
0
function viewbanner()
{
    global $NPDS_Prefix;
    $okprint = false;
    $while_limit = 3;
    $while_cpt = 0;
    $bresult = sql_query("SELECT bid FROM " . $NPDS_Prefix . "banner WHERE userlevel!='9'");
    $numrows = sql_num_rows($bresult);
    while (!$okprint and $while_cpt < $while_limit) {
        // More efficient random stuff, thanks to Cristian Arroyo from http://www.planetalinux.com.ar
        if ($numrows > 0) {
            mt_srand((double) microtime() * 1000000);
            $bannum = mt_rand(0, $numrows);
        } else {
            break;
        }
        $bresult2 = sql_query("SELECT bid, userlevel FROM " . $NPDS_Prefix . "banner WHERE userlevel!='9' LIMIT {$bannum},1");
        list($bid, $userlevel) = sql_fetch_row($bresult2);
        if ($userlevel == 0) {
            $okprint = true;
        } else {
            if ($userlevel == 1) {
                if (secur_static("member")) {
                    $okprint = true;
                }
            }
            if ($userlevel == 3) {
                if (secur_static("admin")) {
                    $okprint = true;
                }
            }
        }
        $while_cpt = $while_cpt + 1;
    }
    // Le risque est de sortir sans un BID valide
    if (!isset($bid)) {
        $rowQ1 = Q_Select("SELECT bid FROM " . $NPDS_Prefix . "banner WHERE userlevel='0' LIMIT 0,1", 86400);
        list(, $myrow) = each($rowQ1);
        $bid = $myrow['bid'];
        $okprint = true;
    }
    if ($okprint) {
        global $myIP;
        $myhost = getip();
        if ($myIP != $myhost) {
            sql_query("UPDATE " . $NPDS_Prefix . "banner SET impmade=impmade+1 WHERE bid='{$bid}'");
        }
        if ($numrows > 0 and $bid) {
            $aborrar = sql_query("SELECT cid, imptotal, impmade, clicks, imageurl, clickurl, date FROM " . $NPDS_Prefix . "banner WHERE bid='{$bid}'");
            list($cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date) = sql_fetch_row($aborrar);
            if ($imptotal == $impmade) {
                sql_query("INSERT INTO " . $NPDS_Prefix . "bannerfinish VALUES (NULL, '{$cid}', '{$impmade}', '{$clicks}', '{$date}', now())");
                sql_query("DELETE FROM " . $NPDS_Prefix . "banner WHERE bid='{$bid}'");
            }
            if ($imageurl != "") {
                echo "<a href=\"banners.php?op=click&amp;bid={$bid}\" target=\"_blank\"><img class=\"img-fluid\" src=\"" . aff_langue($imageurl) . "\" alt=\"\" /></a>";
            } else {
                if (stristr($clickurl, '.txt')) {
                    if (file_exists($clickurl)) {
                        include_once $clickurl;
                    }
                } else {
                    echo $clickurl;
                }
            }
        }
    }
}
Esempio n. 10
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;
}