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

Re: mydownloads modules used in this site

List posts in the topic

question Re: mydownloads modules used in this site

msg# 1.1
Previous post - Next post | Parent - Children.1 | Posted on 2004/9/23 17:05
GIJOE  Gunnery Sergeant   Posts: 4110
I wrote it "Xoops Hackers".

This is the tranlated article.

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);
// 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:

<table width='100%' cellspacing='0' class='outer'>
    <td class="head" colspan='2' align='left' height="18"><{$lang_category}> <{$down.category}></td>
    <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=<{$}>&extension=tar.gz' target='_blank'><img src='images/download_tgz.gif' border='0' alt='<{$lang_dlnow}>' /></a>

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

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

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

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

If you upload both zip and tar.gz, set "zip|tar.gz" into platform field of the download item.
Votes:19 Average:5.26

Posts tree

  Advanced search

Username or e-mail:


Remember Me

Lost Password?

Register now!