Beispiel #1
1
        echo $this->loadTemplate('results');
    } else {
        echo $this->loadTemplate('error');
    }
}
// ==========================================
// FOOTER SECTION
// ==========================================
$footer = '';
$layout = JDHelper::getLayout(7, false);
if ($layout) {
    $footer = $layout->template_footer_text;
}
// components footer text
if ($jlistConfig['downloads.footer.text'] != '') {
    $footer_text = stripslashes(JDHelper::getOnlyLanguageSubstring($jlistConfig['downloads.footer.text']));
    if ($jlistConfig['google.adsense.active'] && $jlistConfig['google.adsense.code'] != '') {
        $footer_text = str_replace('{google_adsense}', stripslashes($jlistConfig['google.adsense.code']), $footer_text);
    } else {
        $footer_text = str_replace('{google_adsense}', '', $footer_text);
    }
    $footer .= $footer_text;
}
// we need here not a back button
$footer = str_replace('{back_link}', '', $footer);
$footer .= JDHelper::checkCom();
// remove empty html tags
if ($jlistConfig['remove.empty.tags']) {
    $footer = JDHelper::removeEmptyTags($footer);
}
echo $footer . '</div>';
Beispiel #2
1
 public function send()
 {
     global $jlistConfig;
     // Initialise variables.
     $data = JRequest::getVar('jform', array(), 'post', 'array');
     $app = JFactory::getApplication();
     $name = array_key_exists('name', $data) ? $data['name'] : '';
     $email = array_key_exists('email', $data) ? $data['email'] : '';
     $file_id = array_key_exists('file_id', $data) ? intval($data['file_id']) : 0;
     $file_title = array_key_exists('file_title', $data) ? $data['file_title'] : '';
     $file_name = array_key_exists('url_download', $data) ? $data['url_download'] : '';
     $cat_id = array_key_exists('cat_id', $data) ? $data['cat_id'] : 0;
     $cat_title = array_key_exists('cat_title', $data) ? $data['cat_title'] : '';
     $reason = array_key_exists('reason', $data) ? intval($data['reason']) : 0;
     $text = array_key_exists('text', $data) ? $data['text'] : '';
     switch ($reason) {
         case 0:
             $reason_text = '';
             break;
         case 1:
             $reason_text = JText::_('COM_JDOWNLOADS_REPORT_REASON_MISSING');
             break;
         case 2:
             $reason_text = JText::_('COM_JDOWNLOADS_REPORT_REASON_BAD_FILE');
             break;
         case 3:
             $reason_text = JText::_('COM_JDOWNLOADS_REPORT_REASON_OTHERS');
             break;
     }
     // get the users IP
     $ip = JDHelper::getRealIp();
     // automatically removes html formatting
     $text = JFilterInput::getInstance()->clean($text, 'string');
     $name = JFilterInput::getInstance()->clean($name, 'string');
     $email = JFilterInput::getInstance()->clean($email, 'string');
     // Get all users email addresses in an array
     $recipients = explode(';', $jlistConfig['send.mailto.report']);
     // Check to see if there are any users in this group before we continue
     if (!count($recipients)) {
         $this->setError(JText::_('COM_JDOWNLOADS_NO_EMAIL_RECIPIENT_FOUND'));
         return false;
     }
     // Get the Mailer
     $mailer = JFactory::getMailer();
     // Build email message format.
     $mailer->setSender(array($app->getCfg('mailfrom'), $app->getCfg('fromname')));
     $mailer->setSubject('jDownloads - ' . stripslashes(JDHelper::getOnlyLanguageSubstring($jlistConfig['report.mail.subject'])));
     $message = JDHelper::getOnlyLanguageSubstring($jlistConfig['report.mail.layout']);
     $message = str_replace('{category}', $cat_title, $message);
     $message = str_replace('{cat_id}', $cat_id, $message);
     $message = str_replace('{file_id}', $file_id, $message);
     $message = str_replace('{file_title}', $file_title, $message);
     $message = str_replace('{file_name}', $file_name, $message);
     $message = str_replace('{name}', $name, $message);
     $message = str_replace('{mail}', $email, $message);
     $message = str_replace('{ip}', $ip, $message);
     $date_format = JDHelper::getDateFormat();
     $message = str_replace('{date_time}', JHtml::date($input = 'now', $date_format['long'], true), $message);
     $message = str_replace('{reason}', $reason_text, $message);
     $message = str_replace('{message}', $text, $message);
     $mailer->setBody($message);
     // Example: Optional file attached
     // $mailer->addAttachment(JPATH_COMPONENT.'/assets/document.pdf');
     // Example: Optionally add embedded image
     // $mailer->AddEmbeddedImage( JPATH_COMPONENT.'/assets/logo128.jpg', 'logo_id', 'logo.jpg', 'base64', 'image/jpeg' );
     // Needed for use HTML
     $mailer->IsHTML(true);
     $mailer->Encoding = 'base64';
     // Add recipients
     $mailer->addRecipient($recipients);
     // Send the Mail
     $result = $mailer->Send();
     if ($result !== true) {
         $this->setError($result->getError());
         return false;
     } else {
         JError::raiseNotice(100, JText::_('COM_JDOWNLOADS_EMAIL_SUCCESSFUL_SENDED'));
         return true;
     }
 }
Beispiel #3
0
 public function getLabel()
 {
     global $jlistConfig;
     $app = JFactory::getApplication();
     JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
     $label = '';
     $replace = '';
     // Get the label text from the XML element, defaulting to the element name.
     if ($app->isAdmin()) {
         $text = $this->element['label'] ? (string) $this->element['label'] : (string) JDownloadsHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.11.title']);
     } else {
         $text = $this->element['label'] ? (string) $this->element['label'] : (string) JDHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.11.title']);
     }
     // Build the class for the label.
     $class = !empty($this->description) ? 'hasTip' : '';
     $class = $this->required == true ? $class . ' required' : $class;
     $req = $this->required == true ? '<span class="star">&#160;*</span>' : '';
     // Add the opening label tag and main attributes attributes.
     $label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
     // If a description is specified, use it to build a tooltip.
     if (!empty($this->description)) {
         $label .= ' title="' . htmlspecialchars(trim(JText::_($text), ':') . '::' . JText::_($this->description), ENT_COMPAT, 'UTF-8') . '"';
     }
     // Add the label text and closing tag.
     $label .= '>' . JText::_($text) . $req . '</label>';
     return $label;
 }
Beispiel #4
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     global $jlistConfig;
     $app = JFactory::getApplication();
     JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
     $custom_field_list = array();
     $values = array();
     $x = 0;
     if ($jlistConfig['custom.field.1.title'] != '') {
         if ($app->isAdmin()) {
             $values = explode(',', JDownloadsHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.1.values']));
         } else {
             $values = explode(',', JDHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.1.values']));
         }
     }
     $custom_field_list[] = JHtml::_('select.option', $x, JText::_('COM_JDOWNLOADS_SELECT'));
     foreach ($values as $value) {
         $x++;
         $custom_field_list[] = JHtml::_('select.option', $x, $value);
     }
     return $custom_field_list;
 }
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     global $jlistConfig;
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
     } else {
         JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
     }
     // Initialise variables.
     $options = array();
     $file_lang_values = '';
     // build file language listbox
     if ($app->isAdmin()) {
         $file_lang_values = explode(',', JDownloadsHelper::getOnlyLanguageSubstring($jlistConfig['language.list']));
     } else {
         $file_lang_values = explode(',', JDHelper::getOnlyLanguageSubstring($jlistConfig['language.list']));
     }
     for ($i = 0; $i < count($file_lang_values); $i++) {
         $options[] = JHtml::_('select.option', $i, $file_lang_values[$i]);
     }
     return $options;
 }
Beispiel #6
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);
}
Beispiel #7
0
if ($jlistConfig['view.back.button']) {
    $footer = str_replace('{back_link}', '<a href="javascript:history.go(-1)">' . JText::_('COM_JDOWNLOADS_FRONTEND_BACK_BUTTON') . '</a>', $footer);
} else {
    $footer = str_replace('{back_link}', '', $footer);
}
$footer .= JDHelper::checkCom();
$html .= $footer;
$html .= '</div>';
// remove empty html tags
if ($jlistConfig['remove.empty.tags']) {
    $html = JDHelper::removeEmptyTags($html);
}
// ==========================================
// VIEW THE BUILDED OUTPUT
// ==========================================
if (!$jlistConfig['offline']) {
    echo $html;
} else {
    // admins can view it always
    if ($is_admin) {
        echo $html;
    } else {
        // build the offline message
        $html = '';
        // offline message
        if ($jlistConfig['offline.text'] != '') {
            $html .= JDHelper::getOnlyLanguageSubstring($jlistConfig['offline.text']);
        }
        echo $html;
    }
}
Beispiel #8
0
    public function display($tpl = null)
    {
        //Load pane behavior in joomla 3
        jimport('joomla.html.html.tabs');
        // Initialise variables.
        $app = JFactory::getApplication();
        $user = JFactory::getUser();
        $document = JFactory::getDocument();
        $document->addStyleSheet('components/com_jdownloads/assets/css/jdownloads_fe.css');
        $custom_css_path = JPATH_ROOT . '/components/com_jdownloads/assets/css/jdownloads_custom.css';
        if (JFile::exists($custom_css_path)) {
            $document->addStyleSheet(JURI::base() . "components/com_jdownloads/assets/css/jdownloads_custom.css", 'text/css', null, array());
        }
        $document->addScript(JURI::base() . 'components/com_jdownloads/assets/js/jdownloads.js');
        $document->addScriptDeclaration('
        // dynamically add a new image file upload field when the prior generated fields is used
        function add_new_image_file(field)
        {
            // Get the number of files previously uploaded.
            var count = parseInt(document.getElementById(\'image_file_count\').value);
            var sum = parseInt(document.getElementById(\'sum_listed_images\').value);
            var max = parseInt(document.getElementById(\'max_sum_images\').value);
            
            // Get the name of the file that has just been uploaded.
            var file_name = document.getElementById("file_upload_thumb["+count+"]").value;
           
            // Hide the file upload control containing the information about the picture that was just uploaded.
            document.getElementById(\'new_file_row\').style.display = "none";
            document.getElementById(\'new_file_row\').id = "new_file_row["+count+"]";
           
            // Get a reference to the table containing the uploaded pictures.       
            var table = document.getElementById(\'files_table\');
           
            // Insert a new row with the file name and a delete button.
            var row = table.insertRow(table.rows.length);
            row.id = "inserted_file["+count+"]";
            var cell0 = row.insertCell(0);
            cell0.innerHTML = \'<input type="text" disabled="disabled" name="inserted_file[\'+count+\']" value="\'+file_name+\'" size="40" /><input type="button" name="delete[\'+count+\']" value="' . JTEXT::_('COM_JDOWNLOADS_REMOVE') . '" onclick="delete_inserted_image_field(this)">\';
           
            // Increment count of the number of files uploaded.
            ++count;
            if (count+sum < max){
                // Insert a new file upload control in the table.
                var row = table.insertRow(table.rows.length);
                row.id = "new_file_row";
                var cell0 = row.insertCell(0);
                cell0.innerHTML = \'<input type="file" name="file_upload_thumb[\'+count+\']" id="file_upload_thumb[\'+count+\']" size="40" accept="image/gif,image/jpeg,image/jpg,image/png" onchange="add_new_image_file(this)" />\';   
            }
            // Update the value of the file hidden input tag holding the count of files uploaded.
            document.getElementById(\'image_file_count\').value = count;
        }

        // user will remove the files they have previously added
        function delete_inserted_image_field(field)
        {
            // Get the field name.
            var name = field.name;
            
            // Extract the file id from the field name.
            var id = name.substr(name.indexOf(\'[\') + 1, name.indexOf(\']\') - name.indexOf(\'[\') - 1);
           
            // Hide the row displaying the uploaded file name.
            document.getElementById("inserted_file["+id+"]").style.display = "none";
               
            // Get a reference to the uploaded file control.
            var control = document.getElementById("file_upload_thumb["+id+"]");
           
            // Remove the new file control.
            control.parentNode.removeChild(control);
            
            // check that we have always a input field when we remove a other file
            var found = false;
            for (var i = 0; i <= 30; i++){
                 if (document.adminForm.elements["file_upload_thumb["+i+"]"]) {
                    found = true;
                 }
            }
            if (!found) add_new_image_file(field);
        }');
        // Get model data.
        $this->state = $this->get('State');
        $this->item = $this->get('Item');
        $this->form = $this->get('Form');
        // we must get all 'allowed' category IDs
        $this->authorised_cats = JDHelper::getAuthorisedJDCategories('core.create', $user);
        $user_rules = JDHelper::getUserRules();
        $user_limits = JDHelper::getUserLimits($user_rules, 0);
        // Here is the place to change field attributes - defined in user groups limits
        if (!$user_rules->uploads_use_editor) {
            $this->form->setFieldAttribute('description', 'type', 'textarea');
            $this->form->setFieldAttribute('description', 'rows', '4');
            $this->form->setFieldAttribute('description', 'cols', '60');
            $this->form->setFieldAttribute('description_long', 'type', 'textarea');
            $this->form->setFieldAttribute('description_long', 'rows', '6');
            $this->form->setFieldAttribute('description_long', 'cols', '60');
            $this->form->setFieldAttribute('changelog', 'type', 'textarea');
            $this->form->setFieldAttribute('changelog', 'rows', '4');
            $this->form->setFieldAttribute('changelog', 'cols', '60');
            $this->form->setFieldAttribute('custom_field_13', 'type', 'textarea');
            $this->form->setFieldAttribute('custom_field_13', 'rows', '4');
            $this->form->setFieldAttribute('custom_field_13', 'cols', '60');
            $this->form->setFieldAttribute('custom_field_14', 'type', 'textarea');
            $this->form->setFieldAttribute('custom_field_14', 'rows', '4');
            $this->form->setFieldAttribute('custom_field_14', 'cols', '60');
        }
        // activate the 'required' state
        if ($user_rules->form_alias && $user_rules->form_alias_x) {
            $this->form->setFieldAttribute('file_alias', 'required', 'true');
        }
        if ($user_rules->form_author_mail && $user_rules->form_author_mail_x) {
            $this->form->setFieldAttribute('url_author', 'required', 'true');
        }
        if ($user_rules->form_author_name && $user_rules->form_author_name_x) {
            $this->form->setFieldAttribute('author', 'required', 'true');
        }
        if ($user_rules->form_website && $user_rules->form_website_x) {
            $this->form->setFieldAttribute('url_home', 'required', 'true');
        }
        if ($user_rules->form_changelog && $user_rules->form_changelog_x) {
            $this->form->setFieldAttribute('changelog', 'required', 'true');
        }
        if ($user_rules->form_creation_date && $user_rules->form_creation_date_x) {
            $this->form->setFieldAttribute('date_added', 'required', 'true');
        }
        if ($user_rules->form_external_file && $user_rules->form_external_file_x) {
            $this->form->setFieldAttribute('extern_file', 'required', 'true');
        }
        if ($user_rules->form_license && $user_rules->form_license_x) {
            $this->form->setFieldAttribute('license', 'required', 'true');
        }
        if ($user_rules->form_version && $user_rules->form_version_x) {
            $this->form->setFieldAttribute('release', 'required', 'true');
        }
        if ($user_rules->form_file_date && $user_rules->form_file_date_x) {
            $this->form->setFieldAttribute('file_date', 'required', 'true');
        }
        if ($user_rules->form_file_language && $user_rules->form_file_language_x) {
            $this->form->setFieldAttribute('file_language', 'required', 'true');
        }
        if ($user_rules->form_file_pic && $user_rules->form_file_pic_x) {
            $this->form->setFieldAttribute('file_pic', 'required', 'true');
        }
        if ($user_rules->form_file_system && $user_rules->form_file_system_x) {
            $this->form->setFieldAttribute('system', 'required', 'true');
        }
        if ($user_rules->form_images && $user_rules->form_images_x) {
            $this->form->setFieldAttribute('images', 'required', 'true');
        }
        if ($user_rules->form_language && $user_rules->form_language_x) {
            $this->form->setFieldAttribute('language', 'required', 'true');
        }
        if ($user_rules->form_mirror_1 && $user_rules->form_mirror_1_x) {
            $this->form->setFieldAttribute('mirror_1', 'required', 'true');
        }
        if ($user_rules->form_mirror_2 && $user_rules->form_mirror_2_x) {
            $this->form->setFieldAttribute('mirror_2', 'required', 'true');
        }
        if ($user_rules->form_password && $user_rules->form_password_x) {
            $this->form->setFieldAttribute('password', 'required', 'true');
        }
        if ($user_rules->form_price && $user_rules->form_price_x) {
            $this->form->setFieldAttribute('price', 'required', 'true');
        }
        if ($user_rules->form_short_desc && $user_rules->form_short_desc_x) {
            $this->form->setFieldAttribute('description', 'required', 'true');
        }
        if ($user_rules->form_long_desc && $user_rules->form_long_desc_x) {
            $this->form->setFieldAttribute('description_long', 'required', 'true');
        }
        if ($user_rules->form_extra_select_box_1 && $user_rules->form_extra_select_box_1_x) {
            $this->form->setFieldAttribute('custom_field_1', 'required', 'true');
        }
        if ($user_rules->form_extra_select_box_2 && $user_rules->form_extra_select_box_2_x) {
            $this->form->setFieldAttribute('custom_field_2', 'required', 'true');
        }
        if ($user_rules->form_extra_select_box_3 && $user_rules->form_extra_select_box_3_x) {
            $this->form->setFieldAttribute('custom_field_3', 'required', 'true');
        }
        if ($user_rules->form_extra_select_box_4 && $user_rules->form_extra_select_box_4_x) {
            $this->form->setFieldAttribute('custom_field_4', 'required', 'true');
        }
        if ($user_rules->form_extra_select_box_5 && $user_rules->form_extra_select_box_5_x) {
            $this->form->setFieldAttribute('custom_field_5', 'required', 'true');
        }
        if ($user_rules->form_extra_short_input_1 && $user_rules->form_extra_short_input_1_x) {
            $this->form->setFieldAttribute('custom_field_6', 'required', 'true');
        }
        if ($user_rules->form_extra_short_input_2 && $user_rules->form_extra_short_input_2_x) {
            $this->form->setFieldAttribute('custom_field_7', 'required', 'true');
        }
        if ($user_rules->form_extra_short_input_3 && $user_rules->form_extra_short_input_3_x) {
            $this->form->setFieldAttribute('custom_field_8', 'required', 'true');
        }
        if ($user_rules->form_extra_short_input_4 && $user_rules->form_extra_short_input_4_x) {
            $this->form->setFieldAttribute('custom_field_9', 'required', 'true');
        }
        if ($user_rules->form_extra_short_input_5 && $user_rules->form_extra_short_input_5_x) {
            $this->form->setFieldAttribute('custom_field_10', 'required', 'true');
        }
        if ($user_rules->form_extra_date_1 && $user_rules->form_extra_date_1_x) {
            $this->form->setFieldAttribute('custom_field_11', 'required', 'true');
        }
        if ($user_rules->form_extra_date_2 && $user_rules->form_extra_date_2_x) {
            $this->form->setFieldAttribute('custom_field_12', 'required', 'true');
        }
        if ($user_rules->form_extra_large_input_1 && $user_rules->form_extra_large_input_1_x) {
            $this->form->setFieldAttribute('custom_field_13', 'required', 'true');
        }
        if ($user_rules->form_extra_large_input_2 && $user_rules->form_extra_large_input_2_x) {
            $this->form->setFieldAttribute('custom_field_14', 'required', 'true');
        }
        // check the possibility to create new custom tags
        if (!$user_rules->uploads_allow_custom_tags) {
            $this->form->setFieldAttribute('tags', 'custom', 'deny');
            //$this->form->setFieldAttribute( 'tags', 'mode', 'nested' );
        }
        if (!$this->item->file_id) {
            // new Download
            // set default value for access in form when exist - use otherwise 1 for public access
            if ($user_rules->uploads_default_access_level) {
                $this->form->setValue('access', null, (int) $user_rules->uploads_default_access_level);
            }
            // Use this options only for 'creation' page (...why?)
            if ($user_rules->form_select_main_file && $user_rules->form_select_main_file_x) {
                $this->form->setFieldAttribute('file_upload', 'required', 'true');
            }
            if ($user_rules->form_select_preview_file && $user_rules->form_select_preview_file_x) {
                $this->form->setFieldAttribute('preview_file_upload', 'required', 'true');
            }
        }
        // user will edit a exist download so we must check the category rule
        if ($this->item->file_id && !$user_rules->uploads_can_change_category) {
            // change category field to readonly
            $this->form->setFieldAttribute('cat_id', 'readonly', 'true');
        }
        $this->return_page = $this->get('ReturnPage');
        if (!$this->return_page) {
            // seems we will create a new download about 'Add' button, so we will use the current url for return page
            $current_url = $_SERVER['HTTP_REFERER'];
            if ($current_url) {
                $this->return_page = base64_encode(urlencode($current_url));
            } else {
                $this->return_page = base64_encode(urlencode(JURI::current()));
            }
        }
        if (empty($this->item->file_id)) {
            $authorised = $user->authorise('core.create', 'com_jdownloads') || count($this->authorised_cats);
        } else {
            $authorised = $this->item->params->get('access-edit');
        }
        if ($authorised !== true) {
            if (empty($this->item->file_id)) {
                JError::raiseWarning(100, JText::_('COM_JDOWNLOADS_FRONTEND_CREATE_NO_PERMISSIONS'));
            } else {
                JError::raiseWarning(100, JText::_('COM_JDOWNLOADS_FRONTEND_EDIT_NO_PERMISSIONS'));
            }
            return false;
        } else {
            $this->view_upload_button = true;
        }
        if (isset($user_limits['upload']->sumfiles) && $user_limits['upload']->sumfiles > 0) {
            $upload_limits_reached = $user_limits['upload_remaining'] == 0;
        } else {
            $upload_limits_reached = false;
        }
        if ($upload_limits_reached == true) {
            $text = JDHelper::getOnlyLanguageSubstring($user_rules->upload_limit_daily_msg);
            if ($text != '') {
                JError::raiseNotice(100, $text);
            } else {
                JError::raiseNotice(100, JText::_('COM_JDOWNLOADS_DAILY_UPLOAD_LIMITS_REACHED_TEXT'));
            }
            return false;
        }
        $this->user_rules = $user_rules;
        $this->user_limits = $user_limits;
        $this->item->tags = new JHelperTags();
        if (!empty($this->item->file_id)) {
            $this->item->tags->getItemTags('com_jdownloads.download.', $this->item->file_id);
        }
        if (!empty($this->item) && isset($this->item->file_id)) {
            $tmp = new stdClass();
            $tmp->images = $this->item->images;
            $this->form->bind($tmp);
        }
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseWarning(500, implode("\n", $errors));
            return false;
        }
        // Create a shortcut to the parameters.
        $params =& $this->state->params;
        //Escape strings for HTML output
        $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
        $this->params = $params;
        $this->user = $user;
        // check whether it is in menu settings defined only a single category
        if ($params->get('enable_category') == 1) {
            $this->form->setFieldAttribute('cat_id', 'default', $params->get('catid', 1));
            $this->form->setFieldAttribute('cat_id', 'readonly', 'true');
        }
        $this->_prepareDocument();
        parent::display($tpl);
    }
Beispiel #9
0

<div class="edit jd-item-page<?php 
echo $this->pageclass_sfx;
?>
">

    <?php 
$is_admin = false;
if (JDHelper::checkGroup('8', true) || JDHelper::checkGroup('7', true)) {
    $is_admin = true;
}
// view offline message - but admins can view it always
if ($jlistConfig['offline'] && !$is_admin) {
    if ($jlistConfig['offline.text'] != '') {
        echo JDHelper::getOnlyLanguageSubstring($jlistConfig['offline.text']) . '</div>';
    }
} else {
    ?>

<form action="<?php 
    echo $form_uri;
    ?>
" name="adminForm" method="post" id="adminForm" class="form-validate" accept-charset="utf-8">

        <fieldset>
            <?php 
    echo JText::_('COM_JDOWNLOADS_REPORT_INFO');
    ?>
 
Beispiel #10
0
// ==========================================
// HEADER SECTION
// ==========================================
if ($header != '') {
    $menuItemids = JDHelper::getMenuItemids(0);
    // component title - not more used. So we must replace the placeholder from layout with spaces!
    $header = str_replace('{component_title}', '', $header);
    // replace google adsense placeholder with script when active (also for header tab)
    if ($jlistConfig['google.adsense.active'] && $jlistConfig['google.adsense.code'] != '') {
        $header = str_replace('{google_adsense}', stripslashes($jlistConfig['google.adsense.code']), $header);
    } else {
        $header = str_replace('{google_adsense}', '', $header);
    }
    // components description
    if ($jlistConfig['downloads.titletext'] != '') {
        $header_text = stripslashes(JDHelper::getOnlyLanguageSubstring($jlistConfig['downloads.titletext']));
        if ($jlistConfig['google.adsense.active'] && $jlistConfig['google.adsense.code'] != '') {
            $header_text = str_replace('{google_adsense}', stripslashes($jlistConfig['google.adsense.code']), $header_text);
        } else {
            $header_text = str_replace('{google_adsense}', '', $header_text);
        }
        $header .= $header_text;
    }
    // check $Itemid exist
    if (!isset($menuItemids['search'])) {
        $menuItemids['search'] = $menuItemids['root'];
    }
    if (!isset($menuItemids['upload'])) {
        $menuItemids['upload'] = $menuItemids['root'];
    }
    // build home link
 /**
  * Send after new download creation an e-mail to the selected addresses
  * 
  * @param mixed $files
  */
 public static function sendMailUpload($data)
 {
     global $jlistConfig;
     $user = JFactory::getUser();
     $config = JFactory::getConfig();
     $mailfrom = $config->get('mailfrom');
     $mailfromname = $config->get('fromname');
     // get IP
     $ip = self::getRealIp();
     // date and time
     $timestamp = time();
     $date_format = self::getDateFormat();
     $date_time = date($date_format['long'], $timestamp);
     $user_downloads = '<br />';
     // get user
     $user_name = $user->get('username');
     $user_email = $user->get('email');
     $jlistConfig['send.mailto.upload'] = str_replace(' ', '', $jlistConfig['send.mailto.upload']);
     $recipients = explode(';', $jlistConfig['send.mailto.upload']);
     // Check to see if there are any users in this group before we continue
     if (!count($recipients)) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_JDOWNLOADS_NO_EMAIL_RECIPIENT_FOUND'), 'error');
         return false;
     }
     // Get the Mailer
     $mailer = JFactory::getMailer();
     // Build email message format.
     $mailer->setSender(array($mailfrom, $mailfromname));
     $mailer->setSubject(JDHelper::getOnlyLanguageSubstring($jlistConfig['send.mailto.betreff.upload']));
     $html_format = true;
     $text = "";
     $text = stripslashes(JDHelper::getOnlyLanguageSubstring($jlistConfig['send.mailto.template.upload']));
     $text = str_replace('{file_title}', $data->file_title, $text);
     if ($data->url_download) {
         $text = str_replace('{file_name}', $data->url_download, $text);
     } elseif ($data->filename_from_other_download) {
         $text = str_replace('{file_name}', $data->filename_from_other_download, $text);
     }
     $text = str_replace('{description}', $data->description, $text);
     $text = str_replace('{ip}', $ip, $text);
     $text = str_replace('{name}', $user_name, $text);
     $text = str_replace('{date}', $date_time, $text);
     $text = str_replace('{mail}', $user_email, $text);
     if (!$jlistConfig['send.mailto.html.upload']) {
         $html_format = false;
         $text = strip_tags($text);
     }
     $mailer->setBody($text);
     // Needed for use HTML
     $mailer->IsHTML($html_format);
     $mailer->Encoding = 'base64';
     // Add recipients
     $mailer->addRecipient($recipients);
     // Send the Mail
     $result = $mailer->Send();
     if ($result !== true) {
         //JFactory::getApplication()->enqueueMessage(JText::_('COM_JDOWNLOADS_DB_ERROR'), 'error');
         return false;
     } else {
         return true;
     }
 }
Beispiel #12
0
 /**
  * Method to submit the downloads file to the browser.
  *
  *
  * @return    null
  */
 public function send()
 {
     global $jlistConfig;
     jimport('joomla.environment.uri');
     $jinput = JFactory::getApplication()->input;
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $db = JFactory::getDBO();
     $config = array('ignore_request' => true);
     $model = $this->getModel('send', 'jdownloadsModel', $config);
     $user_rules = JDHelper::getUserRules();
     clearstatcache();
     $active = $app->getMenu()->getActive();
     if ($active) {
         $current_link = $active->link;
     } else {
         $current_link = JRoute::_(JUri::current() . '?option=com_jdownloads');
     }
     // abort when downloads are offline
     if ($jlistConfig['offline']) {
         $msg = JDHelper::getOnlyLanguageSubstring($jlistConfig['offline.text']);
         $app->redirect(JRoute::_($current_link), $msg, 'notice');
     }
     $allow = false;
     $extern = false;
     $extern_site = false;
     $can_download = false;
     $aup_exist = false;
     $profile = '';
     // Which file types shall be viewed in browser
     $view_types = array();
     $view_types = explode(',', $jlistConfig['file.types.view']);
     // get request data
     $cat_id = $db->escape($jinput->get('catid', 0, 'int'));
     $file_id = $db->escape($jinput->get('id', 0, 'int'));
     $mirror = $db->escape($jinput->get('m', 0, 'int'));
     $files_list = $db->escape($jinput->get('list', '', 'string'));
     $zip_file = $db->escape($jinput->get('user', 0, 'cmd'));
     // get session data
     $stored_random_id = (int) JDHelper::getSessionDecoded('jd_random_id');
     $stored_file_id = (int) JDHelper::getSessionDecoded('jd_fileid');
     $stored_cat_id = (int) JDHelper::getSessionDecoded('jd_catid');
     $stored_files_list = JDHelper::getSessionDecoded('jd_list');
     // compare and check it
     if ($cat_id > 0 && $cat_id != $stored_cat_id || $file_id > 0 && $file_id != $stored_file_id || $zip_file > 0 && $zip_file != $stored_random_id || $files_list != '' && $files_list != $stored_files_list) {
         // perhaps use it a direct download option
         $this->items = $model->getItems($file_id);
         if ($this->items) {
             $this->state = $model->getState();
             $sum_selected_files = $this->state->get('sum_selected_files');
             $sum_selected_volume = $this->state->get('sum_selected_volume');
             $sum_files_prices = $this->state->get('sum_files_prices');
             $must_confirm_license = $this->state->get('must_confirm_license');
             $directlink = $this->state->get('directlink_used');
             $marked_files_id = $this->state->get('download.marked_files.id');
             // check the permission access for direct download option
             $within_the_user_limits = JDHelper::checkDirectDownloadLimits($cat_id, $file_id, $files_list, $user_rules, $sum_selected_files, $sum_selected_volume);
             if ($within_the_user_limits !== true) {
                 // user has his limits reached or not enough points
                 $msg = JText::_($within_the_user_limits);
                 $app->redirect(JRoute::_($current_link), $msg, 'notice');
             }
         } else {
             // invalid data found / url manipulations?
             $msg = JText::_('COM_JDOWNLOADS_INVALID_DOWNLOAD_DATA_MSG');
             $app->redirect(JRoute::_($current_link), $msg, 'notice');
         }
     }
     // check leeching
     if ($is_leeching = JDHelper::useAntiLeeching()) {
         // download stopped - view hint
         $msg = JText::_('COM_JDOWNLOADS_ANTILEECH_MSG') . ' ' . JText::_('COM_JDOWNLOADS_ANTILEECH_MSG2');
         $app->redirect(JRoute::_($current_link), $msg, 'notice');
     }
     if ($zip_file) {
         // user has selected more as a single file
         $zip_file = $jlistConfig['zipfile.prefix'] . $zip_file . '.zip';
         $filename = $jlistConfig['files.uploaddir'] . '/' . $jlistConfig['tempzipfiles.folder.name'] . '/' . $zip_file;
         if (!file_exists($filename)) {
             // download stopped - zip file not found
             $msg = JText::_('COM_JDOWNLOADS_FILE_NOT_FOUND') . ': ' . basename($zip_file);
             $app->redirect(JRoute::_($current_link), $msg, 'notice');
         }
     }
     //  download action check (not for uncategorized)
     if ($cat_id > 1) {
         // If the category has been passed in the data or URL check it.
         $allow = $user->authorise('download', 'com_jdownloads.category.' . $cat_id);
         if ($file_id && $allow) {
             // If the category has been passed in the data or URL check it.
             $allow = $user->authorise('download', 'com_jdownloads.download.' . $file_id);
         }
     } else {
         if ($file_id) {
             // If the category has been passed in the data or URL check it.
             $allow = $user->authorise('download', 'com_jdownloads.download.' . $file_id);
         }
     }
     if (!$allow) {
         // download stopped - user has not the right to download it
         $msg = JText::_('COM_JDOWNLOADS_DOWNLOAD_NOT_ALLOWED_MSG');
         $app->redirect(JRoute::_($current_link), $msg, 'notice');
     }
     $transfer_speed = (int) $user_rules->transfer_speed_limit_kb;
     if ($jlistConfig['use.alphauserpoints']) {
         // get AUP user info
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP) && !$user->guest) {
             require_once $api_AUP;
             $aup_exist = true;
             // get user profile data from AUP
             $profile = AlphaUserPointsHelper::getUserInfo('', $user->id);
             // get standard points value from AUP
             $db->setQuery("SELECT points FROM #__alpha_userpoints_rules WHERE published = 1 AND plugin_function = 'plgaup_jdownloads_user_download'");
             $aup_fix_points = floatval($db->loadResult());
             //$aup_fix_points = JDHelper::strToNumber($aup_fix_points);
         }
     }
     // build a array with IDs
     $files_arr = explode(',', $files_list);
     // get the files data for multi or single download
     $query = $db->getQuery(true);
     $query->select('a.*');
     $query->from('#__jdownloads_files AS a');
     // Join on category table.
     $query->select('c.title AS category_title, c.id AS category_id, c.cat_dir AS category_cat_dir, c.cat_dir_parent AS category_cat_dir_parent');
     $query->join('LEFT', '#__jdownloads_categories AS c on c.id = a.cat_id');
     // Join on license table.
     $query->select('l.title AS license_title');
     $query->join('LEFT', '#__jdownloads_licenses AS l on l.id = a.license');
     $query->where('(a.published = ' . $db->Quote('1') . ')');
     if ($files_list) {
         $query->where('a.file_id IN (' . $files_list . ')');
     } else {
         $query->where('a.file_id = ' . $db->Quote($file_id));
     }
     // Filter by access level so when we get not a result this user has not the access to view it
     $query->where('a.access IN (' . $groups . ')');
     $query->where('c.access IN (' . $groups . ')');
     $db->setQuery($query);
     $files = $db->loadObjectList();
     if (!$files) {
         // invalid data or user has not really the access
         $msg = JText::_('COM_JDOWNLOADS_DATA_NOT_FOUND');
         $app->redirect(JRoute::_($current_link), $msg, 'error');
     }
     // When we have a regged user, we must check whether he downloads the file in parts.
     // If so, we may only once write the download data in log and compute the AUP etc.
     $download_in_parts = JDHelper::getLastDownloadActivity($user->id, $files_list, $file_id, $user_rules->download_limit_after_this_time);
     if (count($files) > 1) {
         // mass download
         if (!$download_in_parts) {
             // add AUP points
             if ($jlistConfig['use.alphauserpoints'] && $aup_exist) {
                 if ($jlistConfig['use.alphauserpoints.with.price.field']) {
                     $db->setQuery("SELECT SUM(price) FROM #__jdownloads_files WHERE file_id IN ({$files_list})");
                     $sum_points = (int) $db->loadResult();
                     if ($profile->points >= $sum_points) {
                         foreach ($files as $aup_data) {
                             $db->setQuery("SELECT price FROM #__jdownloads_files WHERE file_id = '{$aup_data->file_id}'");
                             if ($price = floatval($db->loadResult())) {
                                 $can_download = JDHelper::setAUPPointsDownloads($user->id, $aup_data->file_title, $aup_data->file_id, $price, $profile);
                             }
                         }
                     }
                 } else {
                     // use fix points
                     $sum_points = $aup_fix_points * count($files_arr);
                     if ($profile->points >= $sum_points) {
                         foreach ($files as $aup_data) {
                             $can_download = JDHelper::setAUPPointsDownloads($user->id, $aup_data->file_title, $aup_data->file_id, 0, $profile);
                         }
                     } else {
                         $can_download = false;
                     }
                 }
             } else {
                 // no AUP active
                 $can_download = true;
             }
             if ($jlistConfig['user.can.download.file.when.zero.points'] && !$user->guest) {
                 $can_download = true;
             }
         } else {
             $can_download = true;
         }
     } else {
         // single download
         // we must be ensure that the user cannot skiped special options or settings
         // check at first the password option
         if ($files[0]->password_md5 != '') {
             // captcha is activated for this user
             $session_result = (int) JDHelper::getSessionDecoded('jd_password_run');
             if ($session_result < 2) {
                 // Abort !!!
                 $msg = JText::_('COM_JDOWNLOADS_ANTILEECH_MSG');
                 $app->redirect(JRoute::_($current_link), $msg, 'error');
             } else {
                 JDHelper::writeSessionEncoded('0', 'jd_password_run');
             }
         } else {
             // when is not use a password,  we must check captcha
             if ($user_rules->view_captcha) {
                 // captcha is activated for this user
                 $session_result = (int) JDHelper::getSessionDecoded('jd_captcha_run');
                 if ($session_result < 2) {
                     // Abort !!!
                     $msg = JText::_('COM_JDOWNLOADS_ANTILEECH_MSG');
                     $app->redirect(JRoute::_($current_link), $msg, 'error');
                 } else {
                     JDHelper::writeSessionEncoded('0', 'jd_captcha_run');
                 }
             }
         }
         if (!$mirror) {
             if ($files[0]->url_download) {
                 // build the complete category path
                 if ($files[0]->cat_id > 1) {
                     // Download has a category
                     if ($files[0]->category_cat_dir_parent != '') {
                         $cat_dir = $files[0]->category_cat_dir_parent . '/' . $files[0]->category_cat_dir;
                     } else {
                         $cat_dir = $files[0]->category_cat_dir;
                     }
                     $filename = $jlistConfig['files.uploaddir'] . '/' . $cat_dir . '/' . $files[0]->url_download;
                     $filename_direct = $jlistConfig['files.uploaddir'] . '/' . $cat_dir . '/' . $files[0]->url_download;
                 } else {
                     // Download is 'uncategorized'
                     $filename = $jlistConfig['files.uploaddir'] . '/' . $jlistConfig['uncategorised.files.folder.name'] . '/' . $files[0]->url_download;
                 }
             } elseif ($files[0]->other_file_id) {
                 // A file from another Download was assigned
                 $query = $db->getQuery(true);
                 $query->select('a.*');
                 $query->from('#__jdownloads_files AS a');
                 // Join on category table.
                 $query->select('c.id AS category_id, c.cat_dir AS category_cat_dir, c.cat_dir_parent AS category_cat_dir_parent');
                 $query->join('LEFT', '#__jdownloads_categories AS c on c.id = a.cat_id');
                 $query->where('a.published = ' . $db->Quote('1'));
                 $query->where('a.file_id = ' . $db->Quote($files[0]->other_file_id));
                 $query->where('a.access IN (' . $groups . ')');
                 $db->setQuery($query);
                 $other_file_data = $db->loadObject();
                 if ($other_file_data->cat_id > 1) {
                     // the assigned Download has a category
                     if ($other_file_data->category_cat_dir_parent != '') {
                         $cat_dir = $other_file_data->category_cat_dir_parent . '/' . $other_file_data->category_cat_dir;
                     } else {
                         $cat_dir = $other_file_data->category_cat_dir;
                     }
                     $filename = $jlistConfig['files.uploaddir'] . '/' . $cat_dir . '/' . $other_file_data->url_download;
                     $filename_direct = $jlistConfig['files.uploaddir'] . '/' . $cat_dir . '/' . $other_file_data->url_download;
                 } else {
                     // Download is 'uncategorized'
                     $filename = $jlistConfig['files.uploaddir'] . '/' . $jlistConfig['uncategorised.files.folder.name'] . '/' . $other_file_data->url_download;
                 }
             } else {
                 $filename = $files[0]->extern_file;
                 if ($files[0]->extern_site) {
                     $extern_site = true;
                 }
                 $extern = true;
             }
         } else {
             // is mirror
             if ($mirror == 1) {
                 $filename = $files[0]->mirror_1;
                 if ($files[0]->extern_site_mirror_1) {
                     $extern_site = true;
                 }
             } else {
                 $filename = $files[0]->mirror_2;
                 if ($files[0]->extern_site_mirror_2) {
                     $extern_site = true;
                 }
             }
             $extern = true;
         }
         $price = '';
         // Is AUP rule or price option used - we need the price for it
         if ($aup_exist) {
             if ($jlistConfig['use.alphauserpoints.with.price.field']) {
                 $price = floatval($files[0]->price);
             } else {
                 $price = $aup_fix_points;
             }
         }
         if (!$download_in_parts) {
             $can_download = JDHelper::setAUPPointsDownload($user->id, $files[0]->file_title, $files[0]->file_id, $price, $profile);
             if ($jlistConfig['user.can.download.file.when.zero.points'] && $user->id) {
                 $can_download = true;
             }
         } else {
             $can_download = true;
         }
     }
     // plugin support
     // load external plugins
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('jdownloads');
     $results = $dispatcher->trigger('onBeforeDownloadIsSendJD', array(&$files, &$can_download, $user_rules, $download_in_parts));
     if (!$can_download) {
         $msg = JText::_('COM_JDOWNLOADS_BACKEND_SET_AUP_FE_MESSAGE_NO_DOWNLOAD');
         $app->redirect(JRoute::_($current_link), $msg, 'notice');
     } else {
         // run download
         if (!$download_in_parts) {
             // send at first e-mail
             if ($jlistConfig['send.mailto.option'] == '1' && $files) {
                 JDHelper::sendMailDownload($files);
             }
             // give uploader AUP points when is set on
             if ($jlistConfig['use.alphauserpoints']) {
                 if ($jlistConfig['use.alphauserpoints.with.price.field']) {
                     JDHelper::setAUPPointsDownloaderToUploaderPrice($files);
                 } else {
                     JDHelper::setAUPPointsDownloaderToUploader($files);
                 }
             }
             // write data in log
             if ($jlistConfig['activate.download.log']) {
                 JDHelper::updateLog($type = 1, $files, '');
             }
             // update downloads hits
             if (count($files) > 1) {
                 $db->setQuery('UPDATE #__jdownloads_files SET downloads=downloads+1 WHERE file_id IN (' . $files_list . ')');
                 $db->execute();
             } else {
                 $db->setQuery("UPDATE #__jdownloads_files SET downloads=downloads+1 WHERE file_id = '" . $files[0]->file_id . "'");
                 $db->execute();
             }
         }
         // get filesize
         if (!$extern) {
             if (!file_exists($filename)) {
                 $msg = JText::_('COM_JDOWNLOADS_FILE_NOT_FOUND') . ': ' . basename($filename);
                 $app->redirect(JRoute::_($current_link), $msg, 'notice');
             } else {
                 $size = filesize($filename);
             }
         } else {
             $size = JDHelper::getUrlFilesize($filename);
         }
         // if url go to other website - open it in a new browser window
         if ($extern_site) {
             echo "<script>document.location.href='{$filename}';</script>\n";
             exit;
         }
         // if set the option for direct link to the file
         if (!$jlistConfig['use.php.script.for.download']) {
             $root = str_replace('\\', '/', $_SERVER["DOCUMENT_ROOT"]);
             $root = rtrim($root, "/");
             $host = $_SERVER["HTTP_HOST"] . '/';
             $filename_direct = str_replace($root, $host, $filename_direct);
             $filename_direct = str_replace('//', '/', $filename_direct);
             if (strpos('http://', $filename_direct) === false && strpos('https://', $filename_direct) === false && strpos('ftp://', $filename_direct) === false) {
                 $filename_direct = 'http://' . $filename_direct;
             }
             $app->redirect($filename_direct);
         } else {
             $only_filename = basename($filename);
             $extension = JDHelper::getFileExtension($only_filename);
             if ($extern) {
                 $mime_type = JDHelper::getMimeTypeRemote($filename);
             } else {
                 $mime_type = JDHelper::getMimeTyp($extension);
             }
             // Check for protocol and set the appropriate headers
             $use_ssl = false;
             $uri = JUri::getInstance(JUri::current());
             $protocol = $uri->getScheme();
             if ($protocol == 'https') {
                 $use_ssl = true;
             }
             $open_in_browser = false;
             if (in_array($extension, $view_types)) {
                 // view file in browser
                 $open_in_browser = true;
             }
             clearstatcache();
             if ($extern) {
                 ob_end_clean();
                 // needed for MS IE - otherwise content disposition is not used?
                 if (ini_get('zlib.output_compression')) {
                     ini_set('zlib.output_compression', 'Off');
                 }
                 header("Cache-Control: public, must-revalidate");
                 header('Cache-Control: pre-check=0, post-check=0, max-age=0');
                 // header("Pragma: no-cache");  // Problems with MS IE
                 header("Expires: 0");
                 header("Content-Description: File Transfer");
                 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
                 header("Content-Type: " . $mime_type);
                 header("Content-Length: " . (string) $size);
                 if (!$open_in_browser) {
                     header('Content-Disposition: attachment; filename="' . $only_filename . '"');
                 } else {
                     // view file in browser
                     header('Content-Disposition: inline; filename="' . $only_filename . '"');
                 }
                 header("Content-Transfer-Encoding: binary\n");
                 // redirect to category when it is set the time
                 if (intval($jlistConfig['redirect.after.download']) > 0) {
                     header("refresh:" . $jlistConfig['redirect.after.download'] . "; url=" . $current_link);
                 }
                 // set_time_limit doesn't work in safe mode
                 if (!ini_get('safe_mode')) {
                     @set_time_limit(0);
                 }
                 @readfile($filename);
                 flush();
                 exit;
             } else {
                 $download_class_file = JPATH_SITE . DS . 'components' . DS . 'com_jdownloads' . DS . 'helpers' . DS . 'downloader.php';
                 if (file_exists($download_class_file)) {
                     require_once $download_class_file;
                     $object = new downloader();
                     $object->set_byfile($filename);
                     // Type: Download from a file
                     $object->set_filename($only_filename);
                     // Set the file basename
                     $object->set_filesize($size);
                     // Set the file basename
                     $object->set_mime($mime_type);
                     // Set the mime type
                     $object->set_speed($transfer_speed);
                     // Set download speed
                     $object->set_refresh($current_link, (int) $jlistConfig['redirect.after.download']);
                     // // redirect to category when it is set the time in configuration
                     $object->use_resume = true;
                     // Set the value for using Resume Mode
                     $object->use_ssl = $use_ssl;
                     // Set support for SSL
                     $object->open_in_browser = $open_in_browser;
                     // Set whether the file shall be opened in browser window
                     $object->use_autoexit = true;
                     // Set the value for auto exit  ('false' worked not really with extern file?)
                     $object->download();
                     // Run the download
                     flush();
                     exit;
                 } else {
                     $msg = JText::_('COM_JDOWNLOADS_FILE_NOT_FOUND') . ': ' . $filename;
                     $app->redirect(JRoute::_($current_link), $msg, 'notice');
                 }
             }
         }
     }
 }
Beispiel #13
0
    <?php 
if ($params->get('show_page_heading')) {
    ?>
        <h1>
	        <?php 
    echo $this->escape($params->get('page_heading'));
    ?>
        </h1>
    <?php 
}
?>

    <?php 
if ($rules->uploads_form_text) {
    echo JDHelper::getOnlyLanguageSubstring($rules->uploads_form_text);
}
?>
 
    
    <form action="<?php 
echo JRoute::_('index.php?option=com_jdownloads&a_id=' . (int) $this->item->file_id);
?>
" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data" accept-charset="utf-8">
            
            <input type="hidden" name="MAX_FILE_SIZE" value="<?php 
echo $rules->uploads_maxfilesize_kb * 1024;
?>
" />
            
        <fieldset class=jd_fieldset_outer>