vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Digital Point Spy (https://vborg.vbsupport.ru/showthread.php?t=243429)

sportsbuddys 06-02-2010 07:07 AM

Great thank you!

digitalpoint 06-02-2010 07:41 AM

Quote:

Originally Posted by teenage.vn (Post 2046904)
Yes I have the template "SPY", as well as the template "spy.css" ...

And Im using 4.0.2, does this Add-on support 4.0.2 ?

Thanks for the fast feedback from you ... Still looking forward for the fix ...

Probably has to do with the same as this post.

teenage.vn 06-03-2010 06:57 AM

Quote:

Originally Posted by digitalpoint (Post 2046958)
Probably has to do with the same as this post.

Firstly, I want to say that I'd appreciate for your quick support.

But ... I did the same thing in the post, means: change the exact words function play_pause() to the Code you gave in the post ... and I got the following warning when I tried to save the template:

Quote:

The following error occurred when attempting to evaluate this template:

Parse error: syntax error, unexpected '[', expecting ')' in /home/vitav/public_html/forum/includes/adminfunctions_template.php(4748) : eval()'d code on line 32

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Once again, sorry for bothering you and looking forward to hearing from you ...


------------------------------------------ Updated: ------------------------------------------

I also tried to Continue when facing the above error, and nothing changed ... still nothing to display ...

Abhik 06-03-2010 10:32 AM

Good to see Shawn releasing some of his 'custom' modification.
Heard about the Sphinx Search For vBulletin 4 too that you released at DP.
So sad I can't access that.

digitalpoint 06-03-2010 05:43 PM

Quote:

Originally Posted by teenage.vn (Post 2047492)
Firstly, I want to say that I'd appreciate for your quick support.

But ... I did the same thing in the post, means: change the exact words function play_pause() to the Code you gave in the post ... and I got the following warning when I tried to save the template:



Once again, sorry for bothering you and looking forward to hearing from you ...


------------------------------------------ Updated: ------------------------------------------

I also tried to Continue when facing the above error, and nothing changed ... still nothing to display ...

Any plans on upgrading to vBulletin 4.0.3? The problem itself is caused by vBulletin versions before 4.0.2 not able to parse templates properly.

If you have phpmyadmin, go into the templates table and search for the template record with the title of SPY. Edit that record (it should have a styleid of -1) and set the template field (NOT the template_un field) to this:

PHP Code:

$final_rendered '' vB_Template_Runtime::fetchStylevar("htmldoctype") . '
<html xmlns="http://www.w3.org/1999/xhtml" dir="' 
vB_Template_Runtime::fetchStylevar("textdirection") . '" lang="' vB_Template_Runtime::fetchStylevar("languagecode") . '">
<head>
    ' 
$headinclude '
    <link rel="stylesheet" type="text/css" href="' 
$vbcsspath 'spy.css" />
    <script type="text/javascript" src="' 
vB_Template_Runtime::fetchStylevar("yuipath") . '/animation/animation-min.js?v=' $vboptions['simpleversion'] . '"></script>

<script type="text/javascript"> 
var spymax = 25;
var play = 1;
var whats = new Array();
var titles = new Array();
var previews = new Array();
var whos = new Array();
var threadids = new Array();
var postids = new Array();
var userids = new Array();
var spyids = new Array();
var forumids = new Array();
var forumnames = new Array();
var highestid = 0;
var fadetime = .25;
var pushtime = 1500;
var fadetime_end = 1.5;
var pushtime_end = 4000
var initalfill_flag = 0;

function init() {
    getXML();
}

function play_pause() {
    var label = new Array(\'' 
vB_Template_Runtime::parsePhrase("click_to_continue") . '\', \'' vB_Template_Runtime::parsePhrase("click_to_pause") . '\');
    play = Math.abs(1-play);
    document.getElementById("play_pause").innerHTML = label[play];
}

function getXML() {

    if (highestid > 0) {
        var querystring = "do=xml&last=" + highestid;
    } else {
        var querystring = "do=xml";
    }

    if (document.getElementById("subscribed_flag").checked) {
        querystring = querystring + "&subscribed=1";
    }
    querystring = querystring + \'&r=\' + Math.random(); 

    YAHOO.util.Connect.asyncRequest("GET", "spy.php?" + SESSIONURL + "securitytoken=" + SECURITYTOKEN + "&" + querystring, {
        success: processXML,
        failure: vBulletin_AJAX_Error_Handler,
        timeout: vB_Default_Timeout,
        scope: this
    });
}

function processXML (request) {

    var events;
    var event;

    try {
        events = request.responseXML.getElementsByTagName("events")[0];
        event = events.getElementsByTagName("event");
    }
    catch (e) {
        setTimeout("getXML()", 30000);
        return;
    }

    for (i = 0; i < event.length; i++) {
        try {
            whats[i] = event[i].getElementsByTagName("what")[0].firstChild.nodeValue;
        }
        catch (e) {
            whats[i] = "Who Knows";
        }
        try {
            titles[i] = event[i].getElementsByTagName("title")[0].firstChild.nodeValue;
        }
        catch (e) {
            titles[i] = "";
        }    
        try {
            previews[i] = event[i].getElementsByTagName("preview")[0].firstChild.nodeValue;
        }
        catch (e) {
            previews[i] = "";
        }
        try {
            whos[i] = event[i].getElementsByTagName("who")[0].firstChild.nodeValue;
        }
        catch (e) {
            whos[i] = "Anonymous";
        }
        try {
            threadids[i] = event[i].getElementsByTagName("threadid")[0].firstChild.nodeValue;
        }
        catch (e) {
            threadids[i] = "";
        }
        try {
            postids[i] = event[i].getElementsByTagName("postid")[0].firstChild.nodeValue;
        }
        catch (e) {
            postids[i] = "";
        }
        try {
            userids[i] = event[i].getElementsByTagName("userid")[0].firstChild.nodeValue;
        }
        catch (e) {
            userids[i] = "";
        }
        try {
            spyids[i] = event[i].getElementsByTagName("id")[0].firstChild.nodeValue;
        }
        catch (e) {
            spyids[i] = 1;
        }
        try {
            forumids[i] = event[i].getElementsByTagName("forumid")[0].firstChild.nodeValue;
        }
        catch (e) {
            forumids[i] = 1;
        }
        try {
            forumnames[i] = event[i].getElementsByTagName("forumname")[0].firstChild.nodeValue;
        }
        catch (e) {
            forumnames[i] = 1;
        }
    }

    push();

}

function push() {

    if (play == 0) {
        setTimeout("push()", 1000);
        return;
    }

    var cell;
    var cellnext;
    var text;
    var clip;
    var who_clip = \'\';
    var where = \'\';
    var post_url;
    var style = "";
    var what = whats.pop();
    var title = titles.pop();
    var preview = previews.pop();
    var who = whos.pop();
    var threadid = threadids.pop();
    var postid = postids.pop();
    var userid = userids.pop();
    var spyid = spyids.pop();
    var forumid = forumids.pop();
    var forumname = forumnames.pop();

    highestid = Math.max(parseInt(spyid), highestid);

    if (vB_PHP_Emulator.prototype.stripos(what, \'Thread\')) {
        post_url = \'showthread.php?\' + SESSIONURL + \'t=\' + threadid;
    } else {
        post_url = \'showthread.php?\' + SESSIONURL + \'p=\' + postid + \'#post\' + postid ;
    }

    if (what == \'' 
vB_Template_Runtime::parsePhrase("new_user") . '\') {
        clip = \'<span style="font-weight:bold">' 
vB_Template_Runtime::parsePhrase("new_user_registration") . '</span>\';
    } else if(title.length == 0) { // Why??
        clip = \'Unknown\';
    } else {
        clip = \'<a style="font-weight:bold" href="\' + post_url + \'">\' + title + \'</a>\';
    }
    if (preview.length > 0) clip = clip + \'<br /><div>\' + preview + \'</div>\';
    
    if (userid.length > 0) {
        who_clip = \'by <a href="member.php?\' + SESSIONURL + \'u=\' + userid + \'">\' + who + \'</a>\';
    }
    
    if (parseInt(forumname.length) > 0) {
        if (who_clip.length > 0) where = \'<br />\';
        where = where + \'<a style="font-weight:bold" href="forumdisplay.php?\' + SESSIONURL + \'f=\' + forumid + \'">\' + forumname + \'</a>\';
    } else {
        where = \'\';
    }
    text = \'<div class="what">\' + what + \'</div><div class="who">\' + who_clip + where + \'</div><div class="clip">\' + clip + "</div>";

    document.getElementById("row1").style.opacity = 0;
    
    for (i = (spymax - 1); i >= 1; i--) {
        cell = document.getElementById("row" + i);
        cellnext = document.getElementById("row" + (i + 1));
        if (cell.innerHTML != "") {
            cellnext.innerHTML = cell.innerHTML;
            cellnext.style.display = \'\';
        }
    }
    document.getElementById("row1").innerHTML = text;

    FadeIn = new YAHOO.util.Anim("row1", { 
            opacity:{to: 1}
        }, fadetime
    );
    FadeIn.animate();

    if (whats.length > 0) {
        setTimeout("push()", pushtime);
    }
    else {
        fadetime = fadetime_end;
        pushtime = pushtime_end;
        setTimeout("getXML()", 5000);
    }
}
</script>

    <title>' 
$vboptions['bbtitle'] . ' ' vB_Template_Runtime::parsePhrase("spy") . '</title>
$headinclude_bottom '
</head>
<body onload="init()">
    ' 
$header '
    ' 
$navbar '

<ul id="spy_options"> 
    <li><label><input type="checkbox" id="subscribed_flag" value="1"> ' 
vB_Template_Runtime::parsePhrase("include_subscribed") . '</label></li>
    <li><a class="textcontrol" id="play_pause" href="spy.php" onclick="play_pause(); return false;">' 
vB_Template_Runtime::parsePhrase("click_to_pause") . '</a></li>    
</ul>


<div> 
    <span class="spyhead table"> 
        <span class="what td">' 
vB_Template_Runtime::parsePhrase("what") . '</span> 
        <span class="who td">' 
vB_Template_Runtime::parsePhrase("who_where") . '</span> 
        <span class="clip td">' 
vB_Template_Runtime::parsePhrase("thread_post") . '</span> 
    </span> 
</div> 


<ol id="spys">
    <li class="spybit" id="row1"></li>
    <li class="spybit" id="row2" style="display: none;"></li>
    <li class="spybit" id="row3" style="display: none;"></li>
    <li class="spybit" id="row4" style="display: none;"></li>
    <li class="spybit" id="row5" style="display: none;"></li>
    <li class="spybit" id="row6" style="display: none;"></li>
    <li class="spybit" id="row7" style="display: none;"></li>
    <li class="spybit" id="row8" style="display: none;"></li>
    <li class="spybit" id="row9" style="display: none;"></li>
    <li class="spybit" id="row10" style="display: none;"></li>
    <li class="spybit" id="row11" style="display: none;"></li>
    <li class="spybit" id="row12" style="display: none;"></li>
    <li class="spybit" id="row13" style="display: none;"></li>
    <li class="spybit" id="row14" style="display: none;"></li>
    <li class="spybit" id="row15" style="display: none;"></li>
    <li class="spybit" id="row16" style="display: none;"></li>
    <li class="spybit" id="row17" style="display: none;"></li>
    <li class="spybit" id="row18" style="display: none;"></li>
    <li class="spybit" id="row19" style="display: none;"></li>
    <li class="spybit" id="row20" style="display: none;"></li>
    <li class="spybit" id="row21" style="display: none; opacity:.85"></li>
    <li class="spybit" id="row22" style="display: none; opacity:.65"></li>
    <li class="spybit" id="row23" style="display: none; opacity:.45"></li>
    <li class="spybit" id="row24" style="display: none; opacity:.25"></li>
    <li class="spybit" id="row25" style="display: none; opacity:.05"></li>
</ol>
<br clear="both" />
$footer '

</body>
</html> '


That is the parsed template from a version of vBulletin that can parse templates properly. Ultimately the best thing to do would be to upgrade to a version of vBulletin that can parse templates correctly, but if that's not an option manually parsing it like shown above should work.

teenage.vn 06-04-2010 06:48 AM

@digitalpoint: ... I will update to version 4.0.3 maybe in the near future but not now ... Btw, thanks for the best help from you :D.

Michlerish 06-04-2010 08:48 AM

I have private forums that not all users can see, is this mod permissions based? Like if a user goes to the spy page, they won't see updates for forums they cannot access, correct?

edit: I just tested it in two different browsers and it seems to work that way! Fantastic mod, I love it!

Michlerish 06-04-2010 03:22 PM

How can I add a link to the spy.php page in my NavBar or NavTab?

digitalpoint 06-04-2010 07:13 PM

It currently adds a link to the "Community" drop-down menu in the lower navigation (when you are anywhere within the forums).

If you really want it to have it's own main navbar button could you do something like so (this is off the top of my head, I didn't actually test it to make sure it works, but it should).

Plug-ins To Add
Location: process_templates_complete
PHP Code:

if (THIS_SCRIPT == 'spy'$vbulletin->options['selectednavtab'] = 'spy';
$template_hook['navtab_middle'] .= vB_Template::create('spy_navbar_link')->render(); 

Location: cache_templates
PHP Code:

$cache $cache[] = 'spy_navbar_link'

Template To Add
Location: spy_navbar_link
Code:

<li<vb:if condition="$vboptions['selectednavtab'] == 'spy'"> class="selected"</vb:if>>
        <a class="navtab" href="spy.php{vb:raw session.sessionurl_q}">{vb:rawphrase directory}</a>
</li>


dezzy94 06-05-2010 02:15 AM

Works good ! :)


All times are GMT. The time now is 06:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01426 seconds
  • Memory Usage 1,829KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete