📄 index.php
字号:
<?php/** * $Id: index.php v 1.12 06 july 2004 Catwolf Exp $ * Module: WF-Downloads * Version: v2.0.5a * Release Date: 26 july 2004 * Author: WF-Sections * Licence: GNU */include 'admin_header.php';include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php';include_once "../class/wfd_lists.php";$mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid", "pid");function Download(){ global $xoopsDB, $_GET, $_POST, $myts, $mytree, $xoopsModuleConfig, $xoopsModule; $lid = 0; $cid = 0; $title = ''; $url = 'http://'; $homepage = 'http://'; $homepagetitle = ''; $version = ''; $size = 0; $platform = ''; $screenshot = ''; $price = 0; $description = ''; $mirror = 'http://'; $license = ''; $paypalemail = ''; $features = ''; $requirements = ''; $forumid = 0; $limitations = ''; $dhistory = ''; $status = 0; $is_updated = 0; $offline = 0; $published = 0; $expired = 0; $updated = 0; $versiontypes = ''; $publisher = ''; $ipaddress = ''; $notifypub = ''; if (isset($_POST['lid'])) { $lid = $_POST['lid']; } elseif (isset($_GET['lid'])) { $lid = $_GET['lid']; } else { $lid = 0; } $directory = $xoopsModuleConfig['screenshots']; $result = $xoopsDB -> query("SELECT COUNT(*) FROM " . $xoopsDB -> prefix('wfdownloads_cat') . ""); list($numrows) = $xoopsDB -> fetchRow($result); $down_array = ''; if ($numrows) { xoops_cp_header(); wfd_adminmenu(_AM_WFD_MDOWNLOADS); echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_WFD_FILE_ALLOWEDAMIME . "</legend>\n <div style='padding: 8px;'>\n"; $query = "select mime_ext from " . $xoopsDB -> prefix('wfdownloads_mimetypes') . " WHERE mime_admin = 1 ORDER by mime_ext"; $result = $xoopsDB -> query($query); $allowmimetypes = ''; while ($mime_arr = $xoopsDB -> fetchArray($result)) { echo $mime_arr['mime_ext'] . " | "; } echo "</div>\n </fieldset><br />\n "; if ($lid) { $sql = "SELECT * FROM " . $xoopsDB -> prefix('wfdownloads_downloads') . " WHERE lid=" . $lid . ""; $down_array = $xoopsDB -> fetchArray($xoopsDB -> query($sql)); $lid = $down_array['lid']; $cid = $down_array['cid']; $title = $myts -> htmlSpecialChars($down_array['title']); $url = $myts -> htmlSpecialChars($down_array['url']); $homepage = $myts -> htmlSpecialChars($down_array['homepage']); $homepagetitle = $myts -> htmlSpecialChars($down_array['homepagetitle']); $version = $down_array['version']; $size = intval($down_array['size']); $platform = $myts -> htmlSpecialChars($down_array['platform']); $publisher = $myts -> htmlSpecialChars($down_array['publisher']); $screenshot = $myts -> htmlSpecialChars($down_array['screenshot']); $price = $myts -> htmlSpecialChars($down_array['price']); $description = $myts -> htmlSpecialChars($down_array['description']); $mirror = $myts -> htmlSpecialChars($down_array['mirror']); $license = $myts -> htmlSpecialChars($down_array['license']); $features = $myts -> htmlSpecialChars($down_array['features']); $requirements = $myts -> htmlSpecialChars($down_array['requirements']); $limitations = $myts -> htmlSpecialChars($down_array['limitations']); $dhistory = $myts -> htmlSpecialChars($down_array['dhistory']); $published = $down_array['published']; $expired = $down_array['expired']; $updated = $down_array['updated']; $offline = $down_array['offline']; $forumid = $down_array['forumid']; $ipaddress = $down_array['ipaddress']; $notifypub = $down_array['notifypub']; $sform = new XoopsThemeForm(_AM_WFD_FILE_MODIFYFILE, "storyform", xoops_getenv('PHP_SELF')); } else { $sform = new XoopsThemeForm(_AM_WFD_FILE_CREATENEWFILE, "storyform", xoops_getenv('PHP_SELF')); } $sform -> setExtra('enctype="multipart/form-data"'); if ($lid) $sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_ID, $lid)); if ($ipaddress) $sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_IP, $ipaddress)); $member_handler = & xoops_gethandler('member'); $group_list = & $member_handler -> getGroupList(); $gperm_handler = & xoops_gethandler('groupperm'); $groups = $gperm_handler -> getGroupIds('WFDownFilePerm', $lid, $xoopsModule -> getVar('mid')); $groups = ($groups) ? $groups : true; $sform -> addElement(new XoopsFormSelectGroup(_AM_WFD_FCATEGORY_GROUPPROMPT, "groups", true, $groups, 5, true)); $titles_tray = new XoopsFormElementTray(_AM_WFD_FILE_TITLE, '<br />'); $titles = new XoopsFormText('', 'title', 50, 255, $title); $titles_tray -> addElement($titles); $titles_checkbox = new XoopsFormCheckBox('', "title_checkbox", 0); $titles_checkbox -> addOption(1, _AM_WFD_FILE_USE_UPLOAD_TITLE); $titles_tray -> addElement($titles_checkbox); $sform -> addElement($titles_tray); $mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid ", "pid"); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_DLURL, 'url', 50, 255, $url), true); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_MIRRORURL, 'mirror', 50, 255, $mirror), false); $sform -> addElement(new XoopsFormFile(_AM_WFD_FILE_DUPLOAD, 'userfile', 0)); $mytree = new XoopsTree($xoopsDB -> prefix('wfdownloads_cat'), "cid", "pid"); ob_start(); $sform -> addElement(new XoopsFormHidden('cid', $cid)); $mytree -> makeMySelBox('title', 'title', $cid, 0); $sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_CATEGORY, ob_get_contents())); ob_end_clean(); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_HOMEPAGETITLE, 'homepagetitle', 50, 255, $homepagetitle), false); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_HOMEPAGE, 'homepage', 50, 255, $homepage), false); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_VERSION, 'version', 10, 20, $version), false); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_PUBLISHER, 'publisher', 50, 255, $publisher), false); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_SIZE, 'size', 10, 20, $size), false); $platform_array = $xoopsModuleConfig['platform']; $platform_select = new XoopsFormSelect('', 'platform', $platform, '', '', 0); $platform_select -> addOptionArray($platform_array); $platform_tray = new XoopsFormElementTray(_AM_WFD_FILE_PLATFORM, ' '); $platform_tray -> addElement($platform_select); $sform -> addElement($platform_tray); $license_array = $xoopsModuleConfig['license']; $license_select = new XoopsFormSelect('', 'license', $license, '', '', 0); $license_select -> addOptionArray($license_array); $license_tray = new XoopsFormElementTray(_AM_WFD_FILE_LICENCE, ' '); $license_tray -> addElement($license_select); $sform -> addElement($license_tray); $limitations_array = $xoopsModuleConfig['limitations']; $limitations_select = new XoopsFormSelect('', 'limitations', $limitations, '', '', 0); $limitations_select -> addOptionArray($limitations_array); $limitations_tray = new XoopsFormElementTray(_AM_WFD_FILE_LIMITATIONS, ' '); $limitations_tray -> addElement($limitations_select); $sform -> addElement($limitations_tray); $sform -> addElement(new XoopsFormText(_AM_WFD_FILE_PRICE, 'price', 10, 20, $price), false); $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_FILE_DESCRIPTION, 'description', $description, 15, 60), true); $sform -> addElement(new XoopsFormTextArea(_AM_WFD_FILE_KEYFEATURES, 'features', $features, 7, 60), false); $sform -> addElement(new XoopsFormTextArea(_AM_WFD_FILE_REQUIREMENTS, 'requirements', $requirements, 7, 60), false); $sform -> addElement(new XoopsFormTextArea(_AM_WFD_FILE_HISTORY, 'dhistory', $dhistory, 7, 60), false); if ($lid && !empty($dhistory)) { $sform -> addElement(new XoopsFormTextArea(_AM_WFD_FILE_HISTORYD, 'dhistoryaddedd', "", 7, 60), false); } $graph_array = & WfsLists :: getListTypeAsArray(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['screenshots'], $type = "images"); $indeximage_select = new XoopsFormSelect('', 'screenshot', $screenshot); $indeximage_select -> addOptionArray($graph_array); $indeximage_select -> setExtra("onchange='showImgSelected(\"image\", \"screenshot\", \"" . $xoopsModuleConfig['screenshots'] . "\", \"\", \"" . XOOPS_URL . "\")'"); $indeximage_tray = new XoopsFormElementTray(_AM_WFD_FILE_SHOTIMAGE, ' '); $indeximage_tray -> addElement($indeximage_select); if (!empty($imgurl)) { $indeximage_tray -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $xoopsModuleConfig['screenshots'] . "/" . $screenshot . "' name='image' id='image' alt='' />")); } else { $indeximage_tray -> addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' />")); } $sform -> addElement($indeximage_tray); $sform -> insertBreak(sprintf(_AM_WFD_FILE_MUSTBEVALID, "<b>" . $directory . "</b>"), "even"); ob_start(); wfd_getforum($forumid); $sform -> addElement(new XoopsFormLabel(_AM_WFD_FILE_DISCUSSINFORUM, ob_get_contents())); ob_end_clean(); $publishtext = (!$lid && !$published) ? _AM_WFD_FILE_SETPUBLISHDATE : _AM_WFD_FILE_SETNEWPUBLISHDATE; if ($published > time()) { $publishtext = _AM_WFD_FILE_SETPUBDATESETS; } $ispublished = ($published > time()) ? 1 : 0 ; $publishdates = ($published > time()) ? _AM_WFD_FILE_PUBLISHDATESET . formatTimestamp($published, "Y-m-d H:s") : _AM_WFD_FILE_SETDATETIMEPUBLISH; $publishdate_checkbox = new XoopsFormCheckBox('', 'publishdateactivate', $ispublished); $publishdate_checkbox -> addOption(1, $publishdates . "<br /><br />"); if ($lid) { $sform -> addElement(new XoopsFormHidden('was_published', $published)); $sform -> addElement(new XoopsFormHidden('was_expired', $expired)); } $publishdate_tray = new XoopsFormElementTray(_AM_WFD_FILE_PUBLISHDATE, ''); $publishdate_tray -> addElement($publishdate_checkbox); $publishdate_tray -> addElement(new XoopsFormDateTime($publishtext, 'published', 15, $published)); $publishdate_tray -> addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEARPUBLISHDATE, 'clearpublish', 0, ' ' . _YES . '', ' ' . _NO . '')); $sform -> addElement($publishdate_tray); $isexpired = ($expired > time()) ? 1: 0 ; $expiredates = ($expired > time()) ? _AM_WFD_FILE_EXPIREDATESET . formatTimestamp($expired, 'Y-m-d H:s') : _AM_WFD_FILE_SETDATETIMEEXPIRE; $warning = ($published > $expired && $expired > time()) ? _AM_WFD_FILE_EXPIREWARNING : ''; $expiredate_checkbox = new XoopsFormCheckBox('', 'expiredateactivate', $isexpired); $expiredate_checkbox -> addOption(1, $expiredates . "<br /><br />"); $expiredate_tray = new XoopsFormElementTray(_AM_WFD_FILE_EXPIREDATE . $warning, ''); $expiredate_tray -> addElement($expiredate_checkbox); $expiredate_tray -> addElement(new XoopsFormDateTime(_AM_WFD_FILE_SETEXPIREDATE . "<br />", 'expired', 15, $expired)); $expiredate_tray -> addElement(new XoopsFormRadioYN(_AM_WFD_FILE_CLEAREXPIREDATE, 'clearexpire', 0, ' ' . _YES . '', ' ' . _NO . '')); $sform -> addElement($expiredate_tray); $filestatus_radio = new XoopsFormRadioYN(_AM_WFD_FILE_FILESSTATUS, 'offline', $offline, ' ' . _YES . '', ' ' . _NO . ''); $sform -> addElement($filestatus_radio); $up_dated = ($updated == 0) ? 0 : 1; $file_updated_radio = new XoopsFormRadioYN(_AM_WFD_FILE_SETASUPDATED, 'up_dated', $up_dated, ' ' . _YES . '', ' ' . _NO . ''); $sform -> addElement($file_updated_radio); $sform -> insertBreak(_AM_WFD_FILE_CREATENEWSSTORY, "bg3"); $submitNews_radio = new XoopsFormRadioYN(_AM_WFD_FILE_SUBMITNEWS, 'submitNews', 0, ' ' . _YES . '', ' ' . _NO . '');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -