当前位置: 首页>>代码示例>>PHP>>正文


PHP get_thread_link函数代码示例

本文整理汇总了PHP中get_thread_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_thread_link函数的具体用法?PHP get_thread_link怎么用?PHP get_thread_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_thread_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: spamalyser_build_post_path

function spamalyser_build_post_path(&$logitem)
{
    global $lang, $forums, $mybb;
    $bburl = htmlspecialchars_uni($mybb->settings['bburl'] . '/');
    $subject = htmlspecialchars_uni($logitem['subject']);
    if ($logitem['real_pid']) {
        $subject = '<a href="' . $bburl . get_post_link($logitem['pid'], $logitem['tid']) . '#pid' . $logitem['pid'] . '" target="_blank">' . $subject . '</a>';
    }
    if ($logitem['threadsubject']) {
        if ($logitem['real_tid']) {
            $subject = '<a href="' . $bburl . get_thread_link($logitem['tid']) . '" target="_blank">' . htmlspecialchars_uni($logitem['threadsubject']) . '</a> &raquo; ' . $subject;
        } else {
            $subject = htmlspecialchars_uni($logitem['threadsubject']) . ' &raquo; ' . $subject;
        }
    }
    if (empty($forums)) {
        $forums = $GLOBALS['cache']->read('forums');
    }
    if ($forums[$logitem['fid']]) {
        $subject = '<a href="' . $bburl . get_forum_link($logitem['fid']) . '" target="_blank">' . $forums[$logitem['fid']]['name'] . '</a> &raquo; ' . $subject;
    }
    // new/edit icons
    if ($logitem['event'] == 0) {
        $subject = '<img src="spamalyser_img/post_new.gif" title="' . $lang->icon_new_thread_post . '" alt="' . $lang->icon_alt_new_thread_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject;
    } elseif ($logitem['event'] == 2) {
        $subject = '<img src="spamalyser_img/post_merge.gif" title="' . $lang->icon_merge_post . '" alt="' . $lang->icon_alt_merge_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject;
    } else {
        $subject = '<img src="spamalyser_img/post_edit.gif" title="' . $lang->icon_edit_thread_post . '" alt="' . $lang->icon_alt_edit_thread_post . '" style="margin-right: 0.5em; font-size: smaller; vertical-align: middle;" />' . $subject;
    }
    return $subject;
}
开发者ID:andarms,项目名称:python-gaming.com,代码行数:31,代码来源:spamalyserlog.php

示例2: trader_give_rep

function trader_give_rep($uid = 1)
{
    global $mybb, $db, $tradefeedbackform, $mypostkey, $templates, $header, $headerinclude, $footer, $lang;
    $lang->load("tradefeedback");
    $uid = intval($uid);
    $action = "give";
    if ($mybb->user['uid'] == $uid) {
        error($lang->feedback_give_self);
    }
    if (!$uid) {
        error($lang->feedback_invalid_user);
    }
    if ($mybb->request_method == "post" && verify_post_check($mybb->input['my_post_key'])) {
        // Make sure they haven't given the same user feedback within the last 24 hours
        $cutoff = TIME_NOW - 86400;
        $queryfirst = $db->simple_select("trade_feedback", "fid", "dateline >= {$cutoff} AND receiver={$uid} & giver=" . $mybb->user['uid']);
        if ($db->num_rows($queryfirst) >= 1) {
            error($lang->feedback_wait_24);
        }
        $new_rep = array("giver" => $mybb->user['uid'], "receiver" => $uid, "dateline" => TIME_NOW, "approved" => 1, "value" => intval($mybb->input['value']), "type" => $db->escape_string($mybb->input['type']), "threadlink" => $db->escape_string($mybb->input['threadlink']), "comments" => $db->escape_string($mybb->input['comments']));
        if ($mybb->settings['trade_approval'] == 1 && $mybb->usergroup['canmodcp'] == 0) {
            $new_rep['approved'] = 0;
        }
        $db->insert_query("trade_feedback", $new_rep);
        $fid = $db->insert_id();
        trader_send_pm($new_rep['receiver'], $fid);
        trader_myalerts($new_rep['receiver'], $fid);
        if ($new_rep['approved'] == 1) {
            trader_rebuild_reputation($uid);
            $message = $lang->give_feedback_added;
        } else {
            $message = $lang->give_feedback_approval_needed;
        }
        $url = $mybb->settings['bburl'] . "/tradefeedback.php?action=view&uid={$uid}";
        redirect($url, $message, "", true);
    } else {
        // Check if we have a thread id
        $tid = intval($mybb->input['tid']);
        if ($tid) {
            $threadlink_value = $mybb->settings['bburl'] . "/" . get_thread_link($tid);
            $query = $db->simple_select("threads", "subject", "tid={$tid}");
            $thread_subject = $db->fetch_field($query, "subject");
            $breadcrumb = $lang->sprintf($lang->give_feedback_fromthread_breadcrumb, $thread_subject);
        } else {
            $threadlink_value = "";
        }
        // Get the member username for confirmation
        $query = $db->simple_select("users", "uid, username", "uid={$uid}");
        $member = $db->fetch_array($query);
        $member['username'] = htmlspecialchars_uni($member['username']);
        add_breadcrumb($lang->sprintf($lang->feedback_profile, $member['username']), get_profile_link($uid));
        add_breadcrumb($lang->sprintf($lang->feedback_page_title, $member['username']), "tradefeedback.php?action=view&uid={$uid}");
        add_breadcrumb($lang->give_feedback . $breadcrumb, "tradefeedback.php?action=give&uid={$uid}");
        $feedback = array('comments' => htmlspecialchars_uni($mybb->input['comments']));
        eval("\$tradefeedbackform = \"" . $templates->get("tradefeedback_give_form") . "\";");
        output_page($tradefeedbackform);
    }
}
开发者ID:jnschrag,项目名称:Trade-Feedback,代码行数:58,代码来源:tradefeedback.php

示例3: reportthread_dopost

function reportthread_dopost()
{
    require_once MYBB_ROOT . "inc/datahandlers/post.php";
    global $db, $mybb;
    if (intval($mybb->settings['rtt_enabled']) == 1 || preg_replace("/[^a-z]/i", "", $mybb->settings['rtt_enabled']) == "yes") {
        if ($mybb->input['type'] == 'post') {
            $title = "Reported Post By ";
            $post = get_post($mybb->input['pid']);
            $thread = get_thread($post['tid']);
            $forum = get_forum($thread['fid']);
            $tlink = get_thread_link($thread['tid']);
            $flink = get_forum_link($thread['fid']);
            $reason = $mybb->input['reason'];
            if ($reason === 'other') {
                $reason = $mybb->input['comment'];
            }
            $post_data = $mybb->user['username'] . " has reported a post.\r\n\r\nOriginal Thread: [url=" . $mybb->settings['bburl'] . "/{$tlink}]" . $thread['subject'] . "[/url]\r\nForum: [url=" . $mybb->settings['bburl'] . "/{$flink}]" . $forum['name'] . "[/url]\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nPost Content:\r\n[quote=\"" . $post['username'] . "\" pid=\"" . $post['pid'] . "\" dateline=\"" . $post['dateline'] . "\"]" . $post['message'] . "[/quote]";
        } else {
            if ($mybb->input['type'] == 'reputation') {
                $title = "Reported Reputation By ";
                $rep = get_reputation_point($mybb->input['pid']);
                $giver = get_user($rep['adduid']);
                $reason = $mybb->input['reason'];
                if ($reason === 'other') {
                    $reason = $mybb->input['comment'];
                }
                $post_data = $mybb->user['username'] . " has reported a reputation point.\r\n\r\nReason Given:\r\n[quote=\"" . $mybb->user['username'] . "\" dateline=\"" . time() . "\"]" . $reason . "[/quote]\r\n\r\nReputation comment:\r\n[quote=\"" . $giver['username'] . "\" dateline=\"" . $rep['dateline'] . "\"]" . $rep['comments'] . "[/quote]";
            }
        }
        $new_thread = array("fid" => $mybb->settings['rtt_fid'], "prefix" => 0, "subject" => $title . $mybb->user['username'], "icon" => 0, "uid" => $mybb->user['uid'], "username" => $mybb->user['username'], "message" => $post_data, "ipaddress" => get_ip(), "posthash" => md5($mybb->user['uid'] . random_str()));
        $posthandler = new PostDataHandler("insert");
        $posthandler->action = "thread";
        $posthandler->set_data($new_thread);
        if ($posthandler->validate_thread()) {
            $thread_info = $posthandler->insert_thread();
        }
    }
}
开发者ID:ateista-pl,项目名称:forum,代码行数:38,代码来源:reportthread.php

示例4: akismet_redirect_thread

function akismet_redirect_thread()
{
    global $isspam, $url, $lang, $thread, $mybb;
    if ($isspam && $mybb->settings['akismetswitch'] == 1) {
        $lang->load("akismet", false, true);
        $url = get_thread_link($thread['tid']);
        $url2 = get_forum_link($thread['fid']);
        error("<div align=\"center\">" . $lang->redirect_newreply . "<br /><br />" . $lang->sprintf($lang->redirect_return_forum, $url, $url2) . "</div>", $lang->akismet_error);
    }
}
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:10,代码来源:akismet.php

示例5: build_profile_link

     }
     if (!$similar_thread['username']) {
         $similar_thread['username'] = $similar_thread['threadusername'];
         $similar_thread['profilelink'] = $similar_thread['threadusername'];
     } else {
         $similar_thread['profilelink'] = build_profile_link($similar_thread['username'], $similar_thread['uid']);
     }
     // If this thread has a prefix, insert a space between prefix and subject
     if ($similar_thread['prefix'] != 0) {
         $prefix = build_prefixes($similar_thread['prefix']);
         $similar_thread['threadprefix'] = $prefix['displaystyle'] . '&nbsp;';
     }
     $similar_thread['subject'] = $parser->parse_badwords($similar_thread['subject']);
     $similar_thread['subject'] = htmlspecialchars_uni($similar_thread['subject']);
     $similar_thread['threadlink'] = get_thread_link($similar_thread['tid']);
     $similar_thread['lastpostlink'] = get_thread_link($similar_thread['tid'], 0, "lastpost");
     $lastpostdate = my_date($mybb->settings['dateformat'], $similar_thread['lastpost']);
     $lastposttime = my_date($mybb->settings['timeformat'], $similar_thread['lastpost']);
     $lastposter = $similar_thread['lastposter'];
     $lastposteruid = $similar_thread['lastposteruid'];
     // Don't link to guest's profiles (they have no profile).
     if ($lastposteruid == 0) {
         $lastposterlink = $lastposter;
     } else {
         $lastposterlink = build_profile_link($lastposter, $lastposteruid);
     }
     $similar_thread['replies'] = my_number_format($similar_thread['replies']);
     $similar_thread['views'] = my_number_format($similar_thread['views']);
     eval("\$similarthreadbits .= \"" . $templates->get("showthread_similarthreads_bit") . "\";");
 }
 if ($count) {
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:showthread.php

示例6: Table

 }
 $table = new Table();
 $table->construct_header($lang->username, array('width' => '10%'));
 $table->construct_header($lang->date, array("class" => "align_center", 'width' => '15%'));
 $table->construct_header($lang->action, array("class" => "align_center", 'width' => '35%'));
 $table->construct_header($lang->information, array("class" => "align_center", 'width' => '30%'));
 $table->construct_header($lang->ipaddress, array("class" => "align_center", 'width' => '10%'));
 $query = $db->query("\n\t\tSELECT l.*, u.username, u.usergroup, u.displaygroup, t.subject AS tsubject, f.name AS fname, p.subject AS psubject\n\t\tFROM " . TABLE_PREFIX . "moderatorlog l\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=l.uid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=l.tid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid=l.fid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (p.pid=l.pid)\n\t\t{$where}\n\t\tORDER BY {$sortby} {$order}\n\t\tLIMIT {$start}, {$perpage}\n\t");
 while ($logitem = $db->fetch_array($query)) {
     $information = '';
     $logitem['dateline'] = date("jS M Y, G:i", $logitem['dateline']);
     $trow = alt_trow();
     $username = format_name($logitem['username'], $logitem['usergroup'], $logitem['displaygroup']);
     $logitem['profilelink'] = build_profile_link($username, $logitem['uid']);
     if ($logitem['tsubject']) {
         $information = "<strong>{$lang->thread}</strong> <a href=\"../" . get_thread_link($logitem['tid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($logitem['tsubject']) . "</a><br />";
     }
     if ($logitem['fname']) {
         $information .= "<strong>{$lang->forum}</strong> <a href=\"../" . get_forum_link($logitem['fid']) . "\" target=\"_blank\">" . htmlspecialchars_uni($logitem['fname']) . "</a><br />";
     }
     if ($logitem['psubject']) {
         $information .= "<strong>{$lang->post}</strong> <a href=\"../" . get_post_link($logitem['pid']) . "#pid{$logitem['pid']}\">" . htmlspecialchars_uni($logitem['psubject']) . "</a>";
     }
     $table->construct_cell($logitem['profilelink']);
     $table->construct_cell($logitem['dateline'], array("class" => "align_center"));
     $table->construct_cell($logitem['action'], array("class" => "align_center"));
     $table->construct_cell($information);
     $table->construct_cell($logitem['ipaddress'], array("class" => "align_center"));
     $table->construct_row();
 }
 if ($table->num_rows() == 0) {
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:31,代码来源:modlog.php

示例7: build_friendly_wol_location


//.........这里部分代码省略.........
    if (!is_array($forums) && count($fid_list) > 0) {
        $fidnot = array_merge($unviewablefids, $inactivefids);
        foreach ($forum_cache as $fid => $forum) {
            if (in_array($fid, $fid_list) && !in_array($fid, $fidnot)) {
                $forums[$fid] = $forum['name'];
                $forums_linkto[$fid] = $forum['linkto'];
            }
        }
    }
    // And finaly any events
    if (!is_array($events) && count($eid_list) > 0) {
        $eid_sql = implode(",", $eid_list);
        $query = $db->simple_select("events", "eid,name", "eid IN ({$eid_sql})");
        while ($event = $db->fetch_array($query)) {
            $events[$event['eid']] = htmlspecialchars_uni($parser->parse_badwords($event['name']));
        }
    }
    // Now we've got everything we need we can put a name to the location
    switch ($user_activity['activity']) {
        // announcement.php functions
        case "announcements":
            if (!empty($announcements[$user_activity['ann']])) {
                $location_name = $lang->sprintf($lang->viewing_announcements, get_announcement_link($user_activity['ann']), $announcements[$user_activity['ann']]);
            } else {
                $location_name = $lang->viewing_announcements2;
            }
            break;
            // attachment.php actions
        // attachment.php actions
        case "attachment":
            $pid = $attachments[$user_activity['aid']];
            $tid = $posts[$pid];
            if (!empty($threads[$tid])) {
                $location_name = $lang->sprintf($lang->viewing_attachment2, $user_activity['aid'], $threads[$tid], get_thread_link($tid));
            } else {
                $location_name = $lang->viewing_attachment;
            }
            break;
            // calendar.php functions
        // calendar.php functions
        case "calendar":
            $location_name = $lang->viewing_calendar;
            break;
        case "calendar_event":
            if (!empty($events[$user_activity['eid']])) {
                $location_name = $lang->sprintf($lang->viewing_event2, get_event_link($user_activity['eid']), $events[$user_activity['eid']]);
            } else {
                $location_name = $lang->viewing_event;
            }
            break;
        case "calendar_addevent":
            $location_name = $lang->adding_event;
            break;
        case "calendar_editevent":
            $location_name = $lang->editing_event;
            break;
        case "contact":
            $location_name = $lang->viewing_contact_us;
            break;
            // editpost.php functions
        // editpost.php functions
        case "editpost":
            $location_name = $lang->editing_post;
            break;
            // forumdisplay.php functions
        // forumdisplay.php functions
开发者ID:olada,项目名称:mybbintegrator,代码行数:67,代码来源:functions_online.php

示例8: error

        $ismod = false;
    }
    // Make sure we are looking at a real thread here.
    if ($thread['visible'] != 1 && $ismod == false || $thread['visible'] > 1 && $ismod == true) {
        error($lang->error_invalidthread);
    }
    $forumpermissions = forum_permissions($thread['fid']);
    if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']) {
        error_no_permission();
    }
    $plugins->run_hooks("usercp2_do_addsubscription");
    add_subscribed_thread($thread['tid'], $mybb->get_input('notification', MyBB::INPUT_INT));
    if ($mybb->get_input('referrer')) {
        $url = htmlspecialchars_uni($mybb->get_input('referrer'));
    } else {
        $url = get_thread_link($thread['tid']);
    }
    redirect($url, $lang->redirect_subscriptionadded);
} elseif ($mybb->get_input('action') == "addsubscription") {
    if ($mybb->get_input('type') == "forum") {
        $forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
        if (!$forum) {
            error($lang->error_invalidforum);
        }
        $forumpermissions = forum_permissions($forum['fid']);
        if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) {
            error_no_permission();
        }
        $plugins->run_hooks("usercp2_addsubscription_forum");
        add_subscribed_forum($forum['fid']);
        if ($server_http_referer) {
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:usercp2.php

示例9: archive_error

 }
 if ($thread['visible'] != 1) {
     if (is_moderator($forum['fid'])) {
         archive_error($lang->sprintf($lang->error_unapproved_thread, $mybb->settings['bburl'] . "/" . get_thread_link($thread['tid'], $page)));
     } else {
         archive_error($lang->error_invalidthread);
     }
 }
 if ($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
     archive_error_no_permission();
 }
 check_forum_password_archive($forum['fid']);
 // Build the navigation
 build_forum_breadcrumb($forum['fid'], 1);
 add_breadcrumb($thread['subject']);
 archive_header($thread['subject'], $thread['subject'], $mybb->settings['bburl'] . "/" . get_thread_link($thread['tid'], $page));
 $plugins->run_hooks("archive_thread_start");
 if (!$mybb->settings['postsperpage'] || (int) $mybb->settings['postsperpage'] < 1) {
     $mybb->settings['postsperpage'] = 20;
 }
 // Paginate this thread
 $perpage = $mybb->settings['postsperpage'];
 $postcount = intval($thread['replies']) + 1;
 $pages = ceil($postcount / $perpage);
 if ($page > $pages) {
     $page = 1;
 }
 if ($page) {
     $start = ($page - 1) * $perpage;
 } else {
     $start = 0;
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:index.php

示例10: foreach

    if ($poll['multiple'] == 1) {
        foreach ($vote_options as $vote) {
            if (isset($votesarray[$vote - 1])) {
                --$votesarray[$vote - 1];
                --$poll['numvotes'];
            }
        }
    } else {
        $voteoption = reset($vote_options);
        if (isset($votesarray[$voteoption - 1])) {
            --$votesarray[$voteoption - 1];
            --$poll['numvotes'];
        }
    }
    // check if anything < 0 - possible if Guest vote undoing is allowed (generally Guest unvoting should be disabled >_>)
    if ($poll['numvotes'] < 0) {
        $poll['numvotes'] = 0;
    }
    foreach ($votesarray as $i => $votes) {
        if ($votes < 0) {
            $votesarray[$i] = 0;
        }
    }
    $voteslist = implode("||~|~||", $votesarray);
    $updatedpoll = array("votes" => $db->escape_string($voteslist), "numvotes" => (int) $poll['numvotes']);
    $plugins->run_hooks("polls_do_undovote_process");
    $db->delete_query("pollvotes", "uid='" . $mybb->user['uid'] . "' AND pid='" . $poll['pid'] . "'");
    $db->update_query("polls", $updatedpoll, "pid='" . $poll['pid'] . "'");
    $plugins->run_hooks("polls_do_undovote_end");
    redirect(get_thread_link($poll['tid']), $lang->redirect_unvoted);
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:polls.php

示例11: intval

$perpage = $mybb->settings['postsperpage'];
$postcount = intval($thread['replies']) + 1;
$pages = ceil($postcount / $perpage);
if ($page > $pages) {
    $page = 1;
}
if ($page > 0) {
    $start = ($page - 1) * $perpage;
} else {
    $start = 0;
    $page = 1;
}
if ($postcount > $perpage) {
    $multipage = printthread_multipage($postcount, $perpage, $page, "printthread.php?tid={$tid}");
}
$thread['threadlink'] = get_thread_link($tid);
$postrows = '';
if (is_moderator($forum['fid'])) {
    $visible = "AND (p.visible='0' OR p.visible='1')";
} else {
    $visible = "AND p.visible='1'";
}
$query = $db->query("\r\n    SELECT u.*, u.username AS userusername, p.*\r\n    FROM " . TABLE_PREFIX . "posts p\r\n    LEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=p.uid)\r\n    WHERE p.tid='{$tid}' {$visible}\r\n    ORDER BY p.dateline\r\n\tLIMIT {$start}, {$perpage}\r\n");
while ($postrow = $db->fetch_array($query)) {
    if ($postrow['userusername']) {
        $postrow['username'] = $postrow['userusername'];
    }
    $postrow['subject'] = htmlspecialchars_uni($parser->parse_badwords($postrow['subject']));
    $postrow['date'] = my_date($mybb->settings['dateformat'], $postrow['dateline']);
    $postrow['time'] = my_date($mybb->settings['timeformat'], $postrow['dateline']);
    $postrow['profilelink'] = build_profile_link($postrow['username'], $postrow['uid']);
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:printthread.php

示例12: asb_rand_quote_get_quote

function asb_rand_quote_get_quote($settings, $width)
{
    global $db, $mybb, $templates, $lang, $theme;
    if (!$lang->asb_addon) {
        $lang->load('asb_addon');
    }
    // get forums user cannot view
    $unviewable = get_unviewable_forums(true);
    if ($unviewable) {
        $unviewwhere = " AND p.fid NOT IN ({$unviewable})";
    }
    // get inactive forums
    $inactive = get_inactive_forums();
    if ($inactive) {
        $inactivewhere = " AND p.fid NOT IN ({$inactive})";
    }
    if ($settings['important_threads_only']) {
        $important_threads = ' AND NOT t.sticky=0';
    }
    // build the exclude conditions
    $show['fids'] = asb_build_id_list($settings['forum_show_list'], 'p.fid');
    $show['tids'] = asb_build_id_list($settings['thread_show_list'], 'p.tid');
    $hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 'p.fid');
    $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid');
    $where['show'] = asb_build_SQL_where($show, ' OR ');
    $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
    $query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
    $post_query = $db->query("\n\t\tSELECT\n\t\t\tp.pid, p.message, p.fid, p.tid, p.subject, p.uid,\n\t\t\tu.username, u.usergroup, u.displaygroup, u.avatar,\n\t\t\tt.sticky\n\t\tFROM {$db->table_prefix}posts p\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=p.uid)\n\t\tLEFT JOIN {$db->table_prefix}threads t ON (t.tid=p.tid)\n\t\tWHERE\n\t\t\tp.visible='1'{$query_where}\n\t\tORDER BY\n\t\t\tRAND()\n\t\tLIMIT 1;");
    // if there was 1 . . .
    if ($db->num_rows($post_query) == 0) {
        return false;
    }
    $rand_post = $db->fetch_array($post_query);
    // build a post parser
    require_once MYBB_ROOT . 'inc/class_parser.php';
    $parser = new postParser();
    // we just need the text and smilies (we'll parse them after we check length)
    $pattern = "|[[\\/\\!]*?[^\\[\\]]*?]|si";
    $new_message = asb_strip_url(preg_replace($pattern, '$1', $rand_post['message']));
    // get some dimensions that make sense in relation to column width
    $asb_width = (int) $width;
    $asb_inner_size = $asb_width * 0.83;
    $avatar_size = (int) ($asb_inner_size / 5);
    $font_size = $asb_width / 4.5;
    $font_size = max(10, min(16, $font_size));
    $username_font_size = (int) ($font_size * 0.9);
    $title_font_size = (int) ($font_size * 0.65);
    $message_font_size = (int) $font_size;
    if (strlen($new_message) < $settings['min_length']) {
        if ($settings['default_text']) {
            $new_message = $settings['default_text'];
        } else {
            // nothing to show
            return false;
        }
    }
    if ($settings['max_length'] && strlen($new_message) > $settings['max_length']) {
        $new_message = substr($new_message, 0, $settings['max_length']) . ' . . .';
    }
    // set up the user name link so that it displays correctly for the display group of the user
    $plain_text_username = htmlspecialchars_uni($rand_post['username']);
    $username = format_name($plain_text_username, $rand_post['usergroup'], $rand_post['displaygroup']);
    $author_link = get_profile_link($rand_post['uid']);
    $post_link = get_post_link($rand_post['pid'], $rand_post['tid']) . '#pid' . $rand_post['pid'];
    $thread_link = get_thread_link($rand_post['tid']);
    // allow smilies, but kill
    $parser_options = array("allow_smilies" => 1);
    $new_message = str_replace(array('<br />', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options));
    // if the user has an avatar then display it, otherwise force the default avatar.
    $avatar_filename = "{$theme['imgdir']}/default_avatar.gif";
    if ($rand_post['avatar'] != '') {
        $avatar_filename = $rand_post['avatar'];
    }
    $avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username);
    eval("\$read_more = \"" . $templates->get('asb_rand_quote_read_more') . "\";");
    if (my_strlen($rand_post['subject']) > 40) {
        $rand_post['subject'] = my_substr($rand_post['subject'], 0, 40) . ' . . .';
    }
    if (substr(strtolower($rand_post['subject']), 0, 3) == 're:') {
        $rand_post['subject'] = substr($rand_post['subject'], 3);
    }
    $rand_post['subject'] = htmlspecialchars_uni($parser->parse_badwords($rand_post['subject']));
    $thread_title_link = <<<EOF
<strong><a href="{$thread_link}" title="{$lang->asb_random_quotes_read_more_threadlink_title}"><span style="font-size: {$title_font_size}px;">{$rand_post['subject']}</span></a></strong>
EOF;
    // eval() the template
    eval("\$this_quote = \"" . $templates->get("asb_rand_quote_sidebox") . "\";");
    return $this_quote;
}
开发者ID:badboy4life91,项目名称:Advanced-Sidebox,代码行数:89,代码来源:rand_quote.php

示例13: foreach

    }
}
// Most viewed threads
$most_viewed = $cache->read("most_viewed_threads");
if (!$most_viewed) {
    $cache->update_most_viewed_threads();
    $most_viewed = $cache->read("most_viewed_threads", true);
}
$mostviews = '';
if (!empty($most_viewed)) {
    foreach ($most_viewed as $key => $thread) {
        if (!in_array($thread['fid'], $unviewableforumsarray)) {
            $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
            $numberbit = my_number_format($thread['views']);
            $numbertype = $lang->views;
            $thread['threadlink'] = get_thread_link($thread['tid']);
            eval("\$mostviews .= \"" . $templates->get("stats_thread") . "\";");
        }
    }
}
$statistics = $cache->read('statistics');
$mybb->settings['statscachetime'] = (int) $mybb->settings['statscachetime'];
if ($mybb->settings['statscachetime'] < 1) {
    $mybb->settings['statscachetime'] = 0;
}
$interval = (int) $mybb->settings['statscachetime'] * 60860;
if (!$statistics || TIME_NOW - $interval > $statistics['time'] || $mybb->settings['statscachetime'] == 0) {
    $cache->update_statistics();
    $statistics = $cache->read('statistics');
}
// Top forum
开发者ID:GODEXTREME,项目名称:UO-PHP-Files,代码行数:31,代码来源:stats.php

示例14: ps_GetMostViewed

function ps_GetMostViewed($NumOfRows)
{
    global $mybb, $db, $templates, $theme, $lang, $unviewables, $under_mod_forums_arr, $vcheck, $parser, $ps_align;
    if (!is_object($parser)) {
        require_once MYBB_ROOT . 'inc/class_parser.php';
        $parser = new postParser();
    }
    $query = $db->query("\n\t\tSELECT t.subject,t.tid,t.fid,t.lastpost,t.views,t.visible,tr.uid AS truid,tr.dateline \n\t\tFROM " . TABLE_PREFIX . "threads t \n\t\tLEFT JOIN " . TABLE_PREFIX . "threadsread tr ON (tr.tid=t.tid AND tr.uid='" . $mybb->user['uid'] . "') \n\t\tLEFT JOIN " . TABLE_PREFIX . "forums f ON (f.fid = t.fid) \n\t\tWHERE (t.visible = '1' " . $vcheck . ") \n\t\t" . $unviewables['string'] . " \n\t\tAND t.closed NOT LIKE 'moved|%' \n\t\tAND t.visible != '-2' \n\t\tAND f.active = '1' \n\t\tORDER BY t.views DESC \n\t\tLIMIT 0," . $NumOfRows);
    while ($most_views = $db->fetch_array($query)) {
        $subject_long = htmlspecialchars_uni($parser->parse_badwords($most_views['subject']));
        $tid = $most_views['tid'];
        $subject = htmlspecialchars_uni(ps_SubjectLength($parser->parse_badwords($most_views['subject']), NULL, true));
        $views = $most_views['views'];
        $lightbulb['folder'] = "off";
        $highlight = ps_GetHighlight($most_views);
        if ($mybb->user['uid']) {
            if ($most_views['dateline'] && $most_views['truid'] == $mybb->user['uid']) {
                if ($most_views['lastpost'] > $most_views['dateline']) {
                    $lightbulb['folder'] = "on";
                }
            } else {
                if ($most_views['lastpost'] > $mybb->user['lastvisit']) {
                    $lightbulb['folder'] = "on";
                }
            }
        }
        $threadlink = $mybb->settings['bburl'] . '/' . get_thread_link($tid);
        eval("\$readstate_icon = \"" . $templates->get("prostats_readstate_icon") . "\";");
        eval("\$mostviews_row .= \"" . $templates->get("prostats_mostviews_row") . "\";");
    }
    eval("\$column_mostviews = \"" . $templates->get("prostats_mostviews") . "\";");
    return $column_mostviews;
}
开发者ID:Sama34,项目名称:ProStats,代码行数:33,代码来源:prostats.php

示例15: MSB_newthread

function MSB_newthread()
{
    global $mybb, $tid, $settings, $lang, $forum;
    if (!in_array((int) $forum['fid'], explode(',', $mybb->settings['miunashout_folder_acc']))) {
        $lang->load('admin/config_miunashoutbox');
        $name = format_name($mybb->user['username'], $mybb->user['usergroup'], $mybb->user['displaygroup']);
        $link = '[url=' . $settings['bburl'] . '/' . get_thread_link($tid) . ']' . $mybb->input['subject'] . '[/url]';
        $linklang = $lang->sprintf($lang->miunashoutbox_newthread_lang, $link);
        $data = array("nick" => $name, "msg" => $linklang, "nickto" => "0", "uid" => $mybb->user['uid'], "gid" => $mybb->user['usergroup'], "colorsht" => $mybb->settings['miunashout_newpt_color'], "bold" => "NaN", "font" => "NaN", "size" => "NaN", "avatar" => $mybb->user['avatar'], "uidto" => "0," . $thread['uid'] . "", "type" => "system", "token" => msb_token_gen());
        sendPostDataMSB('newposthread', $data);
    }
}
开发者ID:badcompany,项目名称:Miuna-Shoutbox-Client,代码行数:12,代码来源:miunashoutbox.php


注:本文中的get_thread_link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。