All the Deurl is done from lines 654 to 672 of index.cgi.
Code: Select all
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
I'm not even remotely close to an expert in Perl let alone any other language but I found it trivial to change to Bit.ly.
Now I done this in XFS 1.8 so forgive me if it's different in 1.9 or 2.0.
In XFS settings panel put anything in the DeURL url box to activate.
Then replace the above code with this:
Code: Select all
if($c->{deurl_site})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
for(@arr)
{
my $res = $ua->get('http://api.adf.ly/api.php?key=e8b9694d5e5cc8131c40b46db96a518f&uid=2113590&advert_type=int&domain=adf.ly&url='.$_->{download_link});
($_->{deurl}) = $res->decoded_content;
}
}
You can find all your API details for Adf.ly from:
http://adf.ly/tools.php?apiI advise you change the key and uid unless you want me to make money (which I wouldn't mind lol).
advert_type can be
int or
bannerdomain can be
adf.ly or
q.gsIf you want to create two short URLs for every link just copy the entire deurl block of code and paste it below it so you're repeating it twice.
e.g
Code: Select all
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
Change
Code: Select all
($_->{deurl}) = $res=~/^OK:(.+)$/;
to
Code: Select all
($_->{deurl2}) = $res=~/^OK:(.+)$/;
in the second block of code you pasted then in your upload_results.html use <TMPL_VAR deurl> and <TMPL_VAR deurl2> to retrieve the short urls.
I'm available for work if you can't get it working.