コード例 #1
1
ファイル: viewtopicH.php プロジェクト: npds/npds_dune
function makebranch($parcat, $table, $level, $maxlevel, $max_post_id, $clas, $idtog)
{
    global $imgtmpPI, $imgtmpNE;
    global $smilies, $theme, $forum, $forum_type, $allow_bbcode, $allow_to_post, $forum_access, $Mmod, $topic, $lock_state, $userdata;
    global $allow_upload_forum, $att, $anonymous, $short_user, $last_read, $toggle;
    settype($result, 'string');
    $my_rsos = array();
    $count = 0;
    settype($idtog, 'integer');
    $list = $table[$parcat];
    while (list($key, $val) = each($list)) {
        $myrow = unserialize($val);
        if ($level != '0') {
            if ($level == 1) {
                $clas = 'collapse col-sm-11 offset-sm-1';
                $idtog = $idtog . ($count + 1);
            } else {
                $idtog = $idtog . $count;
            }
        } else {
            $idtog = $level + 1 . ($count + 1);
            //            $idtog = $forum.$topic.$myrow['post_id'].'y';
        }
        $posterdata = get_userdata_from_id($myrow['poster_id']);
        $posts = $posterdata['posts'];
        $socialnetworks = array();
        $posterdata_extend = array();
        $res_id = array();
        $my_rs = '';
        if (!$short_user) {
            $posterdata_extend = get_userdata_extend_from_id($myrow['poster_id']);
            include 'modules/reseaux-sociaux/reseaux-sociaux.conf.php';
            if ($posterdata_extend['M2'] != '') {
                $socialnetworks = explode(';', $posterdata_extend['M2']);
                foreach ($socialnetworks as $socialnetwork) {
                    $res_id[] = explode('|', $socialnetwork);
                }
                sort($res_id);
                sort($rs);
                foreach ($rs as $v1) {
                    foreach ($res_id as $y1) {
                        $k = array_search($y1[0], $v1);
                        if (false !== $k) {
                            $my_rs .= '<a class="mr-1" href="';
                            if ($v1[2] == 'skype') {
                                $my_rs .= $v1[1] . $y1[1] . '?chat';
                            } else {
                                $my_rs .= $v1[1] . $y1[1];
                            }
                            $my_rs .= '" target="_blank"><i class="fa fa-' . $v1[2] . ' fa-2x text-primary"></i></a> ';
                            break;
                        } else {
                            $my_rs .= '';
                        }
                    }
                }
                $my_rsos[] = $my_rs;
            } else {
                $my_rsos[] = '';
            }
        }
        $useroutils = '';
        $useroutils .= '<hr />';
        if ($posterdata['uid'] != 1 and $posterdata['uid'] != '') {
            $useroutils .= '<a class="list-group-item text-primary" href="user.php?op=userinfo&amp;uname=' . $posterdata['uname'] . '" target="_blank" title="' . translate("Profile") . '" data-toggle="tooltip"><i class="fa fa-2x fa-user"></i>&nbsp;' . translate("Profile") . '</a>';
        }
        if ($user) {
            $useroutils .= '<a class="list-group-item text-primary" href="powerpack.php?op=instant_message&amp;to_userid=' . $posterdata["uname"] . '" title="' . translate("Send internal Message") . '" data-toggle="tooltip"><i class="fa fa-2x fa-envelope-o"></i>&nbsp;' . translate("Send internal Message") . '</a>';
        }
        if ($posterdata['femail'] != '') {
            $useroutils .= '<a class="list-group-item text-primary" href="mailto:' . anti_spam($posterdata['femail'], 1) . '" target="_blank" title="' . translate("Email") . '" data-toggle="tooltip"><i class="fa fa-at fa-2x"></i>&nbsp;' . translate("Email") . '</a>';
        }
        if ($posterdata['url'] != '') {
            if (strstr('http://', $posterdata['url'])) {
                $posterdata['url'] = 'http://' . $posterdata['url'];
            }
            $useroutils .= '<a class="list-group-item text-primary" href="' . $posterdata['url'] . '" target="_blank" title="' . translate("Visit this Website") . '" data-toggle="tooltip"><i class="fa fa-2x fa-external-link"></i>&nbsp;' . translate("Visit this Website") . '</a>';
        }
        if ($posterdata['mns']) {
            $useroutils .= '<a class="list-group-item text-primary" href="minisite.php?op=' . $posterdata['uname'] . '" target="_blank" target="_blank" title="' . translate("Visit the Mini Web Site !") . '" data-toggle="tooltip"><i class="fa fa-2x fa-desktop"></i>&nbsp;' . translate("Visit the Mini Web Site !") . '</a>';
        }
        echo '
      <div id="tog_' . $idtog . '" class="row ' . $clas . '">
         <a name="' . $forum . $topic . $myrow['post_id'] . '"></a>';
        if ($myrow['post_id'] == $max_post_id) {
            echo '<a name="last-post"></a>';
        }
        echo '
         <div class="col-xs-12">
            <div class="card">
               <div class="card-header">';
        if ($smilies) {
            if ($posterdata['user_avatar'] != '') {
                if (stristr($posterdata['user_avatar'], "users_private")) {
                    $imgtmp = $posterdata['user_avatar'];
                } else {
                    if ($ibid = theme_image("forum/avatar/" . $posterdata['user_avatar'])) {
                        $imgtmp = $ibid;
                    } else {
                        $imgtmp = "images/forum/avatar/" . $posterdata['user_avatar'];
                    }
                }
                echo '
          <a style="position:absolute; top:1rem;" tabindex="0" data-toggle="popover" data-html="true" data-title="' . $posterdata['uname'] . '" data-content=\'' . member_qualif($posterdata['uname'], $posts, $posterdata['rank']) . '<br /><div class="list-group">' . $useroutils . '</div><hr />' . $my_rsos[$count] . '\'><img class=" btn-secondary img-thumbnail img-fluid n-ava" src="' . $imgtmp . '" alt="' . $posterdata['uname'] . '" /></a>';
            }
        }
        echo '&nbsp;<span style="position:absolute; left:6em;" class="text-muted"><strong>' . $posterdata['uname'] . '</strong></span>';
        echo '<span class="float-xs-right">';
        if ($myrow['image'] != '') {
            if ($ibid = theme_image("forum/subject/" . $myrow['image'])) {
                $imgtmp = $ibid;
            } else {
                $imgtmp = "images/forum/subject/" . $myrow['image'];
            }
            echo '<img class="n-smil" src="' . $imgtmp . '" alt="" />';
        } else {
            echo '<img class="n-smil" src="' . $imgtmpPI . '" alt="" />';
        }
        echo '</span>
            </div>';
        $message = stripslashes($myrow['post_text']);
        echo '
               <div class="card-block">
                  <div class="card-text pt-1">';
        $date_post = convertdateTOtimestamp($myrow['post_time']);
        if ($last_read != '') {
            if ($last_read <= $date_post and $userdata[3] != '' and $last_read != "0" and $userdata[0] != $myrow['poster_id']) {
                echo '&nbsp;<img src="' . $imgtmpNE . '" alt="" />';
            }
        }
        echo '
               </div>
               <div class="card-text pt-1">';
        if ($allow_bbcode and $forum_type != 6 and $forum_type != 5) {
            $message = smilie($message);
            $message = aff_video_yt($message);
        }
        if ($forum_type == '6' or $forum_type == '5') {
            highlight_string(stripslashes($myrow['post_text'])) . '<br /><br />';
        } else {
            echo str_replace('[addsig]', '<div class="n-signature">' . nl2br($posterdata['user_sig']) . '</div>', $message);
        }
        if ($att > 0) {
            $post_id = $myrow['post_id'];
            echo '<div class="card-text">';
            echo display_upload("forum_npds", $post_id, $Mmod);
            echo '</div>';
        }
        echo '
               </div>
            </div>
            <div class="card-footer">
               <div class="row">
                  <div class=" col-sm-6 text-muted small">' . post_convertdate($date_post) . '</div>
                  <div class=" col-sm-6 text-xs-right">';
        if ($forum_access != 9) {
            if ($allow_to_post) {
                echo aff_pub_in($lock_state, $topic, $forum, $myrow['post_id'], 1);
            }
            if ($Mmod or $posterdata['uid'] == $userdata[0] and !$lock_state and $posterdata['uid'] != '') {
                echo '<a class="mr-1" href="editpost.php?post_id=' . $myrow["post_id"] . '&amp;topic=' . $topic . '&amp;forum=' . $forum . '&amp;arbre=1" title="' . translate("Edit") . '" data-toggle="tooltip"><i class="fa fa-edit fa-lg"></i></a>';
                if ($allow_upload_forum) {
                    $PopUp = win_upload("forum_npds", $myrow['post_id'], $forum, $topic, "popup");
                    echo '<a class="mr-1" href="javascript:void(0);" onclick="window.open(' . $PopUp . ');" title="' . translate("Files") . '" data-toggle="tooltip"><i class="fa fa-download fa-lg"></i></a>';
                }
            }
            if ($allow_to_post and !$lock_state and $posterdata['uid'] != '') {
                echo '<a class="mr-1" href="replyH.php?topic=' . $topic . '&amp;forum=' . $forum . '&amp;post=' . $myrow['post_id'] . '&amp;citation=1" title="' . translate("Quote") . '" data-toggle="tooltip"><i class="fa fa-quote-left fa-lg"></i></a>';
            }
            echo '<a class="mr-1" href="prntopic.php?forum=' . $forum . '&amp;topic=' . $topic . '&amp;post_id=' . $myrow['post_id'] . '" title="' . translate("Print") . '" data-toggle="tooltip"><i class="fa fa-print fa-lg"></i></a>';
            if ($Mmod) {
                echo '<a class="mr-1" href="topicadmin.php?mode=viewip&amp;topic=' . $topic . '&amp;post=' . $myrow['post_id'] . '&amp;forum=' . $forum . '&amp;arbre=1" title="IP" data-toggle="tooltip" ><i class="fa fa-laptop fa-lg"></i></a>';
                if (!$myrow['post_aff']) {
                    echo '&nbsp;<a href="topicadmin.php?mode=aff&amp;topic=' . $topic . '&amp;post=' . $myrow['post_id'] . '&amp;ordre=1&amp;forum=' . $forum . '&amp;arbre=1" title="' . translate("Show this post") . '" data-toggle="tooltip"><i class="fa fa-eye text-danger fa-lg"></i></a>&nbsp;';
                } else {
                    echo '&nbsp;<a href="topicadmin.php?mode=aff&amp;topic=' . $topic . '&amp;post=' . $myrow['post_id'] . '&amp;ordre=0&amp;forum=' . $forum . '&amp;arbre=1" title="' . translate("Hide this post") . '" data-toggle="tooltip"><i class="fa fa-eye-slash fa-lg "></i></a>&nbsp;';
                }
            }
        }
        echo '
                     </div>
                  </div>
               </div>';
        if (isset($table[$key]) and ($maxlevel > $level + 1 or $maxlevel == '0')) {
            echo '
         <div><a class="float-xs-right" data-toggle="collapse" href="#tog_' . $idtog . '" aria-expanded="false" aria-controls=""><i class="togglearbr-icon fa fa-level-down fa-2x"></i></a></div>';
            //unset ($idtog);
            $result .= makebranch($key, $table, $level + 1, $maxlevel, $max_post_id, $clas, $idtog);
        }
        echo '
            </div>
         </div>
      </div>';
        $count++;
    }
    return $result;
}
コード例 #2
0
function makebranch($parcat, $table, $level, $maxlevel)
{
    $list = $table[$parcat];
    while (list($key, $val) = each($list)) {
        if ($level == "0") {
            $output = "";
        } else {
            $output = str_repeat("--", $level);
        }
        $result .= "{$output} <a href=genre.php?genreid={$key}>{$val}</a> ({$level})<br />\n";
        if (isset($table[$key]) and ($maxlevel > $level + 1 or $maxlevel == "0")) {
            $result .= makebranch($key, $table, $level + 1, $maxlevel);
        }
    }
    return $result;
}