function commenttable($rows, $redaktor = "comment")
{
    global $CURUSER, $avatar_max_width;
    $count = 0;
    foreach ($rows as $row) {
        if ($row["downloaded"] > 0) {
            $ratio = $row['uploaded'] / $row['downloaded'];
            $ratio = number_format($ratio, 2);
        } elseif ($row["uploaded"] > 0) {
            $ratio = "Inf.";
        } else {
            $ratio = "---";
        }
        if (strtotime($row["last_access"]) > gmtime() - 600) {
            $online = "online";
            $online_text = "В сети";
        } else {
            $online = "offline";
            $online_text = "Не в сети";
        }
        print "<table class=maibaugrand width=100% border=1 cellspacing=0 cellpadding=3>";
        print "<tr><td class=colhead align=\"left\" colspan=\"2\" height=\"24\">";
        if (isset($row["username"])) {
            $title = $row["title"];
            if ($title == "") {
                $title = get_user_class_name($row["class"]);
            } else {
                $title = htmlspecialchars_uni($title);
            }
            print ":: <img src=\"pic/buttons/button_" . $online . ".gif\" alt=\"" . $online_text . "\" title=\"" . $online_text . "\" style=\"position: relative; top: 2px;\" border=\"0\" height=\"14\">" . " <a name=comm" . $row["id"] . " href=userdetails.php?id=" . $row["user"] . " class=altlink_white><b>" . get_user_class_color($row["class"], htmlspecialchars_uni($row["username"])) . "</b></a> ::" . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=\"/pic/warned.gif\" alt=\"Warned\">" : "") . " {$title} ::\n" . " <img src=\"pic/upl.gif\" alt=\"upload\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["uploaded"]) . " :: <img src=\"pic/down.gif\" alt=\"download\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["downloaded"]) . " :: <font color=\"" . get_ratio_color($ratio) . "\">{$ratio}</font> :: ";
        } else {
            print "<a name=\"comm" . $row["id"] . "\"><i>[Anonymous]</i></a>\n";
        }
        $avatar = $CURUSER["avatars"] == "yes" ? htmlspecialchars_uni($row["avatar"]) : "";
        if (!$avatar) {
            $avatar = "pic/default_avatar.gif";
        }
        if (md5($row['text']) == $row['text_hash']) {
            $text = $row['text_parsed'];
        } else {
            $text = format_comment($row['text']);
            sql_query('INSERT INTO comments_parsed (cid, text_hash, text_parsed) VALUES (' . implode(', ', array_map('sqlesc', array($row['id'], md5($row['text']), $text))) . ')') or sqlerr(__FILE__, __LINE__);
        }
        if ($row["editedby"]) {
            //$res = mysql_fetch_assoc(sql_query("SELECT * FROM users WHERE id = $row[editedby]")) or sqlerr(__FILE__,__LINE__);
            $text .= "<p><font size=1 class=small>Последний раз редактировалось <a href=userdetails.php?id={$row['editedby']}><b>{$row['editedbyname']}</b></a> в {$row['editedat']}</font></p>\n";
        }
        print "</td></tr>";
        print "<tr valign=top>\n";
        print "<td style=\"padding: 0px; width: 5%;\" align=\"center\"><img src={$avatar} width=\"{$avatar_max_width}\"> </td>\n";
        print "<td width=100% class=text>";
        //print("<span style=\"float: right\"><a href=\"#top\"><img title=\"Top\" src=\"pic/top.gif\" alt=\"Top\" border=\"0\" width=\"15\" height=\"13\"></a></span>");
        print "{$text}</td>\n";
        print "</tr>\n";
        print "<tr><td class=colhead align=\"center\" colspan=\"2\">";
        print "<div style=\"float: left; width: auto;\">" . ($CURUSER ? " [<a href=\"" . $redaktor . ".php?action=quote&amp;cid={$row['id']}\" class=\"altlink_white\">Цитата</a>]" : "") . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? " [<a href=" . $redaktor . ".php?action=edit&amp;cid={$row['id']} class=\"altlink_white\">Изменить</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=delete&amp;cid={$row['id']}\" class=\"altlink_white\">Удалить</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=vieworiginal&amp;cid={$row['id']}\" class=\"altlink_white\">Оригинал</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " IP: " . ($row["ip"] ? "<a href=\"usersearch.php?ip={$row['ip']}\" class=\"altlink_white\">" . $row["ip"] . "</a>" : "Неизвестен") : "") . "</div>";
        print "<div align=\"right\"><!--<font size=1 class=small>-->Комментарий добавлен: " . $row["added"] . " GMT<!--</font>--></td></tr>";
        print "</table><br>";
    }
}
Exemple #2
0
 public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false)
 {
     $postinfo =& $this->content['cms_post'][$activity['contentid']];
     $nodeinfo =& $this->content['cms_node'][$postinfo['nodeid']];
     $articleinfo =& $this->content['cms_article'][$nodeinfo['contentid']];
     $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true);
     $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']);
     $preview = strip_quotes($postinfo['pagetext']);
     $articleinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet'])));
     $articleinfo['fullurl'] = vB_Route::create('vBCms_Route_Content', $nodeinfo['nodeid'] . ($nodeinfo['url'] == '' ? '' : '-' . $nodeinfo['url']))->getCurrentURL();
     $nodeinfo['parenturl'] = $this->fetchParentUrl($nodeinfo['parentnode']);
     $nodeinfo['parenttitle'] = $this->fetchParentTitle($nodeinfo['parentnode']);
     $userinfo = $this->fetchUser($activity['userid'], $postinfo['username']);
     if ($fetchphrase) {
         if ($userinfo['userid']) {
             $phrase = construct_phrase($this->vbphrase['x_commented_on_an_article_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']);
         } else {
             $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_an_article_y_in_z'], $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']);
         }
         return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity);
     } else {
         $templater = vB_Template::create($templatename);
         $templater->register('userinfo', $userinfo);
         $templater->register('postinfo', $postinfo);
         $templater->register('activity', $activity);
         $templater->register('nodeinfo', $nodeinfo);
         $templater->register('articleinfo', $articleinfo);
         return $templater->render();
     }
 }
function automedia_xxxymovies($message)
{
    global $mybb, $width, $height;
    $w = $width;
    $h = $height;
    /**
     *Example:
     *http://www.xxxymovies.com/164396/
    */
    $pattern = "<http://www.xxxymovies.com/([0-9]{1,12})/\" target>";
    if (preg_match($pattern, $message)) {
        preg_match_all($pattern, $message, $links);
        $link = $links[1];
        foreach ($link as $url) {
            $site = htmlspecialchars_uni("http://www.xxxymovies.com/" . $url . "/");
            $data = fetch_remote_file($site);
            if ($data) {
                $nrxxx = get_avmatch('~rel="video_src" href="([\\w\\.\\/:-_]+)"~i', $data);
                $vid = array($nrxxx);
            }
            $limit = 1;
            foreach ($vid as $id) {
                $n = htmlspecialchars_uni($id);
                $message = preg_replace("#(\\[automedia\\]|<a href=\"(http://)(?:www\\.)?xxxymovies\\.com/([0-9]{1,12})/(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed src=\"{$n}\" loop=\"false\" width=\"{$w}\" height=\"{$h}\" allowfullscreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></div>", $message, $limit);
            }
        }
    }
    return $message;
}
function upgrade15_usernameupdate()
{
    global $db, $output, $mybb;
    $output->print_header("Performing Queries");
    echo "<p>Performing username updates..</p>";
    flush();
    require_once MYBB_ROOT . "inc/datahandler.php";
    require_once MYBB_ROOT . "inc/datahandlers/user.php";
    $not_renameable = array();
    // Because commas can cause some problems with private message sending in usernames we have to remove them
    $query = $db->simple_select("users", "uid, username", "username LIKE '%,%'");
    while ($user = $db->fetch_array($query)) {
        $userhandler = new UserDataHandler('update');
        $updated_user = array("uid" => $user['uid'], "username" => str_replace(',', '', $user['username']));
        $userhandler->set_data($updated_user);
        if (!$userhandler->validate_user()) {
            $not_renameable[] = htmlspecialchars_uni($user['username']);
        } else {
            $userhandler->update_user();
        }
    }
    if (!empty($not_renameable)) {
        echo "<span style=\"color: red;\">NOTICE:</span> The following users could not be renamed automatically. Please rename these users in the Admin CP manually after the upgrade process has finished completing:<br />\n\t\t<ul>\n\t\t<li>";
        echo implode('</li>\\n<li>', $not_renameable);
        echo "</li>\n\t\t</ul>";
    }
    $contents .= "Click next to continue with the upgrade process.</p>";
    $output->print_contents($contents);
    $output->print_footer("15_done");
}
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;
}
Exemple #6
0
function maketable($res)
{
    global $tracker_lang, $use_ttl, $ttl_days;
    $ret = "<table class=main border=1 cellspacing=0 cellpadding=5>" . "<tr><td class=colhead align=left>" . $tracker_lang['type'] . "</td><td class=colhead>" . $tracker_lang['name'] . "</td>" . ($use_ttl ? "<td class=colhead align=center>" . $tracker_lang['ttl'] . "</td>" : "") . "<td class=colhead align=center>" . $tracker_lang['size'] . "</td><td class=colhead align=right>" . $tracker_lang['details_seeding'] . "</td><td class=colhead align=right>" . $tracker_lang['details_leeching'] . "</td><td class=colhead align=center>" . $tracker_lang['uploaded'] . "</td>\n" . "<td class=colhead align=center>" . $tracker_lang['downloaded'] . "</td><td class=colhead align=center>" . $tracker_lang['ratio'] . "</td></tr>\n";
    while ($arr = mysql_fetch_assoc($res)) {
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            $ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>";
        } else {
            if ($arr["uploaded"] > 0) {
                $ratio = "Inf.";
            } else {
                $ratio = "---";
            }
        }
        $catid = $arr["catid"];
        $catimage = htmlspecialchars_uni($arr["image"]);
        $catname = htmlspecialchars_uni($arr["catname"]);
        $ttl = $ttl_days * 24 - floor((gmtime() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600);
        if ($ttl == 1) {
            $ttl .= "&nbsp;час";
        } else {
            $ttl .= "&nbsp;часов";
        }
        $size = str_replace(" ", "<br />", mksize($arr["size"]));
        $uploaded = str_replace(" ", "<br />", mksize($arr["uploaded"]));
        $downloaded = str_replace(" ", "<br />", mksize($arr["downloaded"]));
        $seeders = number_format($arr["seeders"]);
        $leechers = number_format($arr["leechers"]);
        $ret .= "<tr><td style='padding: 0px'><a href=\"browse.php?cat={$catid}\"><img src=\"pic/cats/{$catimage}\" alt=\"{$catname}\" border=\"0\" /></a></td>\n" . "<td><a href=details.php?id={$arr['torrent']}&amp;hit=1><b>" . $arr["torrentname"] . "</b></a></td>" . ($use_ttl ? "<td align=center>{$ttl}</td>" : "") . "<td align=center>{$size}</td><td align=right>{$seeders}</td><td align=right>{$leechers}</td><td align=center>{$uploaded}</td>\n" . "<td align=center>{$downloaded}</td><td align=center>{$ratio}</td></tr>\n";
    }
    $ret .= "</table>\n";
    return $ret;
}
Exemple #7
0
function verify_word_allowed(&$word)
{
    global $vbulletin, $phrasequery;
    $wordlower = strtolower($word);
    // check if the word contains wildcards
    if (strpos($wordlower, '*') !== false) {
        // check if wildcards are allowed
        if ($vbulletin->options['allowwildcards']) {
            // check the length of the word with all * characters removed
            // and make sure it's at least (minsearchlength - 1) characters long
            // in order to prevent searches like *a**... which would be bad
            if (vbstrlen(str_replace('*', '', $wordlower)) < $vbulletin->options['minsearchlength'] - 1) {
                // word is too short
                $word = htmlspecialchars_uni($word);
                eval(standard_error(fetch_error('searchinvalidterm', $word, $vbulletin->options['minsearchlength'])));
            } else {
                // word is of valid length
                return true;
            }
        } else {
            // wildcards are not allowed - error
            $word = htmlspecialchars_uni($word);
            eval(standard_error(fetch_error('searchinvalidterm', $word, $vbulletin->options['minsearchlength'])));
        }
    } else {
        if ($wordokay = is_index_word($word)) {
            return true;
        } else {
            // word is a bad word (common, too long, or too short; don't search on it)
            return false;
        }
    }
}
Exemple #8
0
 public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false)
 {
     $commentinfo =& $this->content['album_picturecomment'][$activity['contentid']];
     $albuminfo =& $this->content['album'][$commentinfo['albumid']];
     $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true);
     $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']);
     $preview = strip_quotes($commentinfo['pagetext']);
     $commentinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet'])));
     $userinfo = $this->fetchUser($activity['userid'], $commentinfo['postusername']);
     $userinfo2 = $this->fetchUser($albuminfo['userid']);
     if ($fetchphrase) {
         if ($userinfo['userid']) {
             $phrase = construct_phrase($this->vbphrase['x_commented_on_a_photo_in_album_y'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']);
         } else {
             $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_a_photo_in_album_y'], $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']);
         }
         return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity);
     } else {
         $templater = vB_Template::create($templatename);
         $templater->register('userinfo', $userinfo);
         $templater->register('userinfo2', $userinfo2);
         $templater->register('activity', $activity);
         $templater->register('commentinfo', $commentinfo);
         $templater->register('albuminfo', $albuminfo);
         return $templater->render();
     }
 }
Exemple #9
0
 public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false)
 {
     $messageinfo =& $this->content['visitormessage'][$activity['contentid']];
     $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true);
     $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']);
     $userinfo2 =& $this->content['user'][$messageinfo['userid']];
     $messageinfo['preview'] = strip_quotes($messageinfo['pagetext']);
     $messageinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($messageinfo['preview'], false, true, true, true), vb::$vbulletin->options['as_snippet'])));
     $userinfo = $this->fetchUser($activity['userid'], $messageinfo['postusername']);
     if ($fetchphrase) {
         if ($userinfo['userid']) {
             $phrase = construct_phrase($this->vbphrase['x_created_a_visitormessage_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']);
         } else {
             $phrase = construct_phrase($this->vbphrase['guest_x_created_a_visitormessage_y_in_z'], $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']);
         }
         return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity);
     } else {
         $templater = vB_Template::create($templatename);
         $templater->register('userinfo', $userinfo);
         $templater->register('userinfo2', $userinfo2);
         $templater->register('linkinfo', array('vmid' => $messageinfo['vmid']));
         $templater->register('linkinfo2', array('tab' => 'visitor_messaging'));
         $templater->register('activity', $activity);
         $templater->register('messageinfo', $messageinfo);
         return $templater->render();
     }
 }
Exemple #10
0
function tags_editpost_end()
{
    global $mybb, $db, $lang, $templates, $thread, $post, $tags, $tags_value;
    if ($mybb->settings['tags_enabled'] == 0 || tags_in_disforum($thread['fid']) || $mybb->settings['tags_groups'] != -1 && !is_member($mybb->settings['tags_groups'])) {
        return;
    }
    $lang->load('tags');
    if ($thread['firstpost'] != $mybb->get_input('pid', 1)) {
        return;
    }
    $tags_value = $mybb->get_input('tags');
    if (!$tags_value) {
        $bad_tags = tags_getbads(true, false);
        $query = $db->simple_select('tags', '*', "tid='{$thread['tid']}'{$bad_tags}");
        $thread['tags'] = array();
        while ($tag = $db->fetch_array($query)) {
            if (!in_array($tag['name'], $thread['tags']) && $tag['name'] != '') {
                array_push($thread['tags'], $tag['name']);
            }
        }
        $tags_value = implode(',', $thread['tags']);
    }
    $tags_value = htmlspecialchars_uni(tags_string2tag($tags_value));
    eval('$tags = "' . $templates->get('tags_input') . '";');
}
/**
* Fetch array of podcast categories
*
* @return	array		Array of categories
*/
function fetch_podcast_categoryarray($categoryid)
{
    require_once DIR . '/includes/class_xml.php';
    $xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/podcast_vbulletin.xml');
    $podcastdata = $xmlobj->parse();
    $key = 1;
    $output = array();
    if (is_array($podcastdata['category'])) {
        foreach ($podcastdata['category'] as $cats) {
            if ($key == $categoryid) {
                $output[] = htmlspecialchars_uni($cats['name']);
                break;
            }
            $key++;
            if (is_array($cats['sub']['name'])) {
                foreach ($cats['sub']['name'] as $subcats) {
                    if ($key == $categoryid) {
                        $output[] = htmlspecialchars_uni($cats['name']);
                        $output[] = htmlspecialchars_uni($subcats);
                        break 2;
                    }
                    $key++;
                }
            }
        }
    }
    return $output;
}
Exemple #12
0
function tags_index_start()
{
    global $mybb, $db, $tags, $theme, $templates, $lang, $collapsedimg, $collapsed;
    if ($mybb->settings['tags_enabled'] == 0 || $mybb->settings['tags_index'] == 0) {
        return;
    }
    $lang->load('tags');
    $mybb->settings['tags_limit'] = (int) $mybb->settings['tags_limit'];
    $order_by = 'RAND()';
    if ($db->type == 'pgsql' || $db->type == 'sqlite') {
        $order_by = 'RANDOM()';
    }
    $query = DBTags::get("SUM(threads.views) as sumviews, tags.name", "tags.name != ''", array('orderBy' => $order_by, 'orderType' => '', 'limit' => "0, {$mybb->settings['tags_limit']}"));
    $tags = $comma = '';
    while ($tag = $db->fetch_array($query)) {
        if (!$tag['name']) {
            continue;
        }
        $tag['name'] = htmlspecialchars_uni($tag['name']);
        $tag['tag_link'] = get_tag_link($tag['name']);
        $tag['size'] = tags_getsize($tag['sumviews']);
        eval('$tags .= "' . $templates->get('tags_box_tag_sized') . '";');
        $comma = $lang->comma;
    }
    if ($tags != '') {
        eval('$tags = "' . $templates->get('tags_box') . '";');
    }
}
function fetch_forum_announcements($pid = 0, $depth = 1)
{
    global $mybb, $db, $lang, $announcements, $templates, $announcements_forum, $moderated_forums;
    static $forums_by_parent, $forum_cache, $parent_forums;
    if (!is_array($forum_cache)) {
        $forum_cache = cache_forums();
    }
    if (!is_array($parent_forums) && $mybb->user['issupermod'] != 1) {
        // Get a list of parentforums to show for normal moderators
        $parent_forums = array();
        foreach ($moderated_forums as $mfid) {
            $parent_forums = array_merge($parent_forums, explode(',', $forum_cache[$mfid]['parentlist']));
        }
    }
    if (!is_array($forums_by_parent)) {
        foreach ($forum_cache as $forum) {
            $forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
        }
    }
    if (!is_array($forums_by_parent[$pid])) {
        return;
    }
    foreach ($forums_by_parent[$pid] as $children) {
        foreach ($children as $forum) {
            if ($forum['active'] == 0 || !is_moderator($forum['fid'])) {
                // Check if this forum is a parent of a moderated forum
                if (in_array($forum['fid'], $parent_forums)) {
                    // A child is moderated, so print out this forum's title.  RECURSE!
                    $trow = alt_trow();
                    eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_forum_nomod") . "\";");
                } else {
                    // No subforum is moderated by this mod, so safely continue
                    continue;
                }
            } else {
                // This forum is moderated by the user, so print out the forum's title, and its announcements
                $trow = alt_trow();
                $padding = 40 * ($depth - 1);
                eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_forum") . "\";");
                if ($announcements[$forum['fid']]) {
                    foreach ($announcements[$forum['fid']] as $aid => $announcement) {
                        $trow = alt_trow();
                        if ($announcement['enddate'] < TIME_NOW && $announcement['enddate'] != 0) {
                            $icon = "<img src=\"images/minioff.gif\" alt=\"({$lang->expired})\" title=\"{$lang->expired_announcement}\"  style=\"vertical-align: middle;\" /> ";
                        } else {
                            $icon = "<img src=\"images/minion.gif\" alt=\"({$lang->active})\" title=\"{$lang->active_announcement}\"  style=\"vertical-align: middle;\" /> ";
                        }
                        $subject = htmlspecialchars_uni($announcement['subject']);
                        eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_announcement") . "\";");
                    }
                }
            }
            // Build the list for any sub forums of this forum
            if ($forums_by_parent[$forum['fid']]) {
                fetch_forum_announcements($forum['fid'], $depth + 1);
            }
        }
    }
}
Exemple #14
0
function get_tag_link($name = '')
{
    if ($name == '') {
        $link = TAG_URL_PAGE;
    } else {
        $link = str_replace("{name}", $name, TAG_URL);
    }
    return htmlspecialchars_uni($link);
}
Exemple #15
0
function automedia_divshare($message)
{
    global $mybb, $width, $height;
    if ($mybb->settings['av_sizeall'] == 1) {
        $w = $width;
        $h = $height;
    } else {
        $w = "560";
        $h = "400";
    }
    /**
     *Example:
     *http://www.divshare.com/download/7714880-d76
     */
    if (preg_match('<a href=\\"(http://)(?:www\\.)?divshare\\.com/download/([^\\"]*)\\">isU', $message)) {
        $pattern = "<http://www.divshare.com/download/(.*)\" target>";
        preg_match_all($pattern, $message, $links);
        $link = $links[1];
        foreach ($link as $url) {
            $site = htmlspecialchars_uni("http://www.divshare.com/download/{$url}");
            //Use cURL and find the video id
            if (!function_exists('curl_init') || !($c = curl_init())) {
                return false;
            }
            curl_setopt($c, CURLOPT_URL, $site);
            curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($c, CURLOPT_TIMEOUT, 3);
            $data = utf8_encode(curl_exec($c));
            if (!$data) {
                $data = 'not available';
            }
            curl_close($c);
            if ($data) {
                $nrdv = get_avmatch('/video_flash_detector.php\\?data=(.*)\\" name=\\"movie\\"/isU', $data);
                $vid = array($nrdv);
                $nrdi = get_avmatch('/ class=\\"img_thumb\\" id=\\"(.{6,40}?)\\" border=/isU', $data);
                $img = array($nrdi);
            }
            $limit = 1;
            if ($vid) {
                foreach ($vid as $video_id) {
                    if (!in_array("ajaxData_img_thumb", $img)) {
                        $message = preg_replace("#(\\[automedia\\]|<a href=\"(http://)?(?:www\\.)?divshare\\.com/download/(.{6,18}?)(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><div id=\"kadoo_video_container_\$3\"><object height=\"{$h}\" width=\"{$w}\" id=\"video_detector_\$3\"><param value=\"http://divshare.com/flash/video_flash_detector.php?data={$video_id}\" name=\"movie\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><param name=\"wmode\" value=\"opaque\"></param><embed wmode=\"opaque\" height=\"{$h}\" width=\"{$w}\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" src=\"http://divshare.com/flash/video_flash_detector.php?data={$video_id}\"></embed></object></div>", $message, $limit);
                    }
                }
            }
            if ($img) {
                foreach ($img as $image_id) {
                    if ($image_id == "ajaxData_img_thumb") {
                        $message = preg_replace("#(\\[automedia\\]|<a href=\"(http://)?(?:www\\.)?divshare\\.com/download/(.{6,18}?)(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0\" width=\"{$w}\" height=\"{$h}\" id=\"divslide\"><param name=\"movie\" value=\"http://www.divshare.com/flash/slide?myId=\$3\" /><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"http://www.divshare.com/flash/slide?myId=\$3\" width=\"{$h}\" height=\"{$h}\" name=\"divslide\" allowfullscreen=\"true\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed></object></div>", $message, $limit);
                    }
                }
            }
        }
    }
    return $message;
}
Exemple #16
0
 /**
  * Fetches the SQL for loading.
  * $required_query is used to identify which query to build for classes that
  * have multiple queries for fetching info.
  *
  * This can safely be based on $this->required_info as long as a consitent
  * flag is used for identifying the query.
  *
  * @param int $required_query				- The required query
  * @param bool $force_rebuild				- Whether to rebuild the string
  *
  * @return string
  */
 protected function getLoadQuery($required_query = self::QUERY_BASIC, $force_rebuild = false)
 {
     // Hooks should check the required query before populating the hook vars
     $hook_query_fields = $hook_query_join = $hook_query_where = '';
     ($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false;
     if (self::QUERY_BASIC == $required_query) {
         return $query = "\n\t\t\t\tSELECT \n\t\t\t\t\tgroupmessage.gmid as itemid,\n\t\t\t\t\tgroupmessage.discussionid,\n\t\t\t\t\tgroupmessage.postuserid,\n\t\t\t\t\tgroupmessage.postusername,\n\t\t\t\t\tgroupmessage.dateline,\n\t\t\t\t\tgroupmessage.state,\n\t\t\t\t\tgroupmessage.title,\n\t\t\t\t\tgroupmessage.pagetext,\n\t\t\t\t\tgroupmessage.ipaddress,\n\t\t\t\t\tgroupmessage.allowsmilie,\n\t\t\t\t\tgroupmessage.reportthreadid " . $hook_query_fields . "\n\t\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage " . $hook_query_join . "\n\t\t\t\tWHERE groupmessage.gmid IN (" . implode(',', $this->itemid) . ") \n\t\t\t\t\t{$hook_query_where}";
     }
     throw new vB_Exception_Model('Invalid query id \'' . htmlspecialchars_uni($required_query) . '\'specified for social group message collection: ' . htmlspecialchars_uni($query));
 }
Exemple #17
0
function ParseInputs($val)
{
    if (is_int($val)) {
        $val = intval($val);
        return $val;
    } else {
        $val = htmlspecialchars_uni(trim(addslashes($val)));
        return $val;
    }
}
Exemple #18
0
function myalerts_acp_manage_alert_types()
{
    global $mybb, $lang, $page, $db, $cache;
    $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
    $alertTypes = $alertTypeManager->getAlertTypes();
    if (strtolower($mybb->request_method) == 'post') {
        if (!verify_post_check($mybb->get_input('my_post_key'))) {
            flash_message($lang->invalid_post_verify_key2, 'error');
            admin_redirect("index.php?module=config-myalerts_alert_types");
        }
        $enabledAlertTypes = $mybb->get_input('alert_types_enabled', MyBB::INPUT_ARRAY);
        $canBeUserDisabled = $mybb->get_input('alert_types_can_be_user_disabled', MyBB::INPUT_ARRAY);
        $enabledAlertTypes = array_map('intval', array_keys($enabledAlertTypes));
        $canBeUserDisabled = array_map('intval', array_keys($canBeUserDisabled));
        $updateArray = array();
        foreach ($alertTypes as $alertType) {
            $type = MybbStuff_MyAlerts_Entity_AlertType::unserialize($alertType);
            $type->setEnabled(in_array($type->getId(), $enabledAlertTypes));
            $type->setCanBeUserDisabled(in_array($type->getId(), $canBeUserDisabled));
            $updateArray[] = $type;
        }
        $alertTypeManager->updateAlertTypes($updateArray);
        flash_message($lang->myalerts_alert_types_updated, 'success');
        admin_redirect("index.php?module=config-myalerts_alert_types");
    } else {
        $page->output_header($lang->myalerts_alert_types);
        $form = new Form('index.php?module=config-myalerts_alert_types', 'post');
        $table = new Table();
        $table->construct_header($lang->myalerts_alert_type_code);
        $table->construct_header($lang->myalerts_alert_type_enabled, array('width' => '5%', 'class' => 'align_center'));
        $table->construct_header($lang->myalerts_alert_type_can_be_user_disabled, array('width' => '10%', 'class' => 'align_center'));
        $noResults = false;
        if (!empty($alertTypes)) {
            foreach ($alertTypes as $type) {
                $alertCode = htmlspecialchars_uni($type['code']);
                $table->construct_cell($alertCode);
                $table->construct_cell($form->generate_check_box('alert_types_enabled[' . $type['id'] . ']', '', '', array('checked' => $type['enabled'])));
                $table->construct_cell($form->generate_check_box('alert_types_can_be_user_disabled[' . $type['id'] . ']', '', '', array('checked' => $type['can_be_user_disabled'])));
                $table->construct_row();
            }
        } else {
            $table->construct_cell($lang->myalerts_no_alert_types, array('colspan' => 2));
            $table->construct_row();
            $noResults = true;
        }
        $table->output($lang->myalerts_alert_types);
        if (!$noResults) {
            $buttons[] = $form->generate_submit_button($lang->myalerts_update_alert_types);
            $form->output_submit_wrapper($buttons);
        }
        $form->end();
        $page->output_footer();
    }
}
Exemple #19
0
	/**
	 * Prepares properties for rendering.
	 */
	protected function prepareProperties()
	{
		parent::prepareProperties();

		// vB_View_Content has already htmlspecialchars_uni($this->title) so we should not htmlspecialchars_uni again here. Fixed bug #29663
		// $this->title = htmlspecialchars_uni($this->title);
		$this->css = new vB_View('vbcms_article_css');
		$this->author_phrase = new vB_Phrase('vbcms', 'author');

		if ($this->pagelist AND sizeof($this->pagelist) > 1)
		{
			// create a route
			$route = new vBCms_Route_Content();
			$route->setSegments(array('node' => $this->nodesegment, 'action' => vB_Router::getUserAction('vBCms_Controller_Content', 'View')));

			$pagelist = $this->pagelist;
			$pagelist[1] = $this->title;
			$this->pagelist = $pagelist;

			$pages = array();
			foreach ($this->pagelist AS $pagenum => $title)
			{
				$route->setParameter(0, $pagenum);
				$title = $title ? $title : new vB_Phrase('vbcms', 'page_x', $pagenum);

				// undo the 'stop_parse' from the [page] bbcode and strip bbcode and html
				$title = vbchop(strip_tags(strip_bbcode(str_replace(array('&#91;', '&#93;'), array('[', ']'), $title))), 75);

				$pages[$pagenum] = array(
					'url'      => $route->getCurrentURL(null, array($pagenum)),
					'title'    => htmlspecialchars_uni($title),
					'selected' => ($pagenum == $this->current_page) ? 1 : 0
				);
			}

			if ($this->current_page > 1)
			{
				$this->prev_page_url = $pages[$this->current_page - 1]['url'];
				$this->prev_page_phrase = new vB_Phrase('vbcms', 'previous');
			}

			if ($this->current_page < sizeof($pages))
			{
				$this->next_page_url = $pages[$this->current_page + 1]['url'];
				$this->next_page_phrase = new vB_Phrase('vbcms', 'next');
			}

			$this->pagelist = $pages;
		}
		else
		{
			$this->pagelist = false;
		}
	}
Exemple #20
0
 /**
  * Update setting in the database
  *
  * @param name The name of the setting being inserted
  * @param value The value of the setting being inserted
  */
 public function update_setting($name, $value)
 {
     global $db, $output;
     $this->debug->log->trace0("Updating setting {$name}");
     $output->print_progress("start", "Updating settings " . htmlspecialchars_uni($name));
     $modify = array('value' => $db->escape_string($value));
     $this->debug->log->datatrace('$value', $value);
     $db->update_query("settings", $modify, "name='{$name}'");
     $this->increment_tracker('settings');
     $output->print_progress("end");
 }
Exemple #21
0
 /**
  * Parses quotes with post id and/or dateline.
  *
  * @param string The message to be parsed
  * @param string The username to be parsed
  * @param boolean Are we formatting as text?
  * @return string The parsed message.
  */
 function mycode_parse_post_quotes($message, $username, $text_only = false)
 {
     global $lang, $templates, $theme, $mybb;
     $linkback = $date = "";
     $message = trim($message);
     $message = preg_replace("#(^<br(\\s?)(\\/?)>|<br(\\s?)(\\/?)>\$)#i", "", $message);
     if (!$message) {
         return '';
     }
     $message = str_replace('\\"', '"', $message);
     $username = str_replace('\\"', '"', $username) . "'";
     $delete_quote = true;
     preg_match("#pid=(?:&quot;|\"|')?([0-9]+)[\"']?(?:&quot;|\"|')?#i", $username, $match);
     if (intval($match[1])) {
         $pid = intval($match[1]);
         $url = $mybb->settings['bburl'] . "/" . get_post_link($pid) . "#pid{$pid}";
         if (defined("IN_ARCHIVE")) {
             $linkback = " <a href=\"{$url}\">[ -> ]</a>";
         } else {
             eval("\$linkback = \" " . $templates->get("postbit_gotopost", 1, 0) . "\";");
         }
         $username = preg_replace("#(?:&quot;|\"|')? pid=(?:&quot;|\"|')?[0-9]+[\"']?(?:&quot;|\"|')?#i", '', $username);
         $delete_quote = false;
     }
     unset($match);
     preg_match("#dateline=(?:&quot;|\"|')?([0-9]+)(?:&quot;|\"|')?#i", $username, $match);
     if (intval($match[1])) {
         $dateline = intval($match[1]);
         if ($match[1] < TIME_NOW) {
             $postdate = my_date($mybb->settings['dateformat'], intval($match[1]));
             $posttime = my_date($mybb->settings['timeformat'], intval($match[1]));
             $date = " ({$postdate} {$posttime})";
         }
         $username = preg_replace("#(?:&quot;|\"|')? dateline=(?:&quot;|\"|')?[0-9]+(?:&quot;|\"|')?#i", '', $username);
         $delete_quote = false;
     }
     if ($delete_quote) {
         $username = my_substr($username, 0, my_strlen($username) - 1);
     }
     if ($text_only) {
         return "\n" . htmlspecialchars_uni($username) . " {$lang->wrote}{$date}\n--\n{$message}\n--\n";
     } else {
         $span = "";
         if (!$delete_quote) {
             $span = "<span>{$date}</span>";
         }
         $username = preg_replace('/^\\\'/is', '', $username);
         $userinfo = tt_get_user_id_by_name($username);
         if (!empty($userinfo)) {
             $uid = $userinfo['uid'];
         }
         return "[quote " . (isset($uid) ? "uid={$uid} " : '') . (!empty($username) ? "name=\"{$username}\" " : '') . (isset($pid) ? "post={$pid} " : '') . (isset($dateline) ? "timestamp={$dateline}" : '') . "]{$message}[/quote]\n";
     }
 }
Exemple #22
0
function tags_newthread_start()
{
    global $mybb, $db, $templates, $tags, $tags_value, $lang, $fid;
    if ($mybb->settings['tags_enabled'] == 0 || tags_in_disforum($fid) || $mybb->settings['tags_groups'] != -1 && !is_member($mybb->settings['tags_groups'])) {
        return;
    }
    $lang->load('tags');
    $tags_value = $mybb->get_input('tags');
    $tags_value = htmlspecialchars_uni(tags_string2tag($tags_value));
    eval('$tags = "' . $templates->get('tags_input') . '";');
}
function icon_in_showthread_printthread_newreply()
{
    global $cache, $thread, $templates, $theme, $thread_icon;
    $icon_cache = $cache->read('posticons');
    $thread_icon = '';
    if ($thread['icon'] && !empty($icon_cache[$thread['icon']])) {
        $icon = $icon_cache[$thread['icon']];
        $icon['path'] = htmlspecialchars_uni(str_replace("{theme}", $theme['imgdir'], $icon['path']));
        $icon['name'] = htmlspecialchars_uni($icon['name']);
        eval('$thread_icon = "' . $templates->get('forumdisplay_thread_icon') . '";');
    }
}
Exemple #24
0
 /**
  * Generates HTML for the subscription form page
  *
  * @param	string		Hash used to indicate the transaction within vBulletin
  * @param	string		The cost of this payment
  * @param	string		The currency of this payment
  * @param	array		Information regarding the subscription that is being purchased
  * @param	array		Information about the user who is purchasing this subscription
  * @param	array		Array containing specific data about the cost and time for the specific subscription period
  *
  * @return	array		Compiled form information
  */
 function generate_form_html($hash, $cost, $currency, $subinfo, $userinfo, $timeinfo)
 {
     global $vbphrase, $vbulletin, $stylevar, $show;
     $form['action'] = 'https://bill.ccbill.com/jpost/signup.cgi';
     $form['method'] = 'post';
     // load settings into array so the template system can access them
     $settings =& $this->settings;
     $settings['email'] = htmlspecialchars_uni($this->registry->userinfo['email']);
     $subinfo['ccbillsubid'] = $timeinfo['ccbillsubid'];
     eval('$form[\'hiddenfields\'] .= "' . fetch_template('subscription_payment_ccbill') . '";');
     return $form;
 }
/**
 * MyBB 1.8
 * Copyright 2014 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybb.com
 * License: http://www.mybb.com/about/license
 *
 */
function task_versioncheck($task)
{
    global $cache, $lang, $mybb;
    $current_version = rawurlencode($mybb->version_code);
    $updated_cache = array('last_check' => TIME_NOW);
    // Check for the latest version
    require_once MYBB_ROOT . 'inc/class_xml.php';
    $contents = fetch_remote_file("http://www.mybb.com/version_check.php");
    if (!$contents) {
        add_task_log($task, $lang->task_versioncheck_ran_errors);
        return false;
    }
    $pos = strpos($contents, "<");
    if ($pos > 1) {
        $contents = substr($contents, $pos);
    }
    $pos = strpos(strrev($contents), ">");
    if ($pos > 1) {
        $contents = substr($contents, 0, -1 * ($pos - 1));
    }
    $parser = new XMLParser($contents);
    $tree = $parser->get_tree();
    $latest_code = (int) $tree['mybb']['version_code']['value'];
    $latest_version = "<strong>" . htmlspecialchars_uni($tree['mybb']['latest_version']['value']) . "</strong> (" . $latest_code . ")";
    if ($latest_code > $mybb->version_code) {
        $latest_version = "<span style=\"color: #C00;\">" . $latest_version . "</span>";
        $version_warn = 1;
        $updated_cache['latest_version'] = $latest_version;
        $updated_cache['latest_version_code'] = $latest_code;
    } else {
        $latest_version = "<span style=\"color: green;\">" . $latest_version . "</span>";
    }
    // Check for the latest news
    require_once MYBB_ROOT . "inc/class_feedparser.php";
    $feed_parser = new FeedParser();
    $feed_parser->parse_feed("http://feeds.feedburner.com/MyBBDevelopmentBlog");
    $updated_cache['news'] = array();
    require_once MYBB_ROOT . '/inc/class_parser.php';
    $post_parser = new postParser();
    if ($feed_parser->error == '') {
        foreach ($feed_parser->items as $item) {
            if (isset($updated_cache['news'][2])) {
                break;
            }
            $description = $item['description'];
            $description = $post_parser->parse_message($description, array('allow_html' => true));
            $description = preg_replace('#<img(.*)/>#', '', $description);
            $updated_cache['news'][] = array('title' => htmlspecialchars_uni($item['title']), 'description' => $description, 'link' => htmlspecialchars_uni($item['link']), 'author' => htmlspecialchars_uni($item['author']), 'dateline' => $item['date_timestamp']);
        }
    }
    $cache->update("update_check", $updated_cache);
    add_task_log($task, $lang->task_versioncheck_ran);
}
Exemple #26
0
function automedia_blog_tv($message)
{
    global $mybb, $db, $width, $height;
    if ($mybb->settings['av_sizeall'] == 1) {
        $w = $width;
        $h = $height;
    } else {
        $w = "445";
        $h = "374";
    }
    /**
     *Examples:
     *http://www.blogtv.com/Shows/1059925/Ze_vYeNGbWFEZu7xYe7&pos=ancr or http://www.blogtv.com/People/DennyMarco or http://www.blogtv.com/channel/Music/most_viewed/views/Zu_HZePDaePvZ23tZP&pos=ancr
     */
    if (preg_match('<a href=\\"(http://)(?:www\\.)?blogtv\\.com/Shows/(.*?)">isU', $message)) {
        $message = preg_replace("#(\\[automedia\\]|(<a href=\")?(http://)(?:www\\.)?blogtv\\.com/Shows/(\\d*)/(\\w*)(.*?)(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed width=\"{$w}\" height=\"{$h}\" src=\"http://www.blogtv.com/vb/\$5\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\"></embed></div>", $message);
    }
    if (preg_match('<a href=\\"(http://)(?:www\\.)?blogtv\\.com/channel/(.*?)">isU', $message)) {
        $message = preg_replace("#(\\[automedia\\]|(<a href=\")?(http://)(?:www\\.)?blogtv\\.com/channel/(.*?)/(\\w*)(&amp;pos=ancr)?(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed width=\"{$w}\" height=\"{$h}\" src=\"http://www.blogtv.com/vb/\$5\" type=\"application/x-shockwave-flash\" allowFullScreen=\"true\"></embed></div>", $message);
    }
    if (preg_match('<a href=\\"(http://)(?:www\\.)?blogtv\\.com/People/(.*?)">isU', $message)) {
        $pattern = "<http://www.blogtv.com/People/(.*)\" target>";
        preg_match_all($pattern, $message, $links);
        $link = $links[1];
        foreach ($link as $url) {
            $site = htmlspecialchars_uni("http://www.blogtv.com/People/{$url}");
            //Use cURL and find the video id
            if (!function_exists('curl_init') || !($c = curl_init())) {
                return false;
            }
            curl_setopt($c, CURLOPT_URL, $site);
            curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($c, CURLOPT_TIMEOUT, 3);
            curl_setopt($c, CURLOPT_USERAGENT, "Mozilla/5.0");
            $data = utf8_encode(curl_exec($c));
            if (!$data) {
                $data = 'not available';
            }
            curl_close($c);
            if ($data) {
                $nrwat = get_avmatch('/http:\\/\\/www.blogtv.com\\/livesdk\\/(.*)\\"/isU', $data);
                $vid = array($nrwat);
            }
            $limit = 1;
            foreach ($vid as $id) {
                $n = $db->escape_string($id);
                $message = preg_replace("#(\\[automedia\\]|(<a href=\")?(http://)(?:www\\.)?blogtv\\.com/People/(\\w*?)(\\[/automedia\\]|\" target=\"_blank\">)(.*?)</a>)#i", "<div class=\"am_embed\"><embed width=\"{$w}\" height=\"{$h}\" src=\"http://www.blogtv.com/livesdk/{$n}\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\"></embed></div>", $message, $limit);
            }
        }
    }
    return $message;
}
function construct_threaded_post_link($post, $imageString, $depth, $haschildren, $highlightpost = false)
{
    global $vbulletin, $stylevar, $bgclass, $curpostid, $parent_postids, $morereplies, $threadedmode, $vbphrase, $postattach;
    global $threadinfo;
    // ugly
    static $lasttitle;
    //print_array($post);
    if ($threadedmode == 2 and $highlightpost) {
        $highlightpost = 1;
    } else {
        $highlightpost = 0;
    }
    // write 'more replies below' link
    if ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and $post['postid'] != $curpostid and $haschildren and ($vbulletin->options['threaded_listdepth'] != 0 and $depth == $vbulletin->options['threaded_listdepth'] and !strpos(' ,' . $curpostid . $parent_postids . ',', ',' . $post['postid'] . ','))) {
        $morereplies[$post['postid']] = 1;
        return "writeLink({$post['postid']}, " . fetch_statusicon_from_child_posts($post['postid']) . ", 0, 0, \"{$imageString}\", \"\", \"more\", \"\", {$highlightpost});\n";
    }
    // get time fields
    $post['date'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1);
    $post['time'] = vbdate($vbulletin->options['timeformat'], $post['dateline']);
    // get status icon and paperclip
    $post['statusicon'] = iif($post['dateline'] > $threadinfo['threadview'], 1, 0);
    // get paperclip
    $post['paperclip'] = 0;
    if (is_array($postattach["{$post['postid']}"])) {
        foreach ($postattach["{$post['postid']}"] as $attachment) {
            if ($attachment['visible']) {
                $post['paperclip'] = 1;
                break;
            }
        }
    }
    // echo some text from the post if no title
    if ($post['isdeleted']) {
        $post['title'] = $vbphrase['post_deleted'];
    } else {
        if (empty($post['title'])) {
            $pagetext = htmlspecialchars_uni($post['pagetext']);
            $pagetext = strip_bbcode($pagetext, 1);
            if (trim($pagetext) == '') {
                $post['title'] = $vbphrase['reply_prefix'] . ' ' . fetch_trimmed_title($lasttitle, $vbulletin->options['threaded_trimtitle']);
            } else {
                $post['title'] = '<i>' . fetch_trimmed_title($pagetext, $vbulletin->options['threaded_trimtitle']) . '</i>';
            }
        } else {
            $lasttitle = $post['title'];
            $post['title'] = fetch_trimmed_title($post['title'], $vbulletin->options['threaded_trimtitle']);
        }
    }
    ($hook = vBulletinHook::fetch_hook('showthread_threaded_construct_link')) ? eval($hook) : false;
    return "writeLink({$post['postid']}, {$post['statusicon']}, {$post['paperclip']}, " . intval($post['userid']) . ", \"{$imageString}\", \"" . addslashes_js($post['title'], '"') . "\", \"" . addslashes_js($post['date'], '"') . "\", \"" . addslashes_js($post['time'], '"') . "\", {$highlightpost});\n";
}
 /**
  * Any checks to run immediately before saving. If returning false, the save will not take place.
  *
  * @param	boolean	Do the query?
  *
  * @return	boolean	True on success; false if an error occurred
  */
 function pre_save($doquery = true)
 {
     if ($this->presave_called !== null) {
         return $this->presave_called;
     }
     if (isset($this->pt_milestone['title'])) {
         $this->set('title_clean', htmlspecialchars_uni($this->pt_milestone['title']));
     }
     $return_value = true;
     ($hook = vBulletinHook::fetch_hook('pt_milestonedata_presave')) ? eval($hook) : false;
     $this->presave_called = $return_value;
     return $return_value;
 }
Exemple #29
0
/**
Helper - setup paging
**/
function setup_threadlog_pages($uid, $threads, &$start)
{
    global $mybb;
    $threadlog_url = htmlspecialchars_uni("misc.php?action=threadlog&uid=" . $uid);
    $per_page = intval($mybb->settings['rpgsuite_threadlog_perpage']);
    $page = $mybb->get_input('page', MyBB::INPUT_INT);
    if ($page && $page > 0) {
        $start = ($page - 1) * $per_page;
    } else {
        $start = 0;
        $page = 1;
    }
    return multipage(count($threads), $per_page, $page, $threadlog_url);
}
/**
 * Contructs a Post Tree
 *
 * @param	string	The template Name to use
 * @param	integer	The Thread ID
 * @param	integer	The "Root" post for which to work from
 * @param	integer	The current "Depth" within the tree
 *
 * @return	string	The Generated Tree
 *
 */
function &construct_post_tree($templatename, $threadid, $parentid = 0, $depth = 1)
{
    global $vbulletin, $stylevar, $parentassoc, $show, $vbphrase, $threadedmode;
    static $postcache;
    if (!$threadedmode and $vbulletin->userinfo['postorder']) {
        $postorder = 'DESC';
    }
    $depthnext = $depth + 2;
    if (!$postcache) {
        $posts = $vbulletin->db->query_read_slave("\n\t\t\tSELECT post.parentid, post.postid, post.userid, post.pagetext, post.dateline, IF(visible = 2, 1, 0) AS isdeleted,\n\t\t\t\tIF(user.username <> '', user.username, post.username) AS username\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = post.userid\n\t\t\tWHERE post.threadid = {$threadid}\n\t\t\tORDER BY dateline {$postorder}\n\t\t");
        while ($post = $vbulletin->db->fetch_array($posts)) {
            if (!$threadedmode) {
                $post['parentid'] = 0;
            }
            $postcache[$post['parentid']][$post['postid']] = $post;
        }
        ksort($postcache);
    }
    $counter = 0;
    $postbits = '';
    if (is_array($postcache["{$parentid}"])) {
        foreach ($postcache["{$parentid}"] as $post) {
            $parentassoc[$post['postid']] = $post['parentid'];
            if (($depth + 1) % 4 == 0) {
                // alternate colors when switching depths; depth gets incremented by 2 each time
                $post['backcolor'] = '{firstaltcolor}';
                $post['bgclass'] = 'alt1';
            } else {
                $post['backcolor'] = '{secondaltcolor}';
                $post['bgclass'] = 'alt2';
            }
            $post['postdate'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], true);
            $post['posttime'] = vbdate($vbulletin->options['timeformat'], $post['dateline']);
            // cut page text short if too long
            if (vbstrlen($post['pagetext']) > 100) {
                $spacepos = strpos($post['pagetext'], ' ', 100);
                if ($spacepos != 0) {
                    $post['pagetext'] = substr($post['pagetext'], 0, $spacepos) . '...';
                }
            }
            $post['pagetext'] = nl2br(htmlspecialchars_uni($post['pagetext']));
            ($hook = vBulletinHook::fetch_hook('threadmanage_construct_post_tree')) ? eval($hook) : false;
            eval('$postbits .=  "' . fetch_template($templatename) . '";');
            $ret =& construct_post_tree($templatename, $threadid, $post['postid'], $depthnext);
            $postbits .= $ret;
        }
    }
    return $postbits;
}