Exemplo n.º 1
0
function dlformat(&$T, &$A, $isListing = false, $cid = ROOTID)
{
    global $_CONF, $_TABLES, $LANG01, $_DLM_CONF, $LANG_DLM, $mytree;
    $A['rating'] = number_format($A['rating'], 2);
    $A['title'] = DLM_htmlspecialchars($A['title']);
    $A['project'] = DLM_htmlspecialchars($A['project']);
    $A['url'] = DLM_htmlspecialchars($A['url']);
    $A['homepage'] = DLM_htmlspecialchars($A['homepage']);
    $A['version'] = DLM_htmlspecialchars($A['version']);
    $A['size'] = DLM_htmlspecialchars($A['size']);
    $A['md5'] = DLM_htmlspecialchars($A['md5']);
    $A['logourl'] = DLM_htmlspecialchars($A['logourl']);
    $A['postmode'] = DLM_htmlspecialchars($A['postmode']);
    $A['tags'] = DLM_htmlspecialchars($A['tags']);
    $A['datetime'] = strftime($_DLM_CONF['date_format'], $A['date']);
    if (version_compare(VERSION, '2.1.0') >= 0) {
        require_once $_CONF['path_system'] . 'classes/gltext.class.php';
        $A['description'] = GLText::getDisplayText($A['description'], $A['postmode'], 2);
        $A['detail'] = GLText::getDisplayText($A['detail'], $A['postmode'], 2);
    } else {
        require_once $_CONF['path'] . 'plugins/downloads/include/gltext.class.php';
        $gltext = new GLPText();
        $A['description'] = $gltext->getDisplayText($A['description'], $A['postmode']);
        $A['detail'] = $gltext->getDisplayText($A['detail'], $A['postmode']);
    }
    $filedetail_url = COM_buildURL($_CONF['site_url'] . '/downloads/index.php?id=' . $A['lid']);
    $visitfile_url = COM_buildURL($_CONF['site_url'] . '/downloads/visit.php?id=' . $A['lid']);
    if ($isListing && !empty($A['detail'])) {
        $A['description'] .= '<p class="download-break">' . COM_createLink($LANG_DLM['more'], $filedetail_url) . '</p>';
    }
    $result = DB_query("SELECT username, fullname, photo " . "FROM {$_TABLES['users']} " . "WHERE uid = {$A['owner_id']}");
    $B = DB_fetchArray($result);
    $submitter_name = COM_getDisplayName($A['owner_id'], $B['username'], $B['fullname']);
    if (empty($submitter_name)) {
        $submitter_name = $LANG_DLM['unknown_uid'];
    } else {
        $submitter_name = COM_createLink($submitter_name, $_CONF['site_url'] . '/users.php?mode=profile&amp;uid=' . $A['owner_id']);
    }
    $path = $mytree->getNicePathFromId($A['cid'], 'title', $_CONF['site_url'] . '/downloads/index.php');
    $temp = $mytree->getSepalator();
    $path = substr($path, 0, strlen($path) - strlen($temp));
    $path = str_replace($temp, ' <img src="' . $_CONF['site_url'] . '/downloads/images/arrow.gif" alt="arrow"' . XHTML . '> ', $path);
    $tags = '-';
    if (!empty($A['tags'])) {
        $tags = getTagList($A['tags']);
        if (empty($tags)) {
            $tags = '-';
        }
    }
    $notags = $tags == '-' ? 'dlm_notags' : '';
    $T->set_var('lang_category', $LANG_DLM['category']);
    $T->set_var('category_path', $path);
    $T->set_var('lang_tags', $LANG_DLM['tags']);
    $T->set_var('tags', $tags);
    $T->set_var('notags', $notags);
    $T->set_var('lang_submitter', $LANG_DLM['submitter']);
    $T->set_var('submitter_name', $submitter_name);
    $T->set_var('lid', $A['lid']);
    $T->set_var('cid', $A['cid']);
    $T->set_var('lang_dlnow', $LANG_DLM['dlnow']);
    $T->set_var('dtitle', $A['title']);
    $T->set_var('filedetail_url', $filedetail_url);
    $T->set_var('visitfile_url', $visitfile_url);
    $T->set_var('listing_cid', $cid);
    $T->set_var('lang_download_button', $LANG_DLM['download_button']);
    $startdate = time() - 60 * 60 * 24 * 7;
    if ($startdate < $A['date']) {
        $image_new = COM_createImage($_CONF['site_url'] . '/downloads/images/newred.gif', $LANG_DLM['newthisweek']);
        $newdownload = '<span class="badgenew">NEW</span>';
    }
    $T->set_var('image_newdownload', $image_new);
    // Image (New)
    $T->set_var('newdownload', $newdownload);
    // Badge (New)
    if ($A['hits'] >= $_DLM_CONF['download_popular']) {
        $image_pop = COM_createImage($_CONF['site_url'] . '/downloads/images/pop.gif', $LANG_DLM['popular']);
        $popdownload = '<span class="badgepop">POP</span>';
    }
    $T->set_var('image_popular', $image_pop);
    // Image (Pop)
    $T->set_var('popdownload', $popdownload);
    // Badge (Pop)
    // category image
    $cat_title = DLM_htmlspecialchars($A['cat_title']);
    if ($_DLM_CONF['download_useshots'] && !empty($A['imgurl'])) {
        $imgurl = $_DLM_CONF['snapcat_url'] . '/' . DLM_htmlspecialchars($A['imgurl']);
    } else {
        $imgurl = $_CONF['site_url'] . '/downloads/images/download.png';
    }
    $category_image = COM_createImage($imgurl, $cat_title, array('width' => $_DLM_CONF['download_shotwidth']));
    $T->set_var('category_image', $category_image);
    $T->set_var('download_title', $LANG_DLM['click2dl'] . ': ' . $A['url']);
    $T->set_var('url', $A['url']);
    $T->set_var('file_description', $A['description']);
    $T->set_var('file_detail', $A['detail']);
    $T->set_var('rating', $A['rating']);
    if ($A['rating'] != "0" || $A['rating'] != "0.00") {
        $votestring = sprintf($LANG_DLM['numvotes'], $A['votes']);
    }
    $T->set_var('votestring', $votestring);
    if (!empty($A['mg_autotag'])) {
        // use the mediagallery autotag as a snapshot.
        $mg_autotag = str_replace(array('[', ']'), '', $A['mg_autotag']);
        $mg_autotag = '[' . $mg_autotag . ' width:' . $_DLM_CONF['max_tnimage_width'] . ' height:' . $_DLM_CONF['max_tnimage_height'] . ' align:left]';
        $T->set_var('mg_autotag', PLG_replaceTags($mg_autotag, 'mediagallery'));
        $T->set_var('snapshot', '');
        $T->set_var('snaplinkicon', '');
    } elseif (!empty($A['logourl'])) {
        $safename = DLM_createSafeFileName($A['logourl']);
        $imgpath = $_DLM_CONF['path_tnstore'] . $safename;
        $imgpath = DLM_modTNPath($imgpath);
        $tnimgurl = $_DLM_CONF['tnstore_url'] . '/' . $safename;
        $tnimgurl = substr($tnimgurl, 0, -3) . substr($imgpath, -3);
        // align the extension
        $sizeattributes = DLM_getImgSizeAttr($imgpath);
        $T->set_var('snapshot_url', $_DLM_CONF['snapstore_url'] . '/' . $safename);
        $T->set_var('thumbnail_url', $tnimgurl);
        $T->set_var('snapshot_sizeattr', $sizeattributes);
        $T->set_var('lang_click2see', $LANG_DLM['click2see']);
        $T->set_var('show_snapshoticon', '');
        $T->set_var('show_snapshoticon_na', 'none');
        $T->set_var('mg_autotag', '');
        if ($_DLM_CONF['show_tn_image']) {
            $T->parse('snapshot', 'tsnapshot');
        } else {
            $T->parse('snaplinkicon', 'tsnaplinkicon');
        }
    } else {
        $tnimgurl = $_CONF['site_url'] . '/downloads/images/blank.png';
        $T->set_var('thumbnail_url', $tnimgurl);
        $T->set_var('snapshot_url', $_CONF['site_url'] . '/downloads/index.php');
        $T->set_var('snapshot_sizeattr', 'width="200" height="200" ');
        $T->set_var('show_snapshoticon', 'none');
        $T->set_var('show_snapshoticon_na', '');
        $T->parse('snapshot', 'tsnapshot');
        $T->set_var('snaplinkicon', '');
        $T->set_var('mg_autotag', '');
    }
    $T->set_var('lang_version', $LANG_DLM['ver']);
    $T->set_var('lang_rating', $LANG_DLM['ratingc']);
    $T->set_var('lang_submitdate', $LANG_DLM['submitdate']);
    $T->set_var('lang_size', $LANG_DLM['size']);
    $T->set_var('datetime', $A['datetime']);
    $T->set_var('version', $A['version']);
    // Check if restricted access has been enabled for download report to admin's only
    if ($A['hits'] > 0 && DLM_hasAccess_history()) {
        $T->set_var('begin_dlreport_link', '<a href="' . COM_buildURL($_CONF['site_url'] . '/downloads/history.php?lid=' . $A['lid']) . '">');
        $T->set_var('end_dlreport_link', '</a>');
    } else {
        $T->set_var('begin_dlreport_link', '');
        $T->set_var('end_dlreport_link', '');
    }
    $T->set_var('download_times', sprintf($LANG_DLM['dltimes'], $A['hits']));
    $T->set_var('download_count', $A['hits']);
    $T->set_var('lang_popularity', $LANG_DLM['popularity']);
    $T->set_var('lang_filesize', $LANG_DLM['filesize']);
    $T->set_var('file_size', DLM_PrettySize($A['size']));
    $T->set_var('homepage_url', $A['homepage']);
    $T->set_var('homepage_link', '-');
    if (!empty($A['homepage'])) {
        $T->set_var('homepage_link', COM_makeClickableLinks($A['homepage']));
    }
    $T->set_var('lang_homepage', $LANG_DLM['homepage']);
    $T->set_var('lang_download', $LANG_DLM['download']);
    $T->set_var('lang_filelink', $LANG_DLM['filelink']);
    $T->set_var('lang_permalink', $LANG_DLM['permalink']);
    $T->set_var('lang_ratethisfile', $LANG_DLM['ratethisfile']);
    $T->set_var('lang_edit', $LANG_DLM['edit']);
    $T->set_var('show_editlink', $_DLM_CONF['has_edit_rights'] ? '' : 'none');
    $T->set_var('lang_md5_checksum', $LANG_DLM['md5_checksum']);
    $T->set_var('md5_checksum', $A['md5']);
    if ($A['commentcode'] == 0) {
        $commentCount = DB_count($_TABLES['comments'], 'sid', addslashes($A['lid']));
        $recentPostMessage = $LANG_DLM['commentswanted'];
        if ($commentCount > 0) {
            $result4 = DB_query("SELECT cid, UNIX_TIMESTAMP(date) AS day, username " . "FROM {$_TABLES['comments']}, {$_TABLES['users']} " . "WHERE {$_TABLES['users']}.uid = {$_TABLES['comments']}.uid " . "AND sid = '" . addslashes($A['lid']) . "' " . "ORDER BY date DESC LIMIT 1");
            $C = DB_fetchArray($result4);
            $recentPostMessage = $LANG01[27] . ': ' . strftime($_CONF['daytime'], $C['day']) . ' ' . $LANG01[104] . ' ' . $C['username'];
            $comment_link = COM_createLink($commentCount . '&nbsp;' . $LANG01[3], $filedetail_url, array('title' => $recentPostMessage));
        } else {
            $A['title'] = str_replace('&#039;', "'", $A['title']);
            $A['title'] = str_replace('&amp;', '&', $A['title']);
            $url = $_CONF['site_url'] . '/comment.php?type=downloads&amp;sid=' . $A['lid'] . '&amp;title=' . rawurlencode($A['title']);
            $comment_link = COM_createLink($LANG_DLM['entercomment'], $url, array('title' => $recentPostMessage));
        }
        $T->set_var('comment_link', $comment_link);
        $T->set_var('show_comments', '');
    } else {
        $T->set_var('show_comments', 'none');
    }
}
Exemplo n.º 2
0
     $cal_templates->set_var('calendar_mode', '');
 }
 $result = DB_query($datesql);
 $nrows = DB_numRows($result);
 if ($nrows == 0) {
     $cal_templates->set_var('lang_month', '');
     $cal_templates->set_var('event_year', '');
     $cal_templates->set_var('event_details', '');
     $cal_templates->parse('output', 'events');
     $display .= $cal_templates->finish($cal_templates->get_var('output'));
     $display .= $LANG_CALJP_1[2];
 } else {
     $cal = new Calendar();
     setCalendarLanguage($cal);
     require_once $_CONF['path'] . 'plugins/calendarjp/include/gltext.class.php';
     $gltext = new GLPText();
     $currentmonth = '';
     for ($i = 0; $i < $nrows; $i++) {
         $A = DB_fetchArray($result);
         if (SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']) > 0) {
             $cal_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
             $ownername = COM_getDisplayName($A['owner_id']);
             $cal_templates->set_var('owner_name', $ownername);
             $cal_templates->set_var('owner_id', $A['owner_id']);
             if (strftime('%B', strtotime($A['datestart'])) != $currentmonth) {
                 $str_month = $cal->getMonthName(strftime('%m', strtotime($A['datestart'])));
                 $cal_templates->set_var('lang_month', $str_month);
                 $cal_templates->set_var('event_year', strftime('%Y', strtotime($A['datestart'])));
                 $currentmonth = strftime('%B', strtotime($A['datestart']));
             }
             $event_title = stripslashes($A['title']);
Exemplo n.º 3
0
 /**
  * Show the downloads editor
  */
 function showEditor($mode = 'edit')
 {
     global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SCRIPTS, $LANG01, $LANG12, $LANG24, $MESSAGE, $_DLM_CONF, $LANG_DLM, $LANG_ACCESS;
     $retval = '';
     $this->initCatTree();
     $p = COM_applyFilter($_GET['p']);
     if (!empty($p)) {
         $this->_page = $p;
     }
     $lc = COM_applyFilter($_GET['cid']);
     if (!empty($lc)) {
         $this->_listing_cid = $lc;
     }
     if (!empty($this->_editor_mode)) {
         $mode = $this->_editor_mode;
     } else {
         $this->_editor_mode = $mode;
     }
     if ($mode == 'edit' || $mode == 'clone') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_lid = COM_applyFilter($_GET['lid']);
             $this->_loadFromDatabase($this->_lid);
         }
     }
     if ($mode == 'create' || $mode == 'submit') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_initVars();
             $homepage = DB_getItem($_TABLES['users'], 'homepage', "uid = '" . addslashes($this->_owner_id) . "'");
             $this->_homepage = DLM_htmlspecialchars(stripslashes($homepage));
         }
     }
     if ($mode != 'create' && $mode != 'submit') {
         $this->_checkHasAccess();
     }
     if ($mode == 'editsubmission') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_lid = COM_applyFilter($_GET['id']);
             $this->_loadSubmission($this->_lid);
         }
     }
     $ja = $_CONF['language'] == 'japanese_utf-8';
     $T = new Template($_DLM_CONF['path_layout']);
     $T->set_file(array('t_mod_download' => 'mod_download.thtml', 't_mod_newfile' => 'mod_newfile.thtml', 't_mod_newfile2' => 'mod_newfile2.thtml', 't_mod_newfileshot' => 'mod_newfileshot.thtml', 't_mod_submit_delete' => 'mod_submit_delete.thtml', 't_mod_submit_cancel' => 'mod_submit_cancel.thtml', 't_mod_submit_preview' => 'mod_submit_preview.thtml', 't_mod_file_id' => 'mod_file_id.thtml', 't_mod_dl_file_name' => 'mod_dl_file_name.thtml', 't_mod_file_size' => 'mod_file_size.thtml', 't_mod_votes' => 'mod_votes.thtml', 't_mod_submitter' => 'mod_submitter.thtml', 't_mod_tempfile' => 'mod_tempfile.thtml', 't_mod_logourl' => 'mod_logourl.thtml', 't_mod_tempsnap' => 'mod_tempsnap.thtml', 't_mod_date' => 'mod_date' . ($ja ? '_ja' : '') . '.thtml', 't_mod_mg_autotag' => 'mod_mg_autotag.thtml'));
     if ($mode == 'submit') {
         $T->set_file(array('t_mod_newfile' => 'mod_newfilesubmit.thtml', 't_mod_newfileshot' => 'mod_newfileshotsubmit.thtml'));
     }
     DLM_setDefaultTemplateVars($T);
     $lang = array('main', 'fileid', 'filetitle', 'dlfilename', 'replfilename', 'homepage', 'ver', 'filesize', 'bytes', 'description', 'detail', 'category', 'shotimage', 'addshotimage', 'replshotimage', 'released', 'listing', 'yes', 'no', 'submit', 'delete', 'cancel', 'confirm_delete', 'submitter', 'release_date', 'postmode', 'comment_mode', 'project', 'toolbar', 'toolbar1', 'toolbar2', 'toolbar3', 'toolbar5', 'md5', 'mg_autotag', 'mg_autotag_info', 'upload', 'tags', 'preview');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_DLM[$v]);
     }
     $action = 'index.php';
     switch ($mode) {
         case 'edit':
             $op = 'saveDownload';
             break;
         case 'create':
             $T->set_var('lang_submit', $LANG_DLM['add']);
             $T->set_var('lang_replfilename', $LANG_DLM['addfilename']);
             $T->set_var('lang_replshotimage', $LANG_DLM['addshotimage']);
             $op = 'add';
             break;
         case 'clone':
             $T->set_var('lang_submit', $LANG_DLM['add']);
             $op = 'add';
             break;
         case 'editsubmission':
             $T->set_var('lang_submit', $LANG_DLM['approve']);
             $op = 'approve';
             break;
         case 'submit':
             $T->set_var('lang_submit', $LANG12[8]);
             $T->set_var('lang_replfilename', $LANG_DLM['addfilename']);
             $op = 'submit';
             $action = 'submit.php?type=downloads';
             break;
     }
     $categorylist = $this->_cat_tree->makeSelBox('title', 'corder', $this->_cid, 0, 'cid');
     if ($mode == 'edit' || $mode == 'clone' || $mode == 'editsubmission') {
         if (empty($this->_old_lid)) {
             $this->_old_lid = $this->_lid;
         }
         $this->_title = DLM_htmlspecialchars(stripslashes($this->_title));
         $this->_project = DLM_htmlspecialchars(stripslashes($this->_project));
         $pathstring = $this->_cat_tree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/downloads/index.php?op=");
         $this->_url = DLM_htmlspecialchars(stripslashes($this->_url));
         $this->_logourl = DLM_htmlspecialchars(stripslashes($this->_logourl));
         $this->_mg_autotag = DLM_htmlspecialchars(stripslashes($this->_mg_autotag));
         $this->_tags = DLM_htmlspecialchars(stripslashes($this->_tags));
         $this->_homepage = DLM_htmlspecialchars(stripslashes($this->_homepage));
         $this->_version = DLM_htmlspecialchars($this->_version);
         $this->_size = DLM_htmlspecialchars($this->_size);
         $this->_md5 = DLM_htmlspecialchars(stripslashes($this->_md5));
     }
     if ($mode == 'editsubmission') {
         $tempfileurl = $_CONF['site_url'] . '/admin/plugins/downloads/tmpfile.php?id=' . $this->_lid;
         $tempsnapurl = '';
         if (!empty($this->_logourl)) {
             $tempsnapurl = $_DLM_CONF['snapstore_url'] . '/tmp' . date('YmdHis', $this->_date) . DLM_createSafeFileName($this->_logourl);
         }
         $T->set_var('lang_tempfile', $LANG_DLM['tempfile']);
         $T->set_var('tempsnapurl', $tempsnapurl);
         $T->set_var('tempfileurl', $tempfileurl);
     }
     if ($mode == 'clone') {
         if ($this->_retry != true && !empty($this->_lid)) {
             $this->_lid = $this->_createID($this->_lid . '_');
             if (strlen($this->_lid) > 40) {
                 $this->_lid = $this->_createID();
             }
         }
     }
     if (version_compare(VERSION, '2.1.0') >= 0) {
         require_once $_CONF['path_system'] . 'classes/gltext.class.php';
         $description = GLText::getEditText($this->_description, $this->_postmode, 2);
         $detail = GLText::getEditText($this->_detail, $this->_postmode, 2);
         $file_description = GLText::getPreviewText($this->_description, $this->_postmode, 'story.edit', 2);
         $file_detail = GLText::getPreviewText($this->_detail, $this->_postmode, 'story.edit', 2);
     } else {
         require_once $_CONF['path'] . 'plugins/downloads/include/gltext.class.php';
         $gltext = new GLPText();
         $description = $gltext->getEditText($this->_description, $this->_postmode);
         $detail = $gltext->getEditText($this->_detail, $this->_postmode);
         $file_description = $gltext->getDisplayText($this->_description, $this->_postmode);
         $file_detail = $gltext->getDisplayText($this->_detail, $this->_postmode);
     }
     list($year, $month, $day, $hour, $minute, $second) = explode(',', date('Y,m,d,H,i,s', $this->_date));
     $enabled_adv_editor = $_CONF['advanced_editor'] && $_USER['advanced_editor'];
     $show_texteditor = '';
     $show_htmleditor = 'none';
     if ($enabled_adv_editor && $this->_postmode == 'adveditor') {
         $show_texteditor = 'none';
         $show_htmleditor = '';
     }
     $allowed_html = '';
     if (version_compare(VERSION, '2.1.0') >= 0) {
         $postmode_list = 'plaintext,html';
         if ($enabled_adv_editor) {
             $postmode_list .= ',adveditor';
         }
         if ($_CONF['wikitext_editor']) {
             $postmode_list .= ',wikitext';
         }
         $postmode_array = explode(',', $postmode_list);
         foreach ($postmode_array as $pm) {
             $allowed_html .= COM_allowedHTML('story.edit', false, 1, $pm);
         }
         $allowed_html .= COM_allowedAutotags(false, array('code', 'raw'));
     } else {
         $allowed_html = COM_allowedHTML();
         $allowed_html = str_replace('[page_break], ', '', $allowed_html);
         // No support [page_break]
     }
     $T->set_var('lang_allowed_html', $allowed_html);
     if (version_compare(VERSION, '2.1.0') >= 0) {
         // Loads jQuery UI datepicker and timepicker-addon
         $_SCRIPTS->setJavaScriptLibrary('jquery.ui.slider');
         $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
         $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
         $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
         $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
         $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
         $langCode = COM_getLangIso639Code();
         $toolTip = $MESSAGE[118];
         $imgUrl = $_CONF['site_url'] . '/images/calendar.png';
         $_SCRIPTS->setJavaScript("jQuery(function () {" . "  geeklog.hour_mode = 24;" . "  geeklog.datetimepicker.set('release', '{$langCode}', '{$toolTip}', '{$imgUrl}');" . "});", TRUE, TRUE);
     }
     if ($enabled_adv_editor) {
         // Add JavaScript
         if (version_compare(VERSION, '2.1.0') >= 0) {
             $_SCRIPTS->setJavaScriptFile('postmode_control', '/javascript/postmode_control.js');
             COM_setupAdvancedEditor('/downloads/adveditor.js', 'story.edit');
         } else {
             if (version_compare(VERSION, '2.0.0') < 0) {
                 $js = 'geeklogEditorBasePath = "' . $_CONF['site_url'] . '/fckeditor/";';
                 $_SCRIPTS->setJavaScript($js, true);
             }
             $_SCRIPTS->setJavaScriptFile('fckeditor', '/fckeditor/fckeditor.js');
             $_SCRIPTS->setJavaScriptFile('downloadeditor_fckeditor', '/downloads/downloadeditor_fckeditor.js');
         }
     }
     if (empty($this->_postmode)) {
         $this->_postmode = $_DLM_CONF['postmode'];
     }
     $post_options = COM_optionList($_TABLES['postmodes'], 'code,name', $this->_postmode);
     if ($enabled_adv_editor) {
         if ($this->_postmode == 'adveditor') {
             $post_options .= '<option value="adveditor" ' . UC_SELECTED . '>' . $LANG24[86] . '</option>';
         } else {
             $post_options .= '<option value="adveditor">' . $LANG24[86] . '</option>';
         }
     }
     if ($_CONF['wikitext_editor']) {
         if ($this->_postmode == 'wikitext') {
             $post_options .= '<option value="wikitext" ' . UC_SELECTED . '>' . $LANG24[88] . '</option>';
         } else {
             $post_options .= '<option value="wikitext">' . $LANG24[88] . '</option>';
         }
     }
     $hidden_values = $this->_makeForm_hidden('owner_id', $this->_owner_id);
     $hidden_values .= $this->_makeForm_hidden('editor_mode', $this->_editor_mode);
     $hidden_values .= $this->_makeForm_hidden('page', $this->_page);
     if (!empty($this->_listing_cid) && $this->_listing_cid != ROOTID) {
         $hidden_values .= $this->_makeForm_hidden('listing_cid', $this->_listing_cid);
     }
     $T->set_var('show_texteditor', $show_texteditor);
     $T->set_var('show_htmleditor', $show_htmleditor);
     $T->set_var('post_options', $post_options);
     $T->set_var('action', $action);
     $T->set_var('op', $op);
     $T->set_var('lid', $this->_lid);
     $T->set_var('old_lid', $this->_old_lid);
     $T->set_var('pathstring', $pathstring);
     $T->set_var('title', $this->_title);
     $T->set_var('url', $this->_url);
     $T->set_var('homepage', $this->_homepage);
     $T->set_var('version', $this->_version);
     $T->set_var('size', $this->_size);
     $T->set_var('md5', $this->_md5);
     $T->set_var('logourl', $this->_logourl);
     $T->set_var('mg_autotag', $this->_mg_autotag);
     $T->set_var('tags', $this->_tags);
     $T->set_var('description', $description);
     $T->set_var('detail', $detail);
     $T->set_var('project', $this->_project);
     $T->set_var('snapstore_url', $_DLM_CONF['snapstore_url']);
     $T->set_var('categorylist', $categorylist);
     $T->set_var('val_is_released_1', $this->_is_released ? UC_SELECTED : '');
     $T->set_var('val_is_released_0', !$this->_is_released ? UC_SELECTED : '');
     $T->set_var('val_is_listing_1', $this->_is_listing ? UC_SELECTED : '');
     $T->set_var('val_is_listing_0', !$this->_is_listing ? UC_SELECTED : '');
     $T->set_var('shot_autotag', $this->_makeForm_shot_mg_autotag());
     $T->set_var('shot', $this->_makeForm_shot());
     $T->set_var('year_options', COM_getYearFormOptions($year));
     $T->set_var('month_options', DLM_getMonthFormOptions($month));
     $T->set_var('day_options', COM_getDayFormOptions($day));
     $T->set_var('hour_options', COM_getHourFormOptions($hour, 24));
     $T->set_var('minute_options', COM_getMinuteFormOptions($minute, 1));
     $T->set_var('second_options', COM_getMinuteFormOptions($second, 1));
     $T->set_var('old_date', $this->_date);
     $T->set_var('comment_options', COM_optionList($_TABLES['commentcodes'], 'code,name', $this->_commentcode));
     $T->set_var('gltoken_name', CSRF_TOKEN);
     $T->set_var('gltoken', SEC_createToken());
     $T->set_var('submitter', $this->_owner_id);
     $T->set_var('displayName', COM_getDisplayName($this->_owner_id));
     if ($mode == 'submit') {
         $T->set_var('lang_commentoption', $LANG_DLM['commentoption']);
         $T->set_var('val_commentoption_1', UC_SELECTED);
         $T->set_var('val_commentoption_0', '');
     }
     $T->parse('mod_submitter', 't_mod_submitter');
     if ($mode == 'editsubmission' || $mode == 'submit') {
         $T->set_var('mod_mg_autotag', '');
         $hidden_values .= $this->_makeForm_hidden('mg_autotag', $this->_mg_autotag);
     } else {
         if ($_DLM_CONF['enabled_mg_autotag'] == 1) {
             $T->parse('mod_mg_autotag', 't_mod_mg_autotag');
         } else {
             $T->set_var('mod_mg_autotag', '');
             $hidden_values .= $this->_makeForm_hidden('mg_autotag', $this->_mg_autotag);
         }
     }
     $T->set_var('hidden_values', $hidden_values);
     if ($mode == 'edit' || $mode == 'clone') {
         $T->parse('mod_newfile', 't_mod_newfile');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
         if ($mode == 'edit') {
             $T->parse('mod_submit_delete', 't_mod_submit_delete');
         }
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
         $T->parse('mod_file_size', 't_mod_file_size');
     }
     if ($mode == 'editsubmission') {
         $T->parse('mod_dl_file_name', 't_mod_dl_file_name');
         $T->parse('mod_tempfile', 't_mod_tempfile');
         $T->parse('mod_file_size', 't_mod_file_size');
         $T->set_var('mod_tempsnap', '');
         if ($tempsnapurl != '') {
             $T->parse('mod_tempsnap', 't_mod_tempsnap');
         }
         $T->parse('mod_logourl', 't_mod_logourl');
         $T->parse('mod_submit_delete', 't_mod_submit_delete');
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
     }
     if ($mode == 'create') {
         $T->parse('mod_newfile', 't_mod_newfile2');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
         $T->parse('mod_submit_cancel', 't_mod_submit_cancel');
     }
     if ($mode == 'submit') {
         $T->parse('mod_newfile', 't_mod_newfile');
         $T->parse('mod_newfileshot', 't_mod_newfileshot');
     }
     if ($_DLM_CONF['enabled_preview_on_upload'] === false && ($mode == 'create' || $mode == 'submit')) {
         $T->set_var('mod_submit_preview', '');
     } else {
         $T->parse('mod_submit_preview', 't_mod_submit_preview');
     }
     $T->parse('mod_file_id', 't_mod_file_id');
     $T->parse('mod_date', 't_mod_date');
     $T->parse('output', 't_mod_download');
     $blocktitle = $LANG_DLM['moddl'];
     if ($mode == 'editsubmission') {
         $blocktitle = $LANG_DLM['dlswaiting'];
     }
     if ($mode == 'create') {
         $blocktitle = $LANG_DLM['addnewfile'];
     }
     if ($mode == 'clone') {
         $blocktitle = $LANG_DLM['addnewfile'];
     }
     if ($mode == 'submit') {
         $blocktitle = $LANG_DLM['uploadtitle'];
     }
     $retval .= $this->_showMessage();
     $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
     $retval .= $T->finish($T->get_var('output'));
     $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     if (!empty($file_description) || !empty($file_detail)) {
         // Display Preview Block
         $T2 = new Template($_DLM_CONF['path_layout']);
         $T2->set_file('t_mod_preview', 'mod_preview.thtml');
         $T2->set_var('file_description', $file_description);
         $T2->set_var('file_detail', $file_detail);
         $T2->parse('output', 't_mod_preview');
         $blocktitle = $LANG_DLM['preview'];
         $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
         $retval .= $T2->finish($T2->get_var('output'));
         $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     }
     if ($mode == 'edit') {
         // Display File Voting Information
         $retval .= $this->_showVotes_reguser($this->_lid);
         $retval .= $this->_showVotes_anon($this->_lid);
     }
     if ($mode != 'submit' || $this->_retry == true) {
         $retval = DLM_createHTMLDocument($retval, array('pagetitle' => $blocktitle));
     }
     return $retval;
 }