示例#1
0
 } else {
     $html_file = str_replace('{system}', $pic_system . $file_sys_values[$files[$i]->system], $html_file);
     $html_file = str_replace('{system_text}', $pic_system . $file_sys_values[$files[$i]->system], $html_file);
 }
 // set language value
 $file_lang_values = explode(',', JDHelper::getOnlyLanguageSubstring($jlistConfig['language.list']));
 if ($files[$i]->file_language == 0) {
     $html_file = str_replace('{language}', '', $html_file);
     $html_file = str_replace('{language_text}', '', $html_file);
 } else {
     $html_file = str_replace('{language}', $pic_language . $file_lang_values[$files[$i]->file_language], $html_file);
     $html_file = str_replace('{language_text}', $pic_language . $file_lang_values[$files[$i]->file_language], $html_file);
 }
 // insert rating system
 if ($jlistConfig['view.ratings']) {
     $rating_system = JDHelper::getRatings($files[$i]->file_id, $files[$i]->rating_count, $files[$i]->rating_sum);
     $html_file = str_replace('{rating}', $rating_system, $html_file);
     $html_file = str_replace('{rating_title}', JText::_('COM_JDOWNLOADS_RATING_LABEL'), $html_file);
 } else {
     $html_file = str_replace('{rating}', '', $html_file);
     $html_file = str_replace('{rating_title}', '', $html_file);
 }
 // custom fields
 $custom_fields_arr = JDHelper::existsCustomFieldsTitles();
 $row_custom_values = array('dummy', $files[$i]->custom_field_1, $files[$i]->custom_field_2, $files[$i]->custom_field_3, $files[$i]->custom_field_4, $files[$i]->custom_field_5, $files[$i]->custom_field_6, $files[$i]->custom_field_7, $files[$i]->custom_field_8, $files[$i]->custom_field_9, $files[$i]->custom_field_10, $files[$i]->custom_field_11, $files[$i]->custom_field_12, $files[$i]->custom_field_13, $files[$i]->custom_field_14);
 for ($x = 1; $x < 15; $x++) {
     // replace placeholder with title and value
     if (in_array($x, $custom_fields_arr[0]) && $row_custom_values[$x] && $row_custom_values[$x] != '0000-00-00') {
         $html_file = str_replace("{custom_title_{$x}}", $custom_fields_arr[1][$x - 1], $html_file);
         if ($x > 5) {
             $html_file = str_replace("{custom_value_{$x}}", stripslashes($row_custom_values[$x]), $html_file);
示例#2
0
function jd_file_fill_downloadok($p_Template, $files, $p_Symbol_Off, $p_DownloadType, $download_allowed)
{
    global $jlistConfigM, $jDFPsfolders, $jDFPrank, $jDFPlive_site, $jDFPplugin_live_site, $jDFPabsolute_path, $cat_link_itemidsPlg, $jDLayoutTitleExists, $root_itemid, $date_format;
    $db = JFactory::getDBO();
    $user = JFactory::getUser();
    $jd_user_settings = JDHelper::getUserRules();
    $jdlink_author_text = '';
    $createdbyname = '';
    $modifiedbyname = '';
    $l_Template = str_replace("{{{", "[[[", $p_Template);
    $jdpic_license = '';
    $jdpic_date = '';
    $jdpic_author = '';
    $jdpic_website = '';
    $jdpic_system = '';
    $jdpic_language = '';
    $jdpic_download = '';
    $jdpic_hits = '';
    $jdpic_size = '';
    $jdpic_price = '';
    $cat_itemid = 0;
    if ($p_Symbol_Off == 0) {
        $msize = $jlistConfigM['info.icons.size'];
        $jdpic_license = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'license.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0"  alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_LICENCE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_LICENCE') . '" />&nbsp;';
        $jdpic_date = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'date.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DATE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DATE') . '" />&nbsp;';
        $jdpic_author = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'contact.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_AUTHOR') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_AUTHOR') . '" />&nbsp;';
        $jdpic_website = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'weblink.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_WEBSITE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_WEBSITE') . '" />&nbsp;';
        $jdpic_system = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'system.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_SYSTEM') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_SYSTEM') . '" />&nbsp;';
        $jdpic_language = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'language.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_LANGUAGE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_LANGUAGE') . '" />&nbsp;';
        $jdpic_download = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'download.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DOWNLOAD') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DOWNLOAD') . '" />&nbsp;';
        $jdpic_hits = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'download.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DOWNLOAD') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_DOWNLOAD_HITS') . '" />&nbsp;';
        $jdpic_size = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'stuff.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_FILESIZE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_FILESIZE') . '" />&nbsp;';
        $jdpic_price = '<img src="' . JURI::base() . $jDFPsfolders['mini'] . 'currency.png" style="vertical-align:middle;" width="' . $msize . '" height="' . $msize . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_PRICE') . '" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_PRICE') . '" />&nbsp;';
    }
    // Build a little pic for extern links
    $jdextern_url_pic = '<img src="' . $jDFPplugin_live_site . 'content/jdownloads/jdownloads/images/link_extern.gif" style="vertical-align:middle;" alt="" title="" />';
    $jd_file_pic = '<img src="' . JURI::base() . $jDFPsfolders['file'] . $files->file_pic . '" style="vertical-align:middle;" border="0" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" alt="" title="" />';
    // Pics for: new file / hot file /updated
    $hotpic = '<img src="' . JURI::base() . 'images/jdownloads/hotimages/' . $jlistConfigM['picname.is.file.hot'] . '" alt="" />';
    $newpic = '<img src="' . JURI::base() . 'images/jdownloads/newimages/' . $jlistConfigM['picname.is.file.new'] . '" alt="" />';
    $updatepic = '<img src="' . JURI::base() . 'images/jdownloads/updimages/' . $jlistConfigM['picname.is.file.updated'] . '" alt="" />';
    // Alternate CSS buttons when selected in configuration
    $status_color_hot = $jlistConfigM['css.button.color.hot'];
    $status_color_new = $jlistConfigM['css.button.color.new'];
    $status_color_updated = $jlistConfigM['css.button.color.updated'];
    $download_color = $jlistConfigM['css.button.color.download'];
    $download_size = $jlistConfigM['css.button.size.download'];
    $download_size_mirror = $jlistConfigM['css.button.size.download.mirror'];
    $download_color_mirror1 = $jlistConfigM['css.button.color.mirror1'];
    $download_color_mirror2 = $jlistConfigM['css.button.color.mirror2'];
    $download_size_listings = $jlistConfigM['css.button.size.download.small'];
    $jd_cat_id = $files->cat_id;
    $jd_filename = $files->url_download;
    $jd_file_language = $files->file_language;
    $jd_system = $files->system;
    if ($files->category_cat_dir_parent) {
        $category_dir = $files->category_cat_dir_parent . '/' . $files->category_cat_dir;
    } else {
        $category_dir = $files->category_cat_dir;
    }
    // Has this Download really a file?
    if (!$files->url_download && !$files->other_file_id && !$files->extern_file) {
        // only a document without file
        $no_file_info = JText::_('COM_JDOWNLOADS_FRONTEND_ONLY_DOCUMENT_USER_INFO');
        $download_has_a_file = false;
    } else {
        $download_has_a_file = true;
        $no_file_info = '';
    }
    // Compute the download slugs
    $files->slug = $files->file_alias ? $files->file_id . ':' . $files->file_alias : $files->file_id;
    // create all file titles
    $l_Template = JDHelper::buildFieldTitles($l_Template, $files);
    // When we have a simple document, view only the info not any buttons.
    if (!$download_has_a_file) {
        if (strpos($l_Template, '{url_download}')) {
            $l_Template = str_replace('{url_download}', $no_file_info, $l_Template);
        } else {
            $l_Template = str_replace('{checkbox_list}', $no_file_info, $l_Template);
        }
        // Place the images
        $l_Template = JDHelper::placeThumbs($l_Template, $files->images);
        if ($jlistConfigM['view.detailsite']) {
            $title_link = JRoute::_(JDownloadsHelperRoute::getDownloadRoute($files->slug, $files->cat_id, $files->language));
            $title_link_text = '<a href="' . $title_link . '">' . $db->escape($files->file_title) . '</a>';
            $detail_link_text = '<a href="' . $title_link . '">' . JText::_('COM_JDOWNLOADS_FE_DETAILS_LINK_TEXT_TO_DETAILS') . '</a>';
            // Build the file symbol (with link)
            if ($files->file_pic != '') {
                $filepic = '<a href="' . $title_link . '">' . '<img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" /></a> ';
            } else {
                $filepic = '';
            }
            $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
            // link to details view at the end
            $l_Template = str_replace('{link_to_details}', $detail_link_text, $l_Template);
            $l_Template = str_replace('{file_title}', $title_link_text, $l_Template);
        } else {
            // no links
            if ($files->file_pic != '') {
                $filepic = '<img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" />';
            } else {
                $filepic = '';
            }
            $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
            // remove link to details view at the end
            $l_Template = str_replace('{link_to_details}', '', $l_Template);
            $l_Template = str_replace('{file_title}', $files->file_title, $l_Template);
        }
        $l_Template = str_replace('{checkbox_list}', '', $l_Template);
        $l_Template = str_replace('{mirror_1}', '', $l_Template);
        $l_Template = str_replace('{mirror_2}', '', $l_Template);
        $l_Template = str_replace('{hits_value}', '', $l_Template);
        $l_Template = str_replace('{filesize_value}', '', $l_Template);
    }
    // insert rating system
    if ($jlistConfigM['view.ratings']) {
        $rating_system = JDHelper::getRatings($files->file_id, $files->rating_count, $files->rating_sum);
        $l_Template = str_replace('{rating}', $rating_system, $l_Template);
    } else {
        $l_Template = str_replace('{rating}', '', $l_Template);
    }
    // Build the license info data and build link
    if ($files->license == '') {
        $files->license = 0;
    }
    $lic_data = '';
    if ($files->license_url != '') {
        $lic_data = $jdpic_license . '<a href="' . $files->license_url . '" target="_blank" rel="nofollow" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_MINI_ICON_ALT_LICENCE') . '">' . $files->license_title . '</a> ' . $jdextern_url_pic;
    } else {
        if ($files->license_title != '') {
            if ($files->license_text != '') {
                $lic_data = $jdpic_license . $files->license_title;
                $lic_data .= JHtml::_('tooltip', $files->license_text, $files->license_title);
            } else {
                $lic_data = $files->license_title;
            }
        } else {
            $lic_data = '';
        }
    }
    $l_Template = str_replace('{license_text}', $lic_data, $l_Template);
    $l_Template = str_replace('{license}', $lic_data, $l_Template);
    // old placeholder
    // Build the 'files language' data
    $file_lang_values = explode(',', JDHelper::getOnlyLanguageSubstring($jlistConfigM['language.list']));
    if ($jd_file_language == 0) {
        $jd_showlanguage = '';
    } else {
        $jd_showlanguage = $jdpic_language . $file_lang_values[$jd_file_language];
    }
    $l_Template = str_replace("{language}", $jd_showlanguage, $l_Template);
    // old placeholder
    $l_Template = str_replace("{language_text}", $jd_showlanguage, $l_Template);
    // Build the 'System' data
    $file_sys_values = explode(',', $jlistConfigM['system.list']);
    if ($jd_system == 0) {
        $jd_showsystem = '';
    } else {
        $jd_showsystem = $jdpic_system . $file_sys_values[$jd_system];
    }
    $l_Template = str_replace("{system}", $jd_showsystem, $l_Template);
    // old placeholder
    $l_Template = str_replace("{system_text}", $jd_showsystem, $l_Template);
    // Build hits values
    $numbers_downloads = JDHelper::strToNumber((int) $files->downloads);
    $jd_showhits = $jdpic_hits . $numbers_downloads;
    $l_Template = str_replace("{hits_value}", $jd_showhits, $l_Template);
    // Build website url
    if (!$files->url_home == '') {
        if (strpos($files->url_home, 'http://') !== false) {
            $l_Template = str_replace('{url_home}', $jdpic_website . '<a href="' . $files->url_home . '" target="_blank" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '</a> ' . $jdextern_url_pic, $l_Template);
            $l_Template = str_replace('{author_url_text} ', $jdpic_website . '<a href="' . $files->url_home . '" target="_blank" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '</a> ' . $jdextern_url_pic, $l_Template);
        } else {
            $l_Template = str_replace('{url_home}', $jdpic_website . '<a href="http://' . $files->url_home . '" target="_blank" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '</a> ' . $jdextern_url_pic, $l_Template);
            $l_Template = str_replace('{author_url_text}', $jdpic_website . '<a href="http://' . $files->url_home . '" target="_blank" title="' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_HOMEPAGE') . '</a> ' . $jdextern_url_pic, $l_Template);
        }
    } else {
        $l_Template = str_replace('{url_home}', '', $l_Template);
        $l_Template = str_replace('{author_url_text}', '', $l_Template);
    }
    // Encode is link a mail
    if (strpos($files->url_author, '@') && $jlistConfigM['mail.cloaking']) {
        if (!$files->author) {
            $mail_encode = JHtml::_('email.cloak', $files->url_author);
        } else {
            $mail_encode = JHtml::_('email.cloak', $files->url_author, true, $files->author, false);
        }
    }
    // Build author link
    if ($files->author != '') {
        if ($files->url_author != '') {
            if ($mail_encode) {
                $link_author = $jdpic_author . $mail_encode;
            } else {
                if (strpos($files->url_author, 'http://') !== false) {
                    $link_author = $jdpic_author . '<a href="' . $files->url_author . '" target="_blank">' . $files->author . '</a> ' . $extern_url_pic;
                } else {
                    $link_author = $jdpic_author . '<a href="http://' . $files->url_author . '" target="_blank">' . $files->author . '</a> ' . $extern_url_pic;
                }
            }
            $l_Template = str_replace('{author}', $link_author, $l_Template);
            $l_Template = str_replace('{author_text}', $link_author, $l_Template);
            $l_Template = str_replace('{url_author}', '', $l_Template);
        } else {
            $link_author = $jdpic_author . $files->author;
            $l_Template = str_replace('{author}', $link_author, $l_Template);
            $l_Template = str_replace('{author_text}', $link_author, $l_Template);
            $l_Template = str_replace('{url_author}', '', $l_Template);
        }
    } else {
        $l_Template = str_replace('{url_author}', $jdpic_author . $files->url_author, $l_Template);
        $l_Template = str_replace('{author}', '', $l_Template);
        $l_Template = str_replace('{author_text}', '', $l_Template);
    }
    // Place the images
    $l_Template = JDHelper::placeThumbs($l_Template, $files->images, 'list');
    // Compute for HOT symbol
    if ($jlistConfigM['loads.is.file.hot'] > 0 && $files->downloads >= $jlistConfigM['loads.is.file.hot']) {
        // Is the old button pic used?
        if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
            $l_Template = str_replace('{pic_is_hot}', $hotpic, $l_Template);
        } else {
            // CSS Button is selected
            $l_Template = str_replace('{pic_is_hot}', '<span class="jdbutton ' . $status_color_hot . ' jstatus">' . JText::_('COM_JDOWNLOADS_HOT') . '</span>', $l_Template);
        }
    } else {
        $l_Template = str_replace('{pic_is_hot}', '', $l_Template);
    }
    // Compute for NEW symbol
    $days_diff = JDHelper::computeDateDifference(date('Y-m-d H:i:s'), $files->date_added);
    if ($jlistConfigM['days.is.file.new'] > 0 && $days_diff <= $jlistConfigM['days.is.file.new']) {
        // Is the old button used?
        if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
            $l_Template = str_replace('{pic_is_new}', $newpic, $l_Template);
        } else {
            // CSS Button is selected
            $l_Template = str_replace('{pic_is_new}', '<span class="jdbutton ' . $status_color_new . ' jstatus">' . JText::_('COM_JDOWNLOADS_NEW') . '</span>', $l_Template);
        }
    } else {
        $l_Template = str_replace('{pic_is_new}', '', $l_Template);
    }
    // Compute for UPDATED symbol
    // View it only when in the download is activated the 'updated' option
    if ($files->update_active) {
        $days_diff = JDHelper::computeDateDifference(date('Y-m-d H:i:s'), $files->modified);
        if ($jlistConfigM['days.is.file.updated'] > 0 && $days_diff >= 0 && $days_diff <= $jlistConfigM['days.is.file.updated']) {
            if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
                $l_Template = str_replace('{pic_is_updated}', $updatepic, $l_Template);
            } else {
                // CSS Button is selected
                $l_Template = str_replace('{pic_is_updated}', '<span class="jdbutton ' . $status_color_updated . ' jstatus">' . JText::_('COM_JDOWNLOADS_UPDATED') . '</span>', $l_Template);
            }
        } else {
            $l_Template = str_replace('{pic_is_updated}', '', $l_Template);
        }
    } else {
        $l_Template = str_replace('{pic_is_updated}', '', $l_Template);
    }
    // file size
    if (!$files->size == '') {
        $l_Template = str_replace('{size}', $jdpic_size . $files->size, $l_Template);
        $l_Template = str_replace('{filesize_value}', $jdpic_size . $files->size, $l_Template);
    } else {
        $l_Template = str_replace('{size}', '', $l_Template);
        $l_Template = str_replace('{filesize_value}', '', $l_Template);
    }
    // price
    if ($files->price != '') {
        $l_Template = str_replace('{price_value}', $jdpic_price . $files->price, $l_Template);
    } else {
        $l_Template = str_replace('{price_value}', '', $l_Template);
    }
    // file_date
    if ($files->file_date != '0000-00-00 00:00:00') {
        if ($files->params->get('show_date') == 0) {
            $filedate_data = $jdpic_date . JHtml::_('date', $files->file_date, $date_format['long']);
            $filedate_data_title = JText::_('COM_JDOWNLOADS_EDIT_FILE_FILE_DATE_TITLE');
        } else {
            $filedate_data = $jdpic_date . JHtml::_('date', $files->file_date, $date_format['short']);
            $filedate_data_title = '';
        }
    } else {
        $filedate_data = '';
        $filedate_data_title = '';
    }
    $l_Template = str_replace('{file_date}', $filedate_data, $l_Template);
    // date_added
    if ($files->date_added != '0000-00-00 00:00:00') {
        if ($files->params->get('show_date') == 0) {
            // use 'normal' date-time format field
            $date_data = $jdpic_date . JHtml::_('date', $files->date_added, $date_format['long']);
        } else {
            // use 'short' date-time format field
            $date_data = $jdpic_date . JHtml::_('date', $files->date_added, $date_format['short']);
        }
    } else {
        $date_data = '';
    }
    $l_Template = str_replace('{date_added}', $date_data, $l_Template);
    $l_Template = str_replace('{created_date_value}', $date_data, $l_Template);
    if ($files->creator) {
        $l_Template = str_replace('{created_by_value}', $files->creator, $l_Template);
    } else {
        $l_Template = str_replace('{created_by_value}', '', $l_Template);
    }
    if ($files->modifier) {
        $l_Template = str_replace('{modified_by_value}', $files->modifier, $l_Template);
    } else {
        $l_Template = str_replace('{modified_by_value}', '', $l_Template);
    }
    // modified_date
    if ($files->modified != '0000-00-00 00:00:00') {
        if ($files->params->get('show_date') == 0) {
            $modified_data = $jdpic_date . JHtml::_('date', $files->modified, $date_format['long']);
        } else {
            $modified_data = $jdpic_date . JHtml::_('date', $files->modified, $date_format['short']);
        }
    } else {
        $modified_data = '';
    }
    $l_Template = str_replace('{modified_date_value}', $modified_data, $l_Template);
    if ($files->release == '') {
        $l_Template = str_replace('{release}', '', $l_Template);
    } else {
        $l_Template = str_replace('{release}', $files->release, $l_Template);
        // with versions text from language file
        // $l_Template = str_replace('{release}', JText::_('COM_JDOWNLOADS_FRONTEND_VERSION_TITLE').$files->release, $l_Template);
    }
    // Create an additional hint for the description footer when this download has a file but user has not the download permissions
    if ($download_has_a_file) {
        if ($user->guest) {
            // when CSS3 buttons are activate, we use it also for the message
            if ($jlistConfigM['use.css.buttons.instead.icons']) {
                $first_reg_msg = '<div class="' . $jlistConfigM['css.button.color.download'] . ' ' . $jlistConfigM['css.button.size.download'] . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED') . '</div>';
            } else {
                $first_reg_msg = '<div class="jdpf_not_logged_in">' . JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED') . '</div>';
            }
        } else {
            // when CSS3 buttons are activate, we use it also for the message
            if ($jlistConfigM['use.css.buttons.instead.icons']) {
                $first_reg_msg = '<div class="' . $jlistConfigM['css.button.color.download'] . ' ' . $jlistConfigM['css.button.size.download'] . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED2') . '</div>';
            } else {
                $first_reg_msg = '<div class="jdpf_not_logged_in">' . JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED2') . '</div>';
            }
        }
    } else {
        $first_reg_msg = '';
    }
    // Check and build the description text
    if ($jlistConfigM['plugin.auto.file.short.description'] && $jlistConfigM['plugin.auto.file.short.description.value'] > 0) {
        if (strlen($files->description) > $jlistConfigM['plugin.auto.file.short.description.value']) {
            // Cut description text
            $shorted_text = preg_replace("/[^ ]*\$/", '..', substr($files->description, 0, $jlistConfigM['plugin.auto.file.short.description.value']));
            if (!$download_allowed) {
                //$l_Template = str_replace('{description}', $shorted_text.$first_reg_msg, $l_Template);
                $l_Template = str_replace('{description}', $shorted_text, $l_Template);
            } else {
                $l_Template = str_replace('{description}', $shorted_text, $l_Template);
            }
        } else {
            if (!$download_allowed) {
                // $l_Template = str_replace('{description}', $files->description.$first_reg_msg, $l_Template);
                $l_Template = str_replace('{description}', $files->description, $l_Template);
            } else {
                $l_Template = str_replace('{description}', $files->description, $l_Template);
            }
        }
    } else {
        if (!$download_allowed) {
            //$l_Template = str_replace("{description}",$files->description.$first_reg_msg, $l_Template);
            $l_Template = str_replace("{description}", $files->description, $l_Template);
        } else {
            $l_Template = str_replace("{description}", $files->description, $l_Template);
        }
    }
    // create filename
    if ($files->url_download) {
        $l_Template = str_replace('{file_name}', JDHelper::getShorterFilename($files->url_download), $l_Template);
    } elseif (isset($files->filename_from_other_download) && $files->filename_from_other_download != '') {
        $l_Template = str_replace('{file_name}', JDHelper::getShorterFilename($files->filename_from_other_download), $l_Template);
    } else {
        $l_Template = str_replace('{file_name}', '', $l_Template);
    }
    // google adsense
    if ($jlistConfigM['google.adsense.active']) {
        $l_Template = str_replace('{google_adsense}', stripslashes($jlistConfigM['google.adsense.code']), $l_Template);
    } else {
        $l_Template = str_replace('{google_adsense}', '', $l_Template);
    }
    // report download link
    if ($jd_user_settings->view_report_form) {
        $report_link = '<a href="' . JRoute::_("index.php?option=com_jdownloads&amp;view=report&amp;id=" . $files->slug . "&amp;catid=" . $files->cat_id . "&amp;Itemid=" . $root_itemid) . '" rel="nofollow">' . JText::_('COM_JDOWNLOADS_FRONTEND_REPORT_FILE_LINK_TEXT') . '</a>';
        $l_Template = str_replace('{report_link}', $report_link, $l_Template);
    } else {
        $l_Template = str_replace('{report_link}', '', $l_Template);
    }
    // media player
    if ($files->preview_filename) {
        // we use the preview file when exist
        $is_preview = true;
        $files->itemtype = JDHelper::getFileExtension($files->preview_filename);
        $is_playable = JDHelper::isPlayable($files->preview_filename);
        $extern_media = false;
    } else {
        $is_preview = false;
        if ($files->extern_file) {
            $extern_media = true;
            $files->itemtype = JDHelper::getFileExtension($files->extern_file);
            $is_playable = JDHelper::isPlayable($files->extern_file);
        } else {
            $files->itemtype = JDHelper::getFileExtension($files->url_download);
            $is_playable = JDHelper::isPlayable($files->url_download);
            $extern_media = false;
        }
    }
    if (!$jlistConfigM['flowplayer.use'] && $files->itemtype == 'mp3') {
        // we use only the 'OLD' mp3 player
        if ($extern_media) {
            $mp3_path = $files->extern_file;
        } else {
            if ($is_preview) {
                // we need the path to the "previews" folder
                $mp3_path = JUri::base() . basename($jlistConfigM['files.uploaddir']) . '/' . $jlistConfigM['preview.files.folder.name'] . '/' . $files->preview_filename;
            } else {
                // we use the normal download file for the player
                $mp3_path = JUri::base() . basename($jlistConfigM['files.uploaddir']) . '/' . $category_dir . '/' . $files->url_download;
            }
        }
        $mp3_config = trim($jlistConfigM['mp3.player.config']);
        $mp3_config = str_replace('', '', $mp3_config);
        $mp3_config = str_replace(';', '&amp;', $mp3_config);
        $mp3_player = '<object type="application/x-shockwave-flash" data="components/com_jdownloads/assets/mp3_player_maxi.swf" width="200" height="20">
            <param name="movie" value="components/com_jdownloads/assets/mp3_player_maxi.swf" />
            <param name="wmode" value="transparent"/>
            <param name="FlashVars" value="mp3=' . $mp3_path . '&amp;' . $mp3_config . '" />
            </object>';
        $l_Template = str_replace('{mp3_player}', $mp3_player, $l_Template);
    }
    if ($jlistConfigM['flowplayer.use'] && $is_playable) {
        // we will use the new flowplayer option
        if ($extern_media) {
            $media_path = $files->extern_file;
        } else {
            if ($is_preview) {
                // we need the relative path to the "previews" folder
                $media_path = basename($jlistConfigM['files.uploaddir']) . '/' . $jlistConfigM['preview.files.folder.name'] . '/' . $files->preview_filename;
            } else {
                // we use the normal download file for the player
                $media_path = basename($jlistConfigM['files.uploaddir']) . '/' . $category_dir . '/' . $files->url_download;
            }
        }
        $ipadcode = '';
        if ($files->itemtype == 'mp3') {
            $fullscreen = 'false';
            $autohide = 'false';
            $playerheight = (int) $jlistConfigM['flowplayer.playerheight.audio'];
            // we must use also the ipad plugin identifier when required
            // see http://flowplayer.blacktrash.org/test/ipad-audio.html and http://flash.flowplayer.org/plugins/javascript/ipad.html
            if ($ipad_user) {
                $ipadcode = '.ipad();';
            }
        } else {
            $fullscreen = 'true';
            $autohide = 'true';
            $playerheight = (int) $jlistConfigM['flowplayer.playerheight'];
        }
        $player = '<a href="' . $media_path . '" style="display:block;width:' . $jlistConfigM['flowplayer.playerwidth'] . 'px; height:' . $playerheight . 'px;" class="player" id="player' . $files->file_id . '"></a>';
        $player .= '<script language="JavaScript">
            // install flowplayer into container
                        flowplayer("player' . $files->file_id . '", "' . JURI::base() . 'components/com_jdownloads/assets/flowplayer/flowplayer-3.2.16.swf",  
                         {  
                plugins: {
                    controls: {
                        // insert at first the config settings
                        ' . $jlistConfigM['flowplayer.control.settings'] . '
                        // and now the basics
                        fullscreen: ' . $fullscreen . ',
                        height: ' . (int) $jlistConfigM['flowplayer.playerheight.audio'] . ',
                        autoHide: ' . $autohide . ',
                    }
                    
                },
                clip: {
                    autoPlay: false,
                    // optional: when playback starts close the first audio playback
                     onBeforeBegin: function() {
                        $f("player' . $files->file_id . '").close();
                    }
                }
            })' . $ipadcode . '; </script>';
        // the 'ipad code' above is only required for ipad/iphone users
        // We will replace at first the old placeholder when exist
        if (strpos($l_Template, '{mp3_player}')) {
            $l_Template = str_replace('{mp3_player}', $player, $l_Template);
        } else {
            $l_Template = str_replace('{preview_player}', $player, $l_Template);
        }
    }
    if ($jlistConfigM['mp3.view.id3.info'] && $files->itemtype == 'mp3' && !$extern_media) {
        // read mp3 infos
        if ($is_preview) {
            // get the path to the preview file
            $mp3_path_abs = $jlistConfigM['files.uploaddir'] . '/' . $jlistConfigM['preview.files.folder.name'] . '/' . $files->preview_filename;
        } else {
            // get the path to the downloads file
            $mp3_path_abs = $jlistConfigM['files.uploaddir'] . '/' . $category_dir . '/' . $files->url_download;
        }
        $info = JDHelper::getID3v2Tags($mp3_path_abs);
        if ($info) {
            // add it
            $mp3_info = stripslashes($jlistConfigM['mp3.info.layout']);
            $mp3_info = str_replace('{name_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_TITLE'), $mp3_info);
            if ($is_preview) {
                $mp3_info = str_replace('{name}', $files->preview_filename, $mp3_info);
            } else {
                $mp3_info = str_replace('{name}', $files->url_download, $mp3_info);
            }
            $mp3_info = str_replace('{album_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_ALBUM'), $mp3_info);
            if (isset($info['TALB'])) {
                $mp3_info = str_replace('{album}', $info['TALB'], $mp3_info);
            } else {
                $mp3_info = str_replace('{album}', '', $mp3_info);
            }
            $mp3_info = str_replace('{artist_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_ARTIST'), $mp3_info);
            if (isset($info['TPE1'])) {
                $mp3_info = str_replace('{artist}', $info['TPE1'], $mp3_info);
            } else {
                $mp3_info = str_replace('{artist}', '', $mp3_info);
            }
            $mp3_info = str_replace('{genre_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_GENRE'), $mp3_info);
            if (isset($info['TCON'])) {
                $mp3_info = str_replace('{genre}', $info['TCON'], $mp3_info);
            } else {
                $mp3_info = str_replace('{genre}', '', $mp3_info);
            }
            $mp3_info = str_replace('{year_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_YEAR'), $mp3_info);
            if (isset($info['TYER'])) {
                $mp3_info = str_replace('{year}', $info['TYER'], $mp3_info);
            } else {
                $mp3_info = str_replace('{year}', '', $mp3_info);
            }
            $mp3_info = str_replace('{length_title}', JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_LENGTH'), $mp3_info);
            if (isset($info['TLEN'])) {
                $mp3_info = str_replace('{length}', $info['TLEN'] . ' ' . JText::_('COM_JDOWNLOADS_FE_VIEW_ID3_MINS'), $mp3_info);
            } else {
                $mp3_info = str_replace('{length}', '', $mp3_info);
            }
            $l_Template = str_replace('{mp3_id3_tag}', $mp3_info, $l_Template);
        }
    }
    // replace the {preview_url}
    if ($files->preview_filename) {
        // we need the relative path to the "previews" folder
        $media_path = basename($jlistConfigM['files.uploaddir']) . '/' . $jlistConfigM['preview.files.folder.name'] . '/' . $files->preview_filename;
        $l_Template = str_replace('{preview_url}', $media_path, $l_Template);
    } else {
        $l_Template = str_replace('{preview_url}', '', $l_Template);
    }
    $user_can_see_download_url = false;
    // only view download link when user has correct access level
    if ($files->params->get('access-download') == true) {
        $user_can_see_download_url = true;
        $blank_window = '';
        $blank_window1 = '';
        $blank_window2 = '';
        // get file extension
        $view_types = array();
        $view_types = explode(',', $jlistConfigM['file.types.view']);
        $only_file_name = basename($files->url_download);
        $filesextension = JDHelper::getFileExtension($only_file_name);
        if (in_array($filesextension, $view_types)) {
            $blank_window = 'target="_blank"';
        }
        // check is set link to a new window?
        if ($files->extern_file && $files->extern_site) {
            $blank_window = 'target="_blank"';
        }
        // is 'direct download' activated?
        if ($jlistConfigM['direct.download'] == '0') {
            // when not, we must link to the summary page
            $url_task = 'summary';
            $blank_window = '';
            $download_link = JRoute::_(JDownloadsHelperRoute::getOtherRoute($files->slug, $files->cat_id, $files->language, $url_task));
        } else {
            if ($files->license_agree || $files->password || $jd_user_settings->view_captcha) {
                // user must agree the license - fill out a password field - or fill out the captcha human check - so we must view the summary page!
                $url_task = 'summary';
                $download_link = JRoute::_(JDownloadsHelperRoute::getOtherRoute($files->slug, $files->cat_id, $files->language, $url_task));
            } else {
                // start the download promptly
                $url_task = 'download.send';
                $download_link = JRoute::_('index.php?option=com_jdownloads&amp;task=download.send&amp;id=' . $files->file_id . '&amp;catid=' . $files->cat_id . '&amp;m=0');
            }
        }
        if ($url_task == 'download.send') {
            // is the old button used?
            if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
                $download_link_text = '<a ' . $blank_window . ' href="' . $download_link . '" class="jd_download_url"><img src="' . JURI::base() . 'images/jdownloads/downloadimages/' . $jlistConfigM['download.pic.details'] . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" /></a>';
            } else {
                // we use the new css button
                $download_link_text = '<a ' . $blank_window . ' href="' . $download_link . '" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" class="jdbutton ' . $download_color . ' ' . $download_size_listings . '">' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '</a>';
            }
        } else {
            // is the old button used?
            if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
                $download_link_text = '<a href="' . $download_link . '" class="jd_download_url"><img src="' . JURI::base() . 'images/jdownloads/downloadimages/' . $jlistConfigM['download.pic.details'] . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" title="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" /></a>';
            } else {
                // we use the new css button
                $download_link_text = '<a ' . $blank_window . ' href="' . $download_link . '" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" class="jdbutton ' . $download_color . ' ' . $download_size_listings . '">' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '</a>';
            }
        }
        if (strpos($l_Template, '{url_download}')) {
            $l_Template = str_replace('{url_download}', $download_link_text, $l_Template);
        } else {
            $l_Template = str_replace('{checkbox_list}', $download_link_text, $l_Template);
        }
        // mirrors
        if ($files->mirror_1) {
            if ($files->extern_site_mirror_1 && $url_task == 'download.send') {
                $blank_window1 = 'target="_blank"';
            }
            $mirror1_link_dum = JRoute::_('index.php?option=com_jdownloads&amp;task=download.send&amp;id=' . $files->file_id . '&amp;catid=' . $files->cat_id . '&amp;m=1');
            //$mirror1_link_dum = JRoute::_(JDownloadsHelperRoute::getOtherRoute($files->slug, $files->cat_id, $files->language, $url_task, 1));
            // is the old button used?
            if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
                $mirror1_link = '<a ' . $blank_window1 . ' href="' . $mirror1_link_dum . '" class="jd_download_url"><img src="' . JURI::base() . 'images/jdownloads/downloadimages/' . $jlistConfigM['download.pic.mirror_1'] . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MIRROR_URL_TITLE_1') . '" /></a>';
            } else {
                // we use the new css button
                $mirror1_link = '<a ' . $blank_window1 . ' href="' . $mirror1_link_dum . '" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" class="jdbutton ' . $download_color_mirror1 . ' ' . $download_size_mirror . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_MIRROR_URL_TITLE_1') . '</a>';
            }
            $l_Template = str_replace('{mirror_1}', $mirror1_link, $l_Template);
        } else {
            $l_Template = str_replace('{mirror_1}', '', $l_Template);
        }
        if ($files->mirror_2) {
            if ($files->extern_site_mirror_2 && $url_task == 'download.send') {
                $blank_window2 = 'target="_blank"';
            }
            $mirror2_link_dum = JRoute::_('index.php?option=com_jdownloads&amp;task=download.send&amp;id=' . $files->file_id . '&amp;catid=' . $files->cat_id . '&amp;m=2');
            //$mirror2_link_dum = JRoute::_(JDownloadsHelperRoute::getOtherRoute($files->slug, $files->cat_id, $files->language, $url_task, 2));
            // is the old button used?
            if ($jlistConfigM['use.css.buttons.instead.icons'] == '0') {
                $mirror2_link = '<a ' . $blank_window2 . ' href="' . $mirror2_link_dum . '" class="jd_download_url"><img src="' . JURI::base() . 'images/jdownloads/downloadimages/' . $jlistConfigM['download.pic.mirror_2'] . '" border="0" alt="' . JText::_('COM_JDOWNLOADS_FRONTEND_MIRROR_URL_TITLE_2') . '" /></a>';
            } else {
                // we use the new css button
                $mirror2_link = '<a ' . $blank_window2 . ' href="' . $mirror2_link_dum . '" alt="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" class="jdbutton ' . $download_color_mirror2 . ' ' . $download_size_mirror . '">' . JText::_('COM_JDOWNLOADS_FRONTEND_MIRROR_URL_TITLE_2') . '</a>';
            }
            $l_Template = str_replace('{mirror_2}', $mirror2_link, $l_Template);
        } else {
            $l_Template = str_replace('{mirror_2}', '', $l_Template);
        }
    } else {
        // visitor has not access to download this item - so we will inform him
        if (strpos($l_Template, '{url_download}')) {
            $l_Template = str_replace('{url_download}', $first_reg_msg, $l_Template);
        } else {
            $l_Template = str_replace('{checkbox_list}', $first_reg_msg, $l_Template);
        }
        $l_Template = str_replace('{mirror_1}', '', $l_Template);
        $l_Template = str_replace('{mirror_2}', '', $l_Template);
    }
    if ($jlistConfigM['view.detailsite']) {
        $title_link = JRoute::_(JDownloadsHelperRoute::getDownloadRoute($files->slug, $files->cat_id, $files->language));
        $title_link_text = '<a href="' . $title_link . '">' . $db->escape($files->file_title) . '</a>';
        $detail_link_text = '<a href="' . $title_link . '">' . JText::_('COM_JDOWNLOADS_FE_DETAILS_LINK_TEXT_TO_DETAILS') . '</a>';
        // Build the file symbol (with link)
        if ($files->file_pic != '') {
            $filepic = '<a href="' . $title_link . '">' . '<img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" /></a> ';
        } else {
            $filepic = '';
        }
        $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
        // link to details view at the end
        $l_Template = str_replace('{link_to_details}', $detail_link_text, $l_Template);
        $l_Template = str_replace('{file_title}', $title_link_text, $l_Template);
    } elseif ($jlistConfigM['use.download.title.as.download.link']) {
        if ($user_can_see_download_url) {
            // build title link as download link
            if ($url_task == 'download.send') {
                $download_link_text = '<a ' . $blank_window . ' href="' . $download_link . '" title="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '" class="jd_download_url">' . $files->file_title . '</a>';
            } else {
                $download_link_text = '<a href="' . $download_link . '" title="' . JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL') . '">' . $files->file_title . '</a>';
            }
            // View file icon also with link
            if ($files->file_pic != '') {
                $filepic = '<a href="' . $download_link . '"><img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" /></a>';
            } else {
                $filepic = '';
            }
            $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
            $l_Template = str_replace('{link_to_details}', '', $l_Template);
            $l_Template = str_replace('{file_title}', $download_link_text, $l_Template);
        } else {
            // user may not use download link
            $l_Template = str_replace('{file_title}', $files->file_title, $l_Template);
            if ($files->file_pic != '') {
                $filepic = '<img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" />';
            } else {
                $filepic = '';
            }
            $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
        }
    } else {
        // no links
        if ($files->file_pic != '') {
            $filepic = '<img src="' . JURI::base() . 'images/jdownloads/fileimages/' . $files->file_pic . '" align="top" width="' . $jlistConfigM['file.pic.size'] . '" height="' . $jlistConfigM['file.pic.size.height'] . '" border="0" alt="" />';
        } else {
            $filepic = '';
        }
        $l_Template = str_replace('{file_pic}', $filepic, $l_Template);
        // remove link to details view at the end
        $l_Template = str_replace('{link_to_details}', '', $l_Template);
        $l_Template = str_replace('{file_title}', $files->file_title, $l_Template);
    }
    $l_Template = str_replace('{file_title_only}', $files->file_title, $l_Template);
    $l_Template = str_replace('{checkbox_list}', '', $l_Template);
    $l_Template = str_replace('{file_id}', $files->file_id, $l_Template);
    $l_Template = str_replace('{ordering}', $files->ordering, $l_Template);
    $l_Template = str_replace('{published}', $files->published, $l_Template);
    $l_Template = str_replace('{cat_id}', $files->cat_id, $l_Template);
    $l_Template = str_replace('{rank}', $jDFPrank, $l_Template);
    $l_Template = str_replace('{mp3_player}', '', $l_Template);
    $l_Template = str_replace('{mp3_id3_tag}', '', $l_Template);
    $l_Template = str_replace('{preview_player}', '', $l_Template);
    $l_Template = str_replace('{report_link}', '', $l_Template);
    $l_Template = str_replace('{sum_jcomments}', '', $l_Template);
    $l_Template = str_replace('{rating}', '', $l_Template);
    // custom fields
    $custom_fields_arr = existsCustomFieldsTitlesPlg();
    $row_custom_values = array('dummy', $files->custom_field_1, $files->custom_field_2, $files->custom_field_3, $files->custom_field_4, $files->custom_field_5, $files->custom_field_6, $files->custom_field_7, $files->custom_field_8, $files->custom_field_9, $files->custom_field_10, $files->custom_field_11, $files->custom_field_12, $files->custom_field_13, $files->custom_field_14);
    for ($x = 1; $x < 15; $x++) {
        // replace placeholder with title and value
        if (in_array($x, $custom_fields_arr[0]) && $row_custom_values[$x] && $row_custom_values[$x] != '0000-00-00') {
            $l_Template = str_replace("{custom_title_{$x}}", $custom_fields_arr[1][$x - 1], $l_Template);
            if ($x > 5) {
                $l_Template = str_replace("{custom_value_{$x}}", stripslashes($row_custom_values[$x]), $l_Template);
            } else {
                $l_Template = str_replace("{custom_value_{$x}}", $custom_fields_arr[2][$x - 1][$row_custom_values[$x]], $l_Template);
            }
        } else {
            // remove placeholder
            if ($jlistConfigM['remove.field.title.when.empty']) {
                $l_Template = str_replace("{custom_title_{$x}}", '', $l_Template);
            } else {
                $l_Template = str_replace("{custom_title_{$x}}", $custom_fields_arr[1][$x - 1], $l_Template);
            }
            $l_Template = str_replace("{custom_value_{$x}}", '', $l_Template);
        }
    }
    // insert files title area
    if (!$jDLayoutTitleExists) {
        $l_Template = str_replace('{files_title_begin}', '', $l_Template);
        $l_Template = str_replace('{files_title_end}', '', $l_Template);
        $l_Template = str_replace('{files_title_text}', JText::_('COM_JDOWNLOADS_FE_FILELIST_TITLE_OVER_FILES_LIST'), $l_Template);
        $jDLayoutTitleExists = true;
    } else {
        if (strpos($l_Template, "{files_title_end}") > 0) {
            $pos_end = strpos($l_Template, '{files_title_end}');
            $pos_beg = strpos($l_Template, '{files_title_begin}');
            $l_Template = substr_replace($l_Template, '', $pos_beg, $pos_end - $pos_beg + 17);
        }
    }
    // support for other content plugins
    // $l_Template = JHTML::_('content.prepare', $l_Template);
    // remove empty html tags
    if ($jlistConfigM['remove.empty.tags']) {
        $l_Template = JDHelper::removeEmptyTags($l_Template);
    }
    return str_replace("[[[", "{", $l_Template);
}
示例#3
0
     }
 }
 $body = str_replace('{mp3_player}', '', $body);
 $body = str_replace('{preview_player}', '', $body);
 $body = str_replace('{mp3_id3_tag}', '', $body);
 // replace the {preview_url}
 if ($this->item->preview_filename) {
     // we need the relative path to the "previews" folder
     $media_path = $jdownloads_root_dir_name . '/' . $jlistConfig['preview.files.folder.name'] . '/' . $this->item->preview_filename;
     $body = str_replace('{preview_url}', $media_path, $body);
 } else {
     $body = str_replace('{preview_url}', '', $body);
 }
 // insert rating system
 if ($jlistConfig['view.ratings']) {
     $rating_system = JDHelper::getRatings($this->item->file_id, $this->item->rating_count, $this->item->rating_sum);
     $body = str_replace('{rating}', $rating_system, $body);
 } else {
     $body = str_replace('{rating}', '', $body);
 }
 // remove empty html tags
 if ($jlistConfig['remove.empty.tags']) {
     $body = JDHelper::removeEmptyTags($body);
 }
 // Option for JComments integration
 if ($jlistConfig['jcomments.active']) {
     $jcomments = JPATH_BASE . '/components/com_jcomments/jcomments.php';
     if (file_exists($jcomments)) {
         require_once $jcomments;
         $obj_id = $this->item->file_id;
         $obj_title = $this->item->file_title;