0

我的问题是这个

当我使用这个功能时,由于某种原因,正在创建一个额外的目录,所以它看起来像这个 site/dd_folder/dd_folder/(file)

有没有一种简单的方法来修改它,以便所有请求都像这个 site/dd_folder/(file) ?

function download_redirect_torrent($winner_id)
{
    global $db, $setts;
    $output = array('url' => null, 'redirect' => false, 'display' => null);

    $winner_id = intval($winner_id);


    $media_details = $db->get_sql_row("SELECT am.*, w.is_dd, w.dd_active, w.dd_active_date FROM 
        " . DB_PREFIX . "auction_media am, " . DB_PREFIX . "winners w WHERE 
        am.auction_id=w.auction_id AND w.winner_id=" . $winner_id . " AND am.media_type=4");

    if ($media_details['is_dd'])
    {
        if ($media_details['dd_active'])
        {
            $expiration = (($setts['dd_expiration'] * 24 * 60 * 60) + $media_details['dd_active_date']) - CURRENT_TIME;

            if ($expiration > 0 || !$setts['dd_expiration'])
            {
                $db->query("UPDATE " . DB_PREFIX . "winners SET dd_nb_downloads=dd_nb_downloads+1 WHERE winner_id=" . $winner_id);

                $output['redirect'] = true;
                $output['display'] = MSG_DD_DOWNLOAD_SUCCESS;           
            }
            else 
            {
                $output['display'] = MSG_DD_DOWNLOAD_LINK_EXPIRED;
            }
        }
        else 
        {
            $output['display'] = MSG_DD_DOWNLOAD_LINK_INACTIVE;         
        }
    }
    else 
    {
        $output['display'] = MSG_DD_NO_DD_OR_NO_AUCT_WINNER;                    
    }

    if ($output['redirect'])
    {
        if (eregi('http://', $media_details['media_url']) || eregi('https://', $media_details['media_url']))
        { /* means we have an external link */
            $output['url'] = $media_details['media_url'];
        }
        else 
        { /* the file is on site */
            //$output['url'] = $setts['dd_folder'] . $media_details['media_url'];
            $output['url'] = $media_details['media_url'];
        }
    }

    return $output;
}
4

0 回答 0