My EVB

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #221 (permalink)  
Old 06-13-2009, 08:01 PM
New Pligger
 
Join Date: Jun 2009
Posts: 8
Hi

I get this error after installation:

"Wrong Referrer"

Can anyone help??

Thanks
Reply With Quote
  #222 (permalink)  
Old 06-14-2009, 02:16 PM
New Pligger
 
Join Date: Jun 2009
Posts: 8
It works now.

But it only get the headline auto-insert on my site
Is it possible to get it to auto-insert the content, pictures and so on?

Thanks
Reply With Quote
  #223 (permalink)  
Old 06-24-2009, 05:46 PM
New Pligger
Pligg Version: 1.0
Pligg Template: Custom
 
Join Date: Jun 2009
Location: Croatia
Posts: 19
Ok first of all I'm not a programmer but web designer and I know a code here and there so don't ask me hard core techy q's regarding this I managed to create so posts are published from upcoming news on vote and now it is AJAX driven so no refresh or go to post page on vote. How I did my vote you can see in here:



and if you want to see it in action go ie in here: Untitled Document just please don't submit that test.html page and yeah my Pligg site is in Croatian lang

Anyway I've modified original code from respective author Simon and now if post gets enough of votes (external or internal no matter) it will get published normally. Also on vote, number of votes will update (+1) and if user already voted he will get word "Again?". Oh yeah and I've applied that patch from peppolone too

So here is modification that i did:

pliggit.php
PHP Code:
include('config.php');
include(
mnminclude.'html1.php');

// is user logged in?
if(anonymous_vote == "false")
{
    
force_authentication();
}

//other needed info
$userid $current_user->user_id;
$url htmlspecialchars(strip_tags($_GET['url']));

$url1 "";
$url2 "";
$slash_check substr($url, -1);

if(
$slash_check == '/')
{
    
$url1 substr($url0, -1);
    
$url2 $url;
}
else
{
    
$url1 $url;
    
$url2 $url."/";
}

// has story been submitted yet?
$url1 = @mysql_real_escape_string($url1);
$url2 = @mysql_real_escape_string($url2);
// added link_votes, link_status to $link_query
$link_query mysql_query("SELECT link_id, link_votes, link_status FROM " table_links " WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1");
$link_rows mysql_num_rows($link_query);


if(
$link_rows == 0)
{
    
//redirect to submit page if story hasn't be submited
    
header('Location: submit.php?url='.$url);
    exit();
}
else
{
        
//vote and then show output
        
$value 10
        if(isset(
$_SERVER['HTTP_X_FORWARDED_FOR']))
        {
            
$ip strip_tags($_SERVER['HTTP_X_FORWARDED_FOR']);
            
$ip = @mysql_real_escape_string($ip);
        }
        else
        {
            
$ip strip_tags($_SERVER['REMOTE_ADDR']);
            
$ip = @mysql_real_escape_string($ip);
        }
        
        if(
ip2long($ip) === FALSE || ip2long($ip) == -1)
        {
            
header('Location: story.php?id='.$link_id);
            exit();
        }
        else
        {
            while(
$link mysql_fetch_array($link_query))
            {
                
$link_id = @mysql_real_escape_string($link['link_id']);
                
// added $votes_num and $link stats
                // I've tested it wihout $link stats
                
$votes_num = @mysql_real_escape_string($link['link_votes']);
                
$link_stats = @mysql_real_escape_string($link['link_status']);
            }
            if(
anonymous_vote == "false")
            {
                
$vote_check mysql_query("SELECT vote_id FROM " table_votes " WHERE vote_link_id=\"$link_id\" AND vote_user_id=\"$userid\" AND vote_type='links' LIMIT 1");
            }
            else
            {
                
$vote_check mysql_query("SELECT vote_id FROM " table_votes " WHERE vote_link_id=\"$link_id\" AND vote_user_id=\"$userid\" AND (vote_user_id!=\"0\" OR vote_ip=\"$ip\") AND vote_type='links' LIMIT 1");
            }
            
            
$vote_rows mysql_num_rows($vote_check);
            
            if(
$vote_rows == 0)
            {
                if(
$vote_update1 mysql_query("INSERT INTO " table_votes " (vote_type,vote_link_id,vote_user_id,vote_value,vote_ip) VALUES ('links','$link_id','$userid','$value','$ip')"))
                {
                    
$vote_update2 mysql_query("UPDATE " table_links " SET link_votes=link_votes+1 WHERE link_id=\"$link_id\"");
                    
                    if((
$votes_num >= 2) && ($link_stats == 'queued')) // change number 2 to one number lower then your settings for votes needed for story to be published
                    
{
                        
$stats_update mysql_query("UPDATE " table_links " SET link_status='published', link_published_date = now() WHERE link_id=\"$link_id\"");
                    }
                    
                    echo 
$votes_num+1;// update number of votes in widget and add one cause we didn't request another mysql query for new vote total
                    
                
}
            }
            else
            {
                echo 
"Again?!";// echo this message if user has already voted
            
}
        }

Note on pliggit: why one number lower then total needed for story to be published? Because we didn't run another query to see new total vote count. It is all set fine in db just our script doesn't know that

url.php

PHP Code:
<script language="javascript" type="text/javascript">
<!--
function getHTTPObject() {
    if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
    else if (window.XMLHttpRequest) return new XMLHttpRequest();
    else {
        alert("Your browser does not support AJAX.");
        return null;
        }
}
function setOutput() {
    if(httpObject.readyState == 4)
    {
    document.getElementById('shovote').innerHTML = httpObject.responseText;
    }
}
function doWork() {
    httpObject = getHTTPObject();
    if (httpObject != null)
    {
    httpObject.open("GET", "<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>", true);
    httpObject.send(null);
    httpObject.onreadystatechange = setOutput;
    }
}
var httpObject = null;
//-->
</script>
<div>
    <ul class="wrap">
    <?php if($link_rows == 1) { ?>
        <li class="mnm-publish"><a href="<?php echo $server ?>/story.php?id=<?php echo $id ?>" title="Vote for this story on <?php echo $web1 ?>" target="_parent"><div id="shovote"><?php echo $votes ?></div></a></li>
        <li class="menealo"><a href="javascript:doWork()"><?php echo $web2 ?></a></li>
    <?php } else { ?>
        <li class="mnm-publish"><a href="<?php echo $server ?>/submit.php?url=<?php echo $url ?>" title="Submit this story on <?php echo $web1 ?>" target="_parent"><b>Go</b></a></li>
        <li class="menealo"><a href="<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>" target="_parent"><?php echo $web2 ?></a></li>
    <?php ?>
    </ul>
</div>
Cause I didn't want for people to include button.php I've modified it just to be button.js. This fill only work if you dont need that thing from Simon for 406 error ($url_mod = 0

button.js

PHP Code:
function pliggit() {
    var 
check window.parent.submit_url;
    if(!
check) { 
        var 
url1 document.URL
    } else { 
        var 
url1 window.parent.submit_url
    }
    var 
url2 'http://yourdomain.com/evb/url.php?url='+url1;
    
document.write('<iframe name="pliggit" width="54" height="71" scrolling="no" frameborder="0" src="'+url2+'"></iframe>');    
}
pliggit(); 
Ok so this code is simple mockup from a guy who makes web sites so if any of you php guru's could improve it please do so This code works well for me and I dunno how it will act on your server but on normal config everything should work just fine. To make it prety like mine you will have to have some knowledge of css or so. That's why I've edited default version from Simon and you can go from there but now you have a good starting point since EVB is working as it supose to be

Cheers

ps: I've atached modified files from here in case you want to check them out.

pps: For EVB or even bookmarklet to work you need to comment out in submit.php check_referrer(); so it will look like this //check_referrer(); Bookmarklet or EVB simple wont work with this function and I couldn't sort it no matter what I've tried. That's why some of you get Wrong Referrer error.
Attached Images
 
Attached Files
File Type: zip evb_improved.zip (6.1 KB, 74 views)

Last edited by Twixman; 06-24-2009 at 05:55 PM.
Reply With Quote
  #224 (permalink)  
Old 06-25-2009, 03:50 AM
Constant Pligger
 
Join Date: May 2007
Posts: 148
Quote:
Originally Posted by Twixman View Post
Ok first of all I'm not a programmer but web designer and I know a code here and there so don't ask me hard core techy q's regarding this I managed to create so posts are published from upcoming news on vote and now it is AJAX driven so no refresh or go to post page on vote. How I did my vote you can see in here:



and if you want to see it in action go ie in here: Untitled Document just please don't submit that test.html page and yeah my Pligg site is in Croatian lang

Anyway I've modified original code from respective author Simon and now if post gets enough of votes (external or internal no matter) it will get published normally. Also on vote, number of votes will update (+1) and if user already voted he will get word "Again?". Oh yeah and I've applied that patch from peppolone too

So here is modification that i did:

pliggit.php
PHP Code:
include('config.php');
include(
mnminclude.'html1.php');

// is user logged in?
if(anonymous_vote == "false")
{
    
force_authentication();
}

//other needed info
$userid $current_user->user_id;
$url htmlspecialchars(strip_tags($_GET['url']));

$url1 "";
$url2 "";
$slash_check substr($url, -1);

if(
$slash_check == '/')
{
    
$url1 substr($url0, -1);
    
$url2 $url;
}
else
{
    
$url1 $url;
    
$url2 $url."/";
}

// has story been submitted yet?
$url1 = @mysql_real_escape_string($url1);
$url2 = @mysql_real_escape_string($url2);
// added link_votes, link_status to $link_query
$link_query mysql_query("SELECT link_id, link_votes, link_status FROM " table_links " WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1");
$link_rows mysql_num_rows($link_query);


if(
$link_rows == 0)
{
    
//redirect to submit page if story hasn't be submited
    
header('Location: submit.php?url='.$url);
    exit();
}
else
{
        
//vote and then show output
        
$value 10
        if(isset(
$_SERVER['HTTP_X_FORWARDED_FOR']))
        {
            
$ip strip_tags($_SERVER['HTTP_X_FORWARDED_FOR']);
            
$ip = @mysql_real_escape_string($ip);
        }
        else
        {
            
$ip strip_tags($_SERVER['REMOTE_ADDR']);
            
$ip = @mysql_real_escape_string($ip);
        }
        
        if(
ip2long($ip) === FALSE || ip2long($ip) == -1)
        {
            
header('Location: story.php?id='.$link_id);
            exit();
        }
        else
        {
            while(
$link mysql_fetch_array($link_query))
            {
                
$link_id = @mysql_real_escape_string($link['link_id']);
                
// added $votes_num and $link stats
                // I've tested it wihout $link stats
                
$votes_num = @mysql_real_escape_string($link['link_votes']);
                
$link_stats = @mysql_real_escape_string($link['link_status']);
            }
            if(
anonymous_vote == "false")
            {
                
$vote_check mysql_query("SELECT vote_id FROM " table_votes " WHERE vote_link_id=\"$link_id\" AND vote_user_id=\"$userid\" AND vote_type='links' LIMIT 1");
            }
            else
            {
                
$vote_check mysql_query("SELECT vote_id FROM " table_votes " WHERE vote_link_id=\"$link_id\" AND vote_user_id=\"$userid\" AND (vote_user_id!=\"0\" OR vote_ip=\"$ip\") AND vote_type='links' LIMIT 1");
            }
            
            
$vote_rows mysql_num_rows($vote_check);
            
            if(
$vote_rows == 0)
            {
                if(
$vote_update1 mysql_query("INSERT INTO " table_votes " (vote_type,vote_link_id,vote_user_id,vote_value,vote_ip) VALUES ('links','$link_id','$userid','$value','$ip')"))
                {
                    
$vote_update2 mysql_query("UPDATE " table_links " SET link_votes=link_votes+1 WHERE link_id=\"$link_id\"");
                    
                    if((
$votes_num >= 2) && ($link_stats == 'queued')) // change number 2 to one number lower then your settings for votes needed for story to be published
                    
{
                        
$stats_update mysql_query("UPDATE " table_links " SET link_status='published', link_published_date = now() WHERE link_id=\"$link_id\"");
                    }
                    
                    echo 
$votes_num+1;// update number of votes in widget and add one cause we didn't request another mysql query for new vote total
                    
                
}
            }
            else
            {
                echo 
"Again?!";// echo this message if user has already voted
            
}
        }

Note on pliggit: why one number lower then total needed for story to be published? Because we didn't run another query to see new total vote count. It is all set fine in db just our script doesn't know that

url.php

PHP Code:
<script language="javascript" type="text/javascript">
<!--
function getHTTPObject() {
    if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
    else if (window.XMLHttpRequest) return new XMLHttpRequest();
    else {
        alert("Your browser does not support AJAX.");
        return null;
        }
}
function setOutput() {
    if(httpObject.readyState == 4)
    {
    document.getElementById('shovote').innerHTML = httpObject.responseText;
    }
}
function doWork() {
    httpObject = getHTTPObject();
    if (httpObject != null)
    {
    httpObject.open("GET", "<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>", true);
    httpObject.send(null);
    httpObject.onreadystatechange = setOutput;
    }
}
var httpObject = null;
//-->
</script>
<div>
    <ul class="wrap">
    <?php if($link_rows == 1) { ?>
        <li class="mnm-publish"><a href="<?php echo $server ?>/story.php?id=<?php echo $id ?>" title="Vote for this story on <?php echo $web1 ?>" target="_parent"><div id="shovote"><?php echo $votes ?></div></a></li>
        <li class="menealo"><a href="javascript:doWork()"><?php echo $web2 ?></a></li>
    <?php } else { ?>
        <li class="mnm-publish"><a href="<?php echo $server ?>/submit.php?url=<?php echo $url ?>" title="Submit this story on <?php echo $web1 ?>" target="_parent"><b>Go</b></a></li>
        <li class="menealo"><a href="<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>" target="_parent"><?php echo $web2 ?></a></li>
    <?php ?>
    </ul>
</div>
Cause I didn't want for people to include button.php I've modified it just to be button.js. This fill only work if you dont need that thing from Simon for 406 error ($url_mod = 0

button.js

PHP Code:
function pliggit() {
    var 
check window.parent.submit_url;
    if(!
check) { 
        var 
url1 document.URL
    } else { 
        var 
url1 window.parent.submit_url
    }
    var 
url2 'http://yourdomain.com/evb/url.php?url='+url1;
    
document.write('<iframe name="pliggit" width="54" height="71" scrolling="no" frameborder="0" src="'+url2+'"></iframe>');    
}
pliggit(); 
Ok so this code is simple mockup from a guy who makes web sites so if any of you php guru's could improve it please do so This code works well for me and I dunno how it will act on your server but on normal config everything should work just fine. To make it prety like mine you will have to have some knowledge of css or so. That's why I've edited default version from Simon and you can go from there but now you have a good starting point since EVB is working as it supose to be

Cheers

ps: I've atached modified files from here in case you want to check them out.

pps: For EVB or even bookmarklet to work you need to comment out in submit.php check_referrer(); so it will look like this //check_referrer(); Bookmarklet or EVB simple wont work with this function and I couldn't sort it no matter what I've tried. That's why some of you get Wrong Referrer error.

nice..many thanks for the improved codes..
can it be use as a widget on wordpress?

Watch Tv Episode Online - Watch your favorites Tv Shows.
Reply With Quote
  #225 (permalink)  
Old 06-25-2009, 04:40 AM
New Pligger
Pligg Version: 1.0
Pligg Template: Custom
 
Join Date: Jun 2009
Location: Croatia
Posts: 19
Quote:
Originally Posted by onlinebisnes View Post
nice..many thanks for the improved codes..
can it be use as a widget on wordpress?
Oh yes, lol I modified wp plug-in too (that wp-vote from some guy) I'll post it in hour or so You can see it in action on Web dizajn blog | Dizajn,Trendovi,Tutorijali,Novosti | Kroativ.net | Novi trendovi u web dizajnu, intervjui i resursi it is Croatian web design blog but just click on any post and look at a bottom left of article.
Reply With Quote
  #226 (permalink)  
Old 06-25-2009, 08:04 AM
New Pligger
Pligg Version: 1.0
Pligg Template: Custom
 
Join Date: Jun 2009
Location: Croatia
Posts: 19
Quote:
Originally Posted by Twixman View Post
Oh yes, lol I modified wp plug-in too (that wp-vote from some guy) I'll post it in hour or so You can see it in action on Web dizajn blog | Dizajn,Trendovi,Tutorijali,Novosti | Kroativ.net | Novi trendovi u web dizajnu, intervjui i resursi it is Croatian web design blog but just click on any post and look at a bottom left of article.
Ok here is the WP plugin that I'm using. It is Yabama plugin with few modifications, I've just change alignment and position on original, so again all the props goes to Yabama:

PHP Code:
/*
Plugin Name: WP-Vote
Version: 1.0
Plugin URI: http://www.yabama.com
Description: Adds a button to your articles to offer and vote on Yabama.com.
Author: Yabama
Author URI: http://www.yabama.com
Modified version of the WP-Vote Plugin by
yabama
http://www.yabama.com
*/
$message = "";

if (!function_exists('smpligg_request_handler')) {
    function smpligg_request_handler() {
        global $message;

        if ($_POST['smpligg_action'] == "update options") {
            $smpligg_align_v = $_POST['smpligg_align_sl'];

            if(get_option("smpligg_box_align")) {
                update_option("smpligg_box_align", $smpligg_align_v);
            } else {
                add_option("smpligg_box_align", $smpligg_align_v);
            }

            $message = '<br clear="all" /> <div id="message" class="updated fade"><p><strong>Options saved. </strong></p></div>';
        }
    }
}

if(!function_exists('smpligg_add_menu')) {
    function smpligg_add_menu () {
        add_options_page("Options Vote", "Options Vote", 8, basename(__FILE__), "smpligg_displayOptions");
    }
}

if (!function_exists('smpligg_displayOptions')) {
    function smpligg_displayOptions() {

        global $message;
        echo $message;

        print('<div class="wrap">');
        print('<h2>Options Vote</h2>');

        print ('<form name="smpligg_form" action="'. get_bloginfo("wpurl") . '/wp-admin/options-general.php?page=wp-vote.php' .'" method="post">');
?>

        <p>Placement of the vote button:
        <select name="smpligg_align_sl" id="smpligg_align_sl">
            <option value="Top Left"   <?php if (get_option("smpligg_box_align") == "Top Left") echo " selected"?> >Top Left</option>
            <option value="Top Right"   <?php if (get_option("smpligg_box_align") == "Top Right") echo " selected"?> >Top Right</option>
            <option value="Top Center"   <?php if (get_option("smpligg_box_align") == "Top Center") echo " selected"?> >Top Center</option>
            <option value="Bottom Left"  <?php if (get_option("smpligg_box_align") == "Bottom Left") echo " selected"?> >Bottom Left</option>
            <option value="Bottom Right"  <?php if (get_option("smpligg_box_align") == "Bottom Right") echo " selected"?> >Bottom Right</option>
            <option value="Bottom Center"  <?php if (get_option("smpligg_box_align") == "Bottom Center") echo " selected"?> >Bottom Center</option>
        </select><br /><br /> </p>

<?php
        
print ('<p><input type="submit" value="Save &raquo;"></p>');
        print (
'<input type="hidden" name="smpligg_action" value="update options" />');
        print(
'</form>');


    }
}


if (!
function_exists('smpligg_votehtml')) {
    function 
smpligg_votehtml($float) {
        global 
$wp_query;
        
$post $wp_query->post;
        
$permalink get_permalink($post->ID);
        
$title urlencode($post->post_title);
if (
$postid<1$postid get_the_ID();
    if (
$images get_children(array(
        
'post_parent' => $postid,
        
'post_type' => 'attachment',
        
'numberposts' => 1,
        
'post_mime_type' => 'image',)))
        foreach(
$images as $image) {
            
$attachment=wp_get_attachment_image_src($image->ID$size);
        }

        
$votehtml "
            <!-- Vote widget -->
            <div style=\"$float\">
            <script type=\"text/javascript\">
            submit_url = \"$permalink\";
              images_url = \"$attachment[0]\";
            </script>
            <script type=\"text/javascript\" src=\"http://yourdomain.com/evb/button.js\"></script>
            </div>
            <!-- //end of vote widget -->
        "
;
    return  
$votehtml;
    }
}


if (!
function_exists('smpligg_addbutton')) {
    function 
smpligg_addbutton($content) {

        if ( !
is_feed() && !is_page() && !is_archive() && !is_search() && !is_404() ) {
            if(! 
preg_match('|<!--vote-->|'$content)) {
                
$smpligg_align get_option("smpligg_box_align");
                if (
$smpligg_align) {
                    switch (
$smpligg_align) {
                        case 
"Top Left":
                              return 
smpligg_votehtml("margin: 4px 6px 4px 0px; float:left;").$content;
                              break;
                        case 
"Top Right":
                              return 
smpligg_votehtml("margin: 4px 0px 4px 6px; float:right;").$content;
                              break;
                        case 
"Top Center":
                              return 
smpligg_votehtml("margin: 4px auto;float:none;").$content;
                              break;
                        case 
"Bottom Left":
                              return 
$content.smpligg_votehtml("margin: 4px 6px 4px 0px; float:left;");
                              break;
                        case 
"Bottom Right":
                              return 
$content.smpligg_votehtml("margin: 4px 0px 4px 6px; float:right;");
                              break;
                        case 
"Bottom Center":
                              return 
$content.smpligg_votehtml("margin: 4px auto;float:none;");
                              break;

                        default:
                              return 
smpligg_votehtml("margin: 4px 6px 4px 0px; float:left;").$content;
                              break;
                    }
                } else {
                      return 
smpligg_votehtml("margin: 4px 6px 4px 0px; float:left;").$content;
                }

            } else {
                  return 
str_replace('<!--vote-->'smpligg_votehtml(""), $content);
            }
        } else {
            return 
$content;
        }
    }
}

if (!
function_exists('show_vote')) {
    function 
show_vote($float "left") {
        global 
$post;
        
$permalink get_permalink($post->ID);
        echo 
"
            <!-- Vote widget -->
            <div style=\"$float\">
            <script type=\"text/javascript\">
            submit_url = \"$permalink\";
              images_url = \"$attachment[0]\";
            </script>
            <script type=\"text/javascript\" src=\"http://yourdomain.com/evb/button.js\"></script>
            </div>
            <!-- //end of vote widget -->
        "
;
    }
}

add_filter('the_content''smpligg_addbutton'999);
add_action('admin_menu''smpligg_add_menu');
add_action('init''smpligg_request_handler');
You just need to change every 404 - Not Found to your domain and if you use button.php then put .php instead of button.js or whatever you called it.
Simple upload it in your wp-plugins folder and activate then set alignment in Options vote. This is original url: http://forums.pligg.com/modification...gin-pligg.html
Reply With Quote
  #227 (permalink)  
Old 06-26-2009, 04:47 AM
New Pligger
Pligg Version: 1.0
Pligg Template: Custom
 
Join Date: Jun 2009
Location: Croatia
Posts: 19
Ok I've added few more stuff to EVB improved so that it can be easily used in Digg like toolbar as an vote option. Also I've had problems in IE and Safari so for now this EVB improved will best work if anonymous vote is on

add in pliggit.php

PHP Code:
$userid $current_user->user_id;
$url htmlspecialchars(strip_tags($_GET['url']));
// add this bellow
$vidi htmlspecialchars(strip_tags($_GET['id']));
// end of add 
and then find (still in pliggit.php)

PHP Code:
$link_query mysql_query("SELECT link_id, link_votes, link_status FROM " table_links " WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1"); 
replace with

PHP Code:
if ($vidi != null)
{
$link_query mysql_query("SELECT link_url, link_id, link_votes, link_status FROM " table_links " WHERE link_id=\"$vidi\" AND (link_status='published' OR link_status='queued') LIMIT 1");
}
else 
{
$link_query mysql_query("SELECT link_id, link_votes, link_status FROM " table_links " WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1");

button.js

replace

PHP Code:
function pliggit() {
    var 
check window.parent.submit_url;
    if(!
check) { 
        var 
url1 document.URL
    } else { 
        var 
url1 window.parent.submit_url
    }
    var 
url2 'http://yourdomain.com/evb/url.php?url='+url1;
    
document.write('<iframe name="pliggit" width="54" height="71" scrolling="no" frameborder="0" src="'+url2+'"></iframe>');    
}
pliggit(); 
with:

PHP Code:
function pliggit() {
    var 
check window.parent.submit_url;
    var 
check_id window.parent.id;
    if(!
check) { 
        var 
url1 document.URL
    } else { 
        var 
url1 window.parent.submit_url
    }
    if(!
check_id) {
        var 
url2 'http://yourdomain.com/evb/url.php?url='+url1;
    } else {
        var 
url2 'http://yourdomain.com/evb/url.php?url='+url1+'&id='+id;
    }
    
document.write('<iframe name="pliggit" width="54" height="71" scrolling="no" frameborder="0" src="'+url2+'"></iframe>');    
}
pliggit(); 
url.php

PHP Code:
$url htmlspecialchars(strip_tags($_GET['url']));
// add this line below
$vidi htmlspecialchars(strip_tags($_GET['id']));
// end of add 
and replace still in url.php

PHP Code:
$link_query = @mysql_query("SELECT link_id,link_votes FROM $db_table WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1"); 
with:

PHP Code:
$myid = @mysql_real_escape_string($vidi);
if (
$myid != null)
{
$link_query = @mysql_query("SELECT link_url,link_id,link_votes FROM $db_table WHERE link_id=\"$myid\" AND (link_status='published' OR link_status='queued') LIMIT 1");
}
else
{
$link_query = @mysql_query("SELECT link_id,link_votes FROM $db_table WHERE (link_url=\"$url1\" OR link_url=\"$url2\") AND (link_status='published' OR link_status='queued') LIMIT 1");

and still in url.php replace

PHP Code:
httpObject.open("GET", "<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>", true);
with:

PHP Code:
httpObject.open("GET", "<?php echo $server ?>/pliggit.php?url=<?php echo $url ?>&id=<?php echo $myid ?>", true);
and now if you want to add vote in your Digg like toolbar include it like this:

PHP Code:
<script type="text/javascript">submit_url = '<?=$url?>';id = '<?=$id?>';</script>
<script type="text/javascript" src="http://yourdomain.com/evb/button.js"></script>
And this is how everything works: Usporedba ASP i PHP skriptog jezika | Kroativ Remember that this mockup was made for my needs but I thought that you might find it useful so I shared the code.

When I find some time I'll try to add vote down too. Again there is certainly more room for improvement and if you know how please do so. Dunno why it is buggy in IE and Safari if there is no anonymous vote. I'll take a look at the code more when I find some time.
Reply With Quote
  #228 (permalink)  
Old 07-02-2009, 03:25 AM
Constant Pligger
Pligg Version: 1.0.1
Pligg Template: thestandard
 
Join Date: Jun 2009
Posts: 125
Send a message via Yahoo to prorock
hi, how i can create evb in this image style? http://forums.pligg.com/attachments/...5_evb_vote.png

Last edited by prorock; 07-02-2009 at 04:03 AM.
Reply With Quote
  #229 (permalink)  
Old 07-02-2009, 04:27 AM
New Pligger
Pligg Version: 1.0
Pligg Template: Custom
 
Join Date: Jun 2009
Location: Croatia
Posts: 19
Well you need to make your own graphics and align them in css. This one has my logo on it but you can use it for start, change colors, that logo on left and maybe vote hand.
Reply With Quote
  #230 (permalink)  
Old 07-02-2009, 05:40 AM
Constant Pligger
Pligg Version: 1.0.1
Pligg Template: thestandard
 
Join Date: Jun 2009
Posts: 125
Send a message via Yahoo to prorock
can i download this module in arhive with all changes and images?
Reply With Quote
Reply

Thread Tools
Display Modes




Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development