Ejemplo n.º 1
0
    case $_LANG_UPDATE['submit']:
        $display .= '<h1>' . $title . '</h1>' . LB;
        $display .= DLM_update_001();
        $display = DLM_createHTMLDocument($display, array('menu' => $title));
        break;
    case $_LANG_UPDATE['cancel']:
        $display = COM_refresh($_CONF['site_url'] . '/index.php');
        break;
    default:
        $display .= '<h1>' . $title . '</h1>' . LB;
        $list = '';
        $desc = DLM_check_001();
        if (!empty($desc)) {
            $list .= '<li>' . $desc . '</li>' . LB;
        }
        if (empty($list)) {
            $display .= '<p>' . $_LANG_UPDATE['description1'] . '</p>' . LB;
        } else {
            $display .= '<ul>' . LB . $list . '</ul>' . LB;
            $display .= '<p>' . $_LANG_UPDATE['description2'] . '</p>' . LB;
        }
        $display .= '<form action="' . $action . '" method="post"><div>' . LB;
        if (!empty($list)) {
            $display .= '<input type="submit" name="mode" value="' . $_LANG_UPDATE['submit'] . '" class="button"' . XHTML . '>' . LB;
        }
        $display .= '<input type="submit" name="mode" value="' . $_LANG_UPDATE['cancel'] . '" class="button"' . XHTML . '>' . LB;
        $display .= '</div></form>' . LB;
        $display = DLM_createHTMLDocument($display, array('menu' => $title));
        break;
}
COM_output($display);
Ejemplo n.º 2
0
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
require_once '../../../lib-common.php';
require_once '../../auth.inc.php';
require_once $_CONF['path'] . 'plugins/downloads/include/functions.php';
if (!SEC_hasRights('downloads.edit')) {
    $display = COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
    $display = DLM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
    COM_accessLog("User {$_USER['username']} tried to illegally access the downloads temporary file.");
    COM_output($display);
    exit;
}
COM_setArgNames(array('id'));
$lid = addslashes(COM_applyFilter(COM_getArgument('id')));
$result = DB_query("SELECT url, date FROM {$_TABLES['downloadsubmission']} WHERE lid='{$lid}'");
list($url, $date) = DB_fetchArray($result);
$filepath = $_DLM_CONF['path_filestore'] . 'tmp' . date('YmdHis', $date) . DLM_createSafeFileName($url);
if (file_exists($filepath)) {
    header('Content-Disposition: attachment; filename="' . $url . '"');
    header('Content-Type: application/octet-stream');
    header('Content-Description: File Transfer');
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
Ejemplo n.º 3
0
 /**
  * Show the category editor
  */
 function showEditor($cid, $mode = 'edit')
 {
     global $_CONF, $_TABLES, $_USER, $LANG_ACCESS, $_DLM_CONF, $LANG_DLM, $mytree;
     $retval = '';
     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->_loadFromDatabase($cid);
         }
     }
     if ($mode == 'clone') {
         $this->_cid = $this->_createID($this->_cid . '_');
         $this->_old_cid = $this->_cid;
     }
     if ($mode == 'create') {
         if ($this->_retry == true) {
             $this->_loadFromArgs($_POST);
         } else {
             $this->_initVars();
         }
     }
     $this->_checkHasAccess();
     $blocktitle = $mode == 'edit' ? $LANG_DLM['modcat'] : $LANG_DLM['addcat'];
     $retval .= $this->_showMessage();
     $retval .= COM_startBlock($blocktitle, '', COM_getBlockTemplate('_admin_block', 'header'));
     $T = new Template($_DLM_CONF['path_layout']);
     $T->set_file(array('t_modcategory' => 'admin_modcategory.thtml', 't_admin_access' => 'admin_access.thtml', 't_admin_submit_delete' => 'admin_submit_delete.thtml'));
     DLM_setDefaultTemplateVars($T);
     $lang = array('title', 'imgurlmain', 'parent', 'save', 'delete', 'cancel', 'confirm_delete', 'topic', 'catid', 'is_enabled', 'corder', 'upload');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_DLM[$v]);
     }
     $T->set_var('preview', $this->_makeForm_category_image());
     $T->set_var('imgurl', $this->_imgurl);
     $T->set_var('imgurlold', $this->_imgurl);
     $T->set_var('cid', $this->_cid);
     $T->set_var('old_cid', $this->_old_cid);
     $T->set_var('corder', $this->_corder);
     $T->set_var('title', $this->_title);
     $T->set_var('op', $mode == 'edit' ? 'saveCategory' : 'addCategory');
     $T->set_var('delete_disabled', $mode == 'edit' ? '' : UC_DISABLED);
     $T->set_var('val_is_enabled', $this->_is_enabled == 1 ? UC_CHECKED : '');
     $T->set_var('selparents', $mytree->makeSelBox('title', 'corder', $this->_pid, 1, 'pid', '', $this->_cid));
     // user access info
     $lang = array('accessrights', 'owner', 'group', 'permissions', 'permissionskey', 'permmsg');
     foreach ($lang as $v) {
         $T->set_var('lang_' . $v, $LANG_ACCESS[$v]);
     }
     $this->_owner_id = (int) $this->_owner_id;
     $T->set_var('owner_username', DB_getItem($_TABLES['users'], 'username', "uid = {$this->_owner_id}"));
     $ownername = COM_getDisplayName($this->_owner_id);
     $T->set_var('owner_name', $ownername);
     $T->set_var('owner', $ownername);
     $T->set_var('ownerid', $this->_owner_id);
     $T->set_var('group_dropdown', SEC_getGroupDropdown($this->_group_id, 3));
     $T->set_var('permissions_editor', SEC_getPermissionsHTML($this->_perm_owner, $this->_perm_group, $this->_perm_members, $this->_perm_anon));
     $hidden_values = $this->_makeForm_hidden('editor_mode', $this->_editor_mode);
     $T->set_var('hidden_values', $hidden_values);
     $T->parse('admin_access', 't_admin_access');
     if ($mode == 'edit') {
         $T->parse('admin_submit_delete', 't_admin_submit_delete');
     }
     $T->set_var('gltoken_name', CSRF_TOKEN);
     $T->set_var('gltoken', SEC_createToken());
     $T->parse('output', 't_modcategory');
     $retval .= $T->finish($T->get_var('output'));
     $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     $retval = DLM_createHTMLDocument($retval, array('pagetitle' => $blocktitle));
     return $retval;
 }
Ejemplo n.º 4
0
    case "saveCategory":
        if ($mode == $LANG_DLM['save'] && SEC_checkToken()) {
            $display = $dlcat->saveCategory();
        }
        if ($mode == $LANG_DLM['delete'] && SEC_checkToken()) {
            $display = $dlcat->deleteCategory($cid);
        }
        break;
    case "listCategories":
        $DLM_CSRF_TOKEN = SEC_createToken();
        $display .= showMessage();
        $display .= listCategories();
        $display = DLM_createHTMLDocument($display, array('pagetitle' => $LANG_DLM['manager']));
        break;
    case "move":
        DLM_moveCategory();
        $DLM_CSRF_TOKEN = SEC_createToken();
        $display .= showMessage();
        $display .= listCategories();
        $display = DLM_createHTMLDocument($display, array('pagetitle' => $LANG_DLM['manager']));
        break;
    case "listDownloads":
    default:
        $DLM_CSRF_TOKEN = SEC_createToken();
        $display .= DLM_updatePlugin();
        $display .= showMessage();
        $display .= listDownloads();
        $display = DLM_createHTMLDocument($display, array('pagetitle' => $LANG_DLM['manager']));
        break;
}
COM_output($display);
Ejemplo n.º 5
0
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
require_once '../lib-common.php';
if (!in_array('downloads', $_PLUGINS)) {
    echo COM_refresh($_CONF['site_url'] . '/index.php');
    exit;
}
require_once $_CONF['path'] . 'plugins/downloads/include/functions.php';
if (COM_isAnonUser() && ($_CONF['loginrequired'] == 1 || $_DLM_CONF['loginrequired'] == 1)) {
    $display = SEC_loginRequiredForm();
    $display = DLM_createHTMLDocument($display);
    COM_output($display);
    exit;
}
$uid = isset($_USER['uid']) ? $_USER['uid'] : 1;
COM_setArgNames(array('id'));
$lid = addslashes(COM_applyFilter(COM_getArgument('id')));
$sql = "SELECT COUNT(*) FROM {$_TABLES['downloads']} a " . "LEFT JOIN {$_TABLES['downloadcategories']} b ON a.cid=b.cid " . "WHERE a.lid='{$lid}' " . COM_getPermSQL('AND', 0, 2, 'b');
list($count) = DB_fetchArray(DB_query($sql));
if ($count == 0 || DB_count($_TABLES['downloads'], "lid", $lid) == 0) {
    COM_errorLog("Downloads: invalid attempt to download a file. " . "User:{$_USER['username']}, IP:{$_SERVER['REMOTE_ADDR']}, File ID:{$lid}");
    echo COM_refresh($_CONF['site_url'] . '/downloads/index.php');
    exit;
}
$result = DB_query("SELECT url, secret_id, owner_id FROM {$_TABLES['downloads']} WHERE lid='{$lid}'");
list($url, $secret_id, $owner_id) = DB_fetchArray($result);
Ejemplo n.º 6
0
        break;
}
$offset = ($page - 1) * $show;
$sql = "SELECT d.lid, d.cid, d.title, url, homepage, version, size, md5, d.owner_id, logourl, mg_autotag, tags, " . "date, hits, rating, votes, commentcode, project, description, detail, postmode, " . "c.group_id, c.title AS cat_title, c.imgurl " . "FROM {$_TABLES['downloads']} d " . "LEFT JOIN {$_TABLES['downloadcategories']} c ON d.cid=c.cid " . "WHERE is_released=1 " . ($carr_count > 0 ? "AND d.cid IN " . $sql_cid_list : " ") . "AND is_listing=1 " . "AND date<={$now} " . "ORDER BY {$ordersql} LIMIT {$offset}, {$show}";
$result = DB_query($sql);
if (DB_numRows($result) > 0) {
    $cssid = 1;
    while ($A = DB_fetchArray($result)) {
        dlformat($T, $A, true, $cid);
        $T->set_var('cssid', $cssid);
        if ($_DLM_CONF['show_tn_only_exists']) {
            if (empty($A['logourl'])) {
                $T->parse('filelisting_records', 'records_notn', true);
            } else {
                $T->parse('filelisting_records', 'records', true);
            }
        } else {
            $T->parse('filelisting_records', 'records', true);
        }
        $cssid = $cssid == 2 ? 1 : 2;
    }
    // Print Google-like paging navigation
    $base_url = $_CONF['site_url'] . '/downloads/index.php?cid=' . $cid . '&amp;nppage=' . $nppage;
    $page_str = 'orderby=' . $orderby . '&amp;page=';
    $T->set_var('page_navigation', COM_printPageNavigation($base_url, $page, $numpages, $page_str));
} else {
    $T->set_var('filelisting_records', '<div class="pluginAlert dlm_alert">' . $LANG_DLM['nofiles'] . '</div>');
}
$display .= PLG_replaceTags($T->finish($T->parse('output', 'page')));
$display = DLM_createHTMLDocument($display, array('pagetitle' => $pagetitle));
COM_output($display);
Ejemplo n.º 7
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;
 }