aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: amuleWeb and php code  (Read 1965 times)

Eberk89

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
amuleWeb and php code
« on: September 22, 2009, 12:21:13 PM »

Hi everyone.
I'm trying to change the amuleweb ed2k links functionality to solve a problem with my links.
I take ed2k links from a site, that adds "+[nameOfTheSite.com] " at the end of every file name: i don't really like it, so I wanted to change the code in this way, adding a simple str_replace function in the code...

Code: [Select]
if (($HTTP_GET_VARS['cmd'] == 'download' ) && ($_SESSION["guest_login"] == 0)) {
$link = $HTTP_GET_VARS['ed2klink'];

$target_cat_idx = cat2idx($HTTP_GET_VARS['cat']);
     if ( strlen($link) > 0 ) {
                      [b] $link = str_replace ( "nameOfTheSite.com", "", $link);[/b]
     amule_do_ed2k_download_cmd($link, $target_cat_idx);
     }
}

but it doesn't run!! Are only a small set of functions available in amuleweb? How can I use str_replace in the code? Is there another way?
I hope this is the right section! :)
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: amuleWeb and php code
« Reply #1 on: September 22, 2009, 12:50:31 PM »

Quote
Are only a small set of functions available in amuleweb?
Yes.
Quote
Is there another way?
What about using JavaScript?
Something like the following should work:
Code: [Select]
<head>
<script type="text/javascript">
function remove_site_name() {
    var el = document.getElementById('ed2klink');
    el.value = el.value.replace("nameOfTheSite.com", "");
}
</script>
</head>
<body>
<form onsubmit="remove_site_name()">
<input type="text" name="ed2klink" id="ed2klink" value="ed2klink with nameOfTheSite.com in the name">
<input type="submit">
</form>
</body>
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: amuleWeb and php code
« Reply #2 on: September 22, 2009, 12:53:24 PM »

How can I use str_replace in the code?
Post a feature request and hope somebody will eventually implement it ;)
Logged
concordia cum veritate

Eberk89

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
Re: amuleWeb and php code
« Reply #3 on: September 22, 2009, 01:04:05 PM »

thank you!!
I'll try to use javascript and/or to implement it in amule... it would be a good way to start contribute and know amule structure :P
Logged