// // ------------------------------------------------------------------------- // // Original Author: James Knickelbein // Author Website : http://www.journeymilwaukee.com // License Type : GPL: See /manual/LICENSES/GPL.txt // ------------------------------------------------------------------------- // include_once("header.php"); include_once(XOOPS_ROOT_PATH."/class/upload.class.php"); include_once(XOOPS_ROOT_PATH."/class/module.errorhandler.php"); include_once(XOOPS_ROOT_PATH."/class/xoopsform/formdhtmltextarea.php"); $eh = new ErrorHandler(); $mytree = new XoopsTree($db->prefix("mydownloads_cat"), "cid", "pid"); if ( !empty($_POST['submit']) ) { if (!$xoopsUser) { redirect_header(XOOPS_URL."/user.php", 2, _MUSTREGISTERFIRST); exit(); } else { $modifysubmitter = $xoopsUser->uid(); } $lid = intval($_POST["lid"]); $cid = intval($_POST["cid"]); $homepage = formatURL($myts->makeTboxData4Save($_POST["homepage"])); $url = $myts->makeTboxData4Save($_POST["url"]); $title = $myts->makeTboxData4Save($_POST["title"]); $version = $myts->makeTboxData4Save($_POST["version"]); $platform = $myts->makeTboxData4Save($_POST["platform"]); $description = $myts->makeTboxData4Save($_POST["filedesc"]); $size = $_POST["size"]; // Check if Title exist if ( empty($title) ) { $eh->show("1001"); } // Check if Description exist if ( empty($description) ) { $eh->show("1008"); } if ( empty($size) || !is_numeric($size) ) { $size = 0; } if ( ($mydownloadsConfig['allow_upload'] == 1) && !empty($_FILES['download']['name']) ) { $upload = new Upload(); $upload->setAllowedMimeTypes($mydownloadsConfig['accepted_files']); $upload->setUploadPath(XOOPS_ROOT_PATH.'/modules/mydownloads/cache/files'); $upload->setDestinationFileName('download'); $result = $upload->doUpload(); if ($result) { $url = $upload->HTTP_POST_FILES[$upload->uploadFieldName]['name']; $size = $upload->HTTP_POST_FILES[$upload->uploadFieldName]['size']; } else { $errors = $upload->getUploadErrors(); $errorstring = ""; $errorstring .= "::Errors occured::
\n"; while(list($filename,$values) = each($errors)) { $errorstring .= "File: " . $filename . "
"; $count = count($values); for($i=0; $i<$count; $i++) { $errorstring .= "==>" . $values[$i] . "
"; } } redirect_header("modfile.php?lid=$lid", 3, $errorstring); exit(); } } // Check if URL exist if ( empty($url) ) { $eh->show("1016"); } $newid = $db->genId($db->prefix("mydownloads_mod")."_requestid_seq"); $sql = " INSERT INTO ".$db->prefix("mydownloads_mod")." SET requestid=$newid, lid=$lid, cid=$cid, title='$title', url='$url', homepage='$homepage', version='$version', size='$size', platform='$platform', description='$description', modifysubmitter=$modifysubmitter"; $db->query($sql) or $eh->show("0013"); redirect_header("index.php", 2, _THANKSFORINFO); exit(); } else { $lid = intval($_GET['lid']); if (!$xoopsUser) { redirect_header(XOOPS_URL."/user.php", 2, _MUSTREGISTERFIRST); exit(); } include_once(XOOPS_ROOT_PATH."/header.php"); OpenTable(); mainheader(); echo ""._REQUESTMODIFICATION."

"; $result = $db->query("SELECT cid, title, description, url, homepage, version, size, platform, submitter FROM ".$db->prefix("mydownloads_downloads")." WHERE lid=".$lid." AND status>0"); list($cid, $title, $description, $url, $homepage, $version, $size, $platform, $submitter) = $db->fetchRow($result); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); $homepage = $myts->makeTboxData4Edit($homepage); $version = $myts->makeTboxData4Edit($version); $size = $myts->makeTboxData4Edit($size); $platform = $myts->makeTboxData4Edit($platform); $description = $myts->makeTboxData4Edit($description); ?>
uid() == $submitter) || $xoopsUser->isAdmin($xoopsModule->mid())) && ($mydownloadsConfig['allow_upload'] == 1) ) { $upload = new Upload(); $upload->setMaxImageSize($mydownloadsConfig['upload_limit']); echo "
"; $upload->printFormField('download'); echo " " . $mydownloadsConfig['upload_limit'] . " " . _BYTES . " " . _MAX; } ?>
makeMySelBox("title", "title", $cid);?>
render(); ?>