📄 index.php
字号:
if (!$lid) { $date = time(); $publishdate = time(); } else { $publishdate = $_POST['was_published']; $expiredate = $_POST['was_expired']; } if ($approved == 1 && empty($publishdate)) { $publishdate = time(); } if (isset($_POST['publishdateactivate'])) { $publishdate = strtotime($_POST['published']['date']) + $_POST['published']['time']; } if ($_POST['clearpublish']) { $result = $xoopsDB -> query("SELECT date FROM " . $xoopsDB -> prefix('wfdownloads_downloads') . " WHERE lid=$lid"); list($date) = $xoopsDB -> fetchRow($result); $publishdate = $date; } if (isset($_POST['expiredateactivate'])) { $expiredate = strtotime($_POST['expired']['date']) + $_POST['expired']['time']; } if ($_POST['clearexpire']) { $expiredate = '0'; } /** * Update or insert download data into database */ if (!$lid) { $date = time(); $publishdate = time(); $ipaddress = $_SERVER['REMOTE_ADDR']; $query = "INSERT INTO " . $xoopsDB -> prefix("wfdownloads_downloads") . " (lid, cid, title, url, homepage, version, size, platform, screenshot, submitter, publisher, status, date, hits, rating, votes, comments, price, mirror, license, paypalemail, features, requirements, homepagetitle, forumid, limitations, dhistory, published, expired, updated, offline, description, ipaddress, notifypub)"; $query .= " VALUES ('', $cid, '$title', '$url', '$homepage', '$version', $size, '$platform', '$screenshot', '$submitter', '$publisher','$status', '$date', 0, 0, 0, 0, '$price', '$mirror', '$license', '$paypalemail', '$features', '$requirements', '$homepagetitle', '$forumid', '$limitations', '$dhistory', '$publishdate', 0, '$updated', '$offline', '$description', '$ipaddress', '0')"; $result = $xoopsDB -> queryF($query); $error = "Information not saved to database: <br /><br />"; $error .= $query; if (!$result) { trigger_error($error, E_USER_ERROR); } $newid = $xoopsDB -> getInsertId(); wfd_save_Permissions($groups, $newid, 'WFDownFilePerm'); } else { $xoopsDB -> query("UPDATE " . $xoopsDB -> prefix("wfdownloads_downloads") . " SET cid = $cid, title = '$title', url = '$url', mirror = '$mirror', paypalemail = '$paypalemail', license = '$license', features = '$features', homepage = '$homepage', version = '$version', size = $size, platform = '$platform', screenshot = '$screenshot', publisher = '$publisher', status = '$status', price = '$price', requirements = '$requirements', homepagetitle = '$homepagetitle', forumid = '$forumid', limitations = '$limitations', dhistory = '$dhistory', published = '$publishdate', expired = '$expiredate', updated = '$updated', offline = '$offline', description = '$description' WHERE lid = $lid"); wfd_save_Permissions($groups, $lid, 'WFDownFilePerm'); } /** * Send notifications */ if (!$lid) { $tags = array(); $tags['FILE_NAME'] = $title; $tags['FILE_URL'] = XOOPS_URL . '/modules/wfdownloads/singlefile.php?cid=' . $cid . '&lid=' . $newid; $sql = "SELECT title FROM " . $xoopsDB -> prefix("wfdownloads_cat") . " WHERE cid=" . $cid; $result = $xoopsDB -> query($sql); $row = $xoopsDB -> fetchArray($xoopsDB -> query($sql)); $tags['CATEGORY_NAME'] = $row['title']; $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/wfdownloads/viewcat.php?cid=' . $cid; $notification_handler = & xoops_gethandler('notification'); $notification_handler -> triggerEvent('global', 0, 'new_file', $tags); $notification_handler -> triggerEvent('category', $cid, 'new_file', $tags); } if ($lid && $approved && $notifypub) { $tags = array(); $tags['FILE_NAME'] = $title; $tags['FILE_URL'] = XOOPS_URL . '/modules/wfdownloads/singlefile.php?cid=' . $cid . '&lid=' . $lid; $sql = "SELECT title FROM " . $xoopsDB -> prefix('mydownloads_cat') . " WHERE cid=" . $cid; $result = $xoopsDB -> query($sql); $row = $xoopsDB -> fetchArray($result); $tags['CATEGORY_NAME'] = $row['title']; $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/wfdownloads/viewcat.php?cid=' . $cid; $notification_handler = & xoops_gethandler('notification'); $notification_handler -> triggerEvent('global', 0, 'new_file', $tags); $notification_handler -> triggerEvent('category', $cid, 'new_file', $tags); $notification_handler -> triggerEvent('file', $lid, 'approve', $tags); } $message = (!$lid) ? _AM_WFD_FILE_NEWFILEUPLOAD : _AM_WFD_FILE_FILEMODIFIEDUPDATE ; $message = ($lid && !$_POST['was_published'] && $approved) ? _AM_WFD_FILE_FILEAPPROVED : $message; if ($_POST['submitNews'] == 1) { $title = (!empty($_POST['newsTitle'])) ? $_POST['newsTitle'] : $title; include_once "newstory.php"; } redirect_header("index.php", 1, $message);} // Page start hereif (isset($_POST)){ foreach ($_POST as $k => $v) { $$k = $v; } } if (isset($_GET)){ foreach ($_GET as $k => $v) { $$k = $v; } } if (!isset($_POST['op'])){ $op = isset($_GET['op']) ? $_GET['op'] : 'main';} else{ $op = $_POST['op'];} switch ($op){ case "addDownload": addDownload(); break; case "Download": Download(); break; case "delDownload": global $xoopsDB, $_POST, $xoopsModule, $xoopsModuleConfig; $confirm = (isset($confirm)) ? 1 : 0; if ($confirm) { $file = XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['uploaddir'] . "/" . basename($_POST['url']); if (is_file($file)) { @unlink($file); } $xoopsDB -> query("DELETE FROM " . $xoopsDB -> prefix("wfdownloads_downloads") . " WHERE lid = " . $_POST['lid'] . ""); $xoopsDB -> query("DELETE FROM " . $xoopsDB -> prefix("mydownloads_votedata") . " WHERE lid = " . $_POST['lid'] . ""); // delete comments xoops_comment_delete($xoopsModule -> getVar('mid'), $_POST['lid']); redirect_header("index.php", 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $title)); exit(); } else { $lid = (isset($_POST['lid'])) ? $_POST['lid'] : $lid; $result = $xoopsDB -> query("SELECT lid, title, url FROM " . $xoopsDB -> prefix("wfdownloads_downloads") . " WHERE lid = $lid"); list($lid, $title, $url) = $xoopsDB -> fetchrow($result); xoops_cp_header(); xoops_confirm(array('op' => 'delDownload', 'lid' => $lid, 'confirm' => 1, 'title' => $title, 'url' => $url), 'index.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _DELETE); xoops_cp_footer(); } break; case "delVote": delVote(); break; case "del_review": global $xoopsDB, $_POST, $xoopsModule; $confirm = (isset($confirm)) ? 1 : 0; if ($confirm) { $xoopsDB -> query("DELETE FROM " . $xoopsDB -> prefix("wfdownloads_reviews") . " WHERE review_id = " . $_POST['review_id'] . ""); redirect_header("index.php", 1, sprintf(_AM_WFD_FILE_FILEWASDELETED, $title)); exit(); } else { $review_id = (isset($_POST['review_id'])) ? $_POST['review_id'] : $review_id; $sql = "SELECT review_id, title FROM " . $xoopsDB -> prefix("wfdownloads_reviews") . " WHERE review_id = $review_id"; $result = $xoopsDB -> query($sql); list($review_id, $title) = $xoopsDB -> fetchrow($result); xoops_cp_header(); xoops_confirm(array('op' => 'del_review', 'review_id' => $review_id, 'confirm' => 1, 'title' => $title), 'index.php', _AM_WFD_FILE_REALLYDELETEDTHIS . "<br /><br>" . $title, _AM_WFD_BDELETE); xoops_cp_footer(); } break; case "approve_review": global $xoopsDB; $review_id = isset($_GET['review_id']) ? intval($_GET['review_id']) : 0; $sql = "UPDATE " . $xoopsDB -> prefix("wfdownloads_reviews") . " SET submit = 1 WHERE review_id = '$review_id'"; $result = $xoopsDB -> queryF($sql); $error = "<a href='javascript:history.go(-1)'>" . _AM_WFD_BRETURN . "</a><br /><br />"; $error .= "Could not retrive review data: <br /><br />"; $error .= $sql; if (!$result) { trigger_error($error, E_USER_ERROR); } redirect_header("index.php?op=reviews", 1, _AM_WFD_REV_REVIEW_UPDATED); break; case "edit_review": $confirm = (isset($confirm)) ? 1 : 0; if ($confirm) { $review_id = intval($_POST['review_id']); $title = $myts -> addSlashes(trim($_POST['title'])); $review = $myts -> addSlashes(trim($_POST['review'])); $rated = intval($_POST['rated']); $submit = intval($_POST['approve']); $xoopsDB -> queryF("UPDATE " . $xoopsDB -> prefix("wfdownloads_reviews") . " SET title = '$title', review = '$review', rated = '$rated', submit = '$submit' WHERE review_id = '$review_id'"); redirect_header("index.php", 1, _AM_WFD_REV_REVIEW_UPDATED); exit(); } else { $sql = "SELECT * FROM " . $xoopsDB -> prefix('wfdownloads_reviews') . " WHERE review_id = " . $_GET['review_id'] . "" ; $arr = $xoopsDB -> fetchArray($xoopsDB -> query($sql)); xoops_cp_header(); wfd_adminmenu(_AM_WFD_AREVIEWS); $sform = new XoopsThemeForm(_AM_WFD_REV_SNEWMNAMEDESC, "reviewform", xoops_getenv('PHP_SELF')); $sform -> addElement(new XoopsFormText(_AM_WFD_REV_FTITLE, 'title', 30, 40, $arr['title']), true); $rating_select = new XoopsFormSelect(_AM_WFD_REV_FRATING, "rated", $arr['rated']); $rating_select -> addOptionArray(array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '10' => 10)); $sform -> addElement($rating_select); $sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_REV_FDESCRIPTION, 'review', $arr['review'], 15, 60), true); $approved = ($arr['submit'] == 0) ? 0 : 1; $approve_checkbox = new XoopsFormCheckBox(_AM_WFD_REV_FAPPROVE, "approve", 1); $approve_checkbox -> addOption(1, " "); $sform -> addElement($approve_checkbox); $sform -> addElement(new XoopsFormHidden("lid", $arr['lid'])); $sform -> addElement(new XoopsFormHidden("review_id", $arr['review_id'])); $sform -> addElement(new XoopsFormHidden("confirm", 1)); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'save');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -