PEAK XOOPS - mydownloads modules used in this site in englishin japanese

mydownloads modules used in this site

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/22 21:11
marcionline  企霹始 From: Canoas - Brazil  Posts: 6
Hi dudes!

My question is about mydownloads module used in this site. I would like know how you added the extension type in downloads because I will go use this funcionality to myed2k module already that module only allow one link by id.

However I don't know how do this, so if you could put here the code I am thankful... (sorry by my english )
Votes:8 Average:8.75
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/23 17:05
GIJOE  黎扦烦菱   Posts: 4110
I wrote it "Xoops Hackers".
http://xoops.s22.xrea.com:8080/modules/newbb/viewtopic.php?topic_id=192&forum=4&post_id=8...

This is the tranlated article.

Quote:
All you have to hack is 1 file only.
And you have to prepare some images for archive's types.

line 47 in mydownloads/visit.php
$sql = sprintf("UPDATE %s SET hits = hits+1 WHERE lid = %u AND status > 0", $xoopsDB->prefix("mydownloads_downloads"), $lid);
$xoopsDB->queryF($sql);
// GIJ patch start
$result = $xoopsDB->query("SELECT url,platform FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid AND status>0");
list($url,$platform) = $xoopsDB->fetchRow($result);
if( ! empty( $_GET['extension'] ) ) {
	$ext = $_GET['extension' ] ;
	if( ! strstr( $platform , $ext ) ) exit ;
	if( preg_match( '/(zip|tar.gz|tgz)$/' , $url , $regs ) ) {
		$url = substr( $url , 0 , - strlen( $regs[1] ) ) . $ext ;
	}
}
// GIJ patch end
if (!preg_match("/^ed2k*:\/\//i", $url)) {
	Header("Location: $url");
}

And edit your template like this:

mydownloads_downloads.html
<table width='100%' cellspacing='0' class='outer'>
  <tr>
    <td class="head" colspan='2' align='left' height="18"><{$lang_category}> <{$down.category}></td>
  </tr>
  <tr>
    <td class='even' width='65%' align='left' valign="bottom">

      <{if strstr($down.platform,'tar.gz') }>
        <{assign var="platform_has_set" value="1"}>
        <a href='visit.php?cid=<{$down.cid}>&lid=<{$down.id}>&extension=tar.gz' target='_blank'><img src='images/download_tgz.gif' border='0' alt='<{$lang_dlnow}>' /></a>
      <{/if}>

      <{if strstr($down.platform,'tgz') }>
        <{assign var="platform_has_set" value="1"}>
        <a href='visit.php?cid=<{$down.cid}>&lid=<{$down.id}>&extension=tgz' target='_blank'><img src='images/download_tgz.gif' border='0' alt='<{$lang_dlnow}>' /></a>
      <{/if}>

      <{if strstr($down.platform,'zip') }>
        <{assign var="platform_has_set" value="1"}>
        <a href='visit.php?cid=<{$down.cid}>&lid=<{$down.id}>&extension=zip' target='_blank'><img src='images/download_zip.gif' border='0' alt='<{$lang_dlnow}>' /></a>
      <{/if}>

      <{if $platform_has_set <> 1 }>
        <a href='visit.php?cid=<{$down.cid}>&lid=<{$down.id}>' target='_blank'><img src='images/download.gif' border='0' alt='<{$lang_dlnow}>' /></a>
      <{/if}>

      <b><{$down.title}></b></td>
    <td class='even' align='right' width='35%'><b><{$lang_version}>:</b> <{$down.version}><br /><b><{$lang_subdate}>:</b>  <{$down.updated}></td>
  </tr>

If you upload both zip and tar.gz, set "zip|tar.gz" into platform field of the download item.
Votes:19 Average:5.26
Previous post - Next post | Parent - No child | Posted on 2004/9/23 20:19
marcionline  企霹始 From: Canoas - Brazil  Posts: 6
Thanks GIJOE. Now, I will try use this code in myed2k module, if I have success I post here...

Votes:5 Average:6.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!