function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload; global $wgStylePath; // dont show all of the skin $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $sk = $wgUser->getSkin(); $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsg('imagepopup_summary'); $addtosection = wfMsg('imageuploadsection'); $cp = wfMsg('imageuploadcaption'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $articlesummary = wfMsg('summary'); $steps = wfMsg('steps'); $tips = wfMsg('tips'); $warnings = wfMsg('warnings'); $ulb = wfMsgHtml('uploadbtn'); $titleObj = Title::makeTitle(NS_SPECIAL, 'UploadPopup'); $action = $titleObj->escapeLocalURL(); $encDestFile = htmlspecialchars($this->mDestFile); $watchChecked = $wgUser->getOption('watchdefault') ? 'checked="checked"' : ''; $wgOut->addHTML("\n <script type='text/javascript'>\n function checkFFBug() {\n if ((document.uploadform.wpLicense.value == '' || document.uploadform.wpLicense.value == 'No License' ) \n && navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) { \n return confirm('" . wfMsg('no_license_selected') . "'); \n }\n return true;\n }\n </script>\n\t<form id='upload' name='uploadform' method='post' enctype='multipart/form-data' action=\"{$action}\" onsubmit='return checkFFBug();'>\n\t\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t <tr>\n <td align='right'><label for='wpAddToSection'>{$addtosection}:</label></td>\n <td align='left'>\n \t\t<SELECT name=wpAddToSection tabindex='3'>\n \t\t\t <OPTION VALUE=summary>{$articlesummary}</OPTION>\n \t\t\t<OPTION VALUE=steps>{$steps}</OPTION>\n \t\t\t<OPTION VALUE=tips>{$tips}</OPTION>\n \t\t\t<OPTION VALUE=warnings>{$warnings}</OPTION>\n \t\t</SELECT>#:<input type=text size=2 name=wpStepNum>\n </td>\n </tr>\n \t<tr>\n <td align='right'><label for='wpCaption'>{$cp}:</label></td>\n <td align='left'>\n \t\t\t<input tabindex='4' type='text' name=\"wpCaption\" size='40'\"/>\n \t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadDescription'>{$summary}</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='5' type='text' name='wpUploadDescription' id='wpUploadDescription' size='40' value=\"" . htmlspecialchars($this->mUploadDescription) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"" . wfGetPad('/extensions/min/f/skins/common/upload.js') . "\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='6'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthis') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input id='gatWPUploadPopup' tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>\n\n<script type='text/javascript'>\nvar gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.');\ndocument.write(unescape('%3Cscript src=\\'' + gaJsHost + 'google-analytics.com/ga.js\\' type=\\'text/javascript\\'%3E%3C/script%3E')); \n\ntry { \nvar pageTracker = _gat._getTracker('UA-2375655-1'); \npageTracker._setDomainName('.wikihow.com');} catch(err) {}\n\nif (typeof jQuery == 'undefined') {\n\tEvent.observe(window, 'load', gatStartObservers); \n} else {\n\tjQuery(window).load(gatStartObservers);\n}\n</script> "); }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload; $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiText(wfMsg('uploadtext')); $wgOut->addHTML('</div>'); $sk = $wgUser->getSkin(); $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgWikiHtml('fileuploadsummary'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); // WERELATE - added licenseHelp $licenseHelpUrl = $sk->makeInternalOrExternalUrl(wfMsgForContent('licensehelppage')); $licenseHelp = '<a target="helpwindow" href="' . $licenseHelpUrl . '">' . htmlspecialchars(wfMsg('licensehelp')) . '</a>'; // WERELATE - added code to select proper license if ($this->mLicense) { $protectedLicense = str_replace(array('\\', '$', '^', '.', '[', ']', '|', '(', ')', '?', '*', '+', '{', '}', '-'), array('\\\\', '\\$', '\\^', '\\.', '\\[', '\\]', '\\|', '\\(', '\\)', '\\?', '\\*', '\\+', '\\{', '\\}', '\\-'), $this->mLicense); $licenseshtml = preg_replace('$value="(' . $protectedLicense . ')"$', 'value="$1" selected="selected"', $licenseshtml); } $ulb = wfMsgHtml('uploadbtn'); $titleObj = Title::makeTitle(NS_SPECIAL, 'Upload'); // WERELATE: added target and id $query = ''; if ($this->mTarget) { $query = 'target=' . urlencode($this->mTarget) . '&id=' . urlencode($this->mId); } $action = $titleObj->escapeLocalURL($query); $encDestFile = htmlspecialchars($this->mDestFile); //WERELATE - added watchcreations $watchChecked = $wgUser->getOption('watchdefault') || $wgUser->getOption('watchcreations') ? 'checked="checked"' : ''; // WERELATE - add scripts global $wgScriptPath; $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>"); $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/image.1.js\"></script>"); // WERELATE: removed tabindexes; added id to table $wgOut->addHTML("\n\t<form id='upload' method='post' enctype='multipart/form-data' action=\"{$action}\">\n\t\t<table id='image_form_table' border='0'>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename()' ") . "size='40' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>"); // WERELATE - added check to omit fields in case of a re-upload, since they're ignored $treecheckboxeshtml = ''; if (!$this->mReUploading) { $wgOut->addHTML("\n\t\t<tr><td> </td><td> </td></tr>\n\t\t<tr><td> </td><td align='left'><b>License and copyright</b></td></tr>\n\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license} ( {$licenseHelp} ):</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"{$wgStylePath}/common/upload.2.js\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' \n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mUploadCopyStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mUploadSource); $wgOut->addHTML("\n\t\t\t <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t <td><input type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='right'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t <td><input type='text' name='wpUploadSource' id='wpUploadCopyStatus' value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } // WERELATE: added fields $personTbl = $this->toForm($this->mPeople, 'person', NS_PERSON, true); $familyTbl = $this->toForm($this->mFamilies, 'family', NS_FAMILY, true); $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wrCopyright'>Copyright holder:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input type='text' name='wrCopyright' id='wrCopyright' size='30' value=\"" . htmlspecialchars($this->mCopyright) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr><td> </td><td> </td></tr>\n\t\t<tr><td> </td><td align='left'><b>Time place and people</b></td></tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wrDate'>Image date:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input type='text' name='wrDate' id='wrDate' size='15' value=\"" . htmlspecialchars($this->mDate) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wrPlace'>Place:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input class='place_input' type='text' name='wrPlace' id='wrDate' size='30' value=\"" . htmlspecialchars($this->mPlace) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' valign='top'>Person page:</td>\n\t\t\t<td align='left'>{$personTbl}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td align='left'><a id='person_link' href='javascript:void(0)' onClick='addImagePage(\"person\"); return preventDefaultAction(event);'>Add another person</a></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' valign='top'>Family page:</td>\n\t\t\t<td align='left'>{$familyTbl}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td align='left'><a id='family_link' href='javascript:void(0)' onClick='addImagePage(\"family\"); return preventDefaultAction(event);'>Add another family</a></td>\n\t\t</tr>\n\t\t"); // WERELATE - move description from above; end reUploading if statement; moved summary label // add id for wpUpload; added tree checkboxes //!!! remove this code dependency before sharing require_once "extensions/familytree/FamilyTreeUtil.php"; $t = null; if ($this->mDestFile) { $t = Title::newFromText($this->mDestFile, NS_IMAGE); } $treecheckboxeshtml = FamilyTreeUtil::generateTreeCheckboxes($wgUser, $t, true); $wgOut->addHtml("\n\t\t\t<tr><td> </td><td> </td></tr>\n\t\t\t<tr><td></td><td align='left'><b>{$summary}</b></td></tr>\n\t\t\t<tr><td></td><td align='left'>\n\t\t\t\t<textarea name='wpUploadDescription' id='wpUploadDescription' rows='6' cols='{$cols}'{$ew}>" . htmlspecialchars($this->mUploadDescription) . "</textarea>\n\t\t\t</td>\n\t\t</tr> "); } $wgOut->addHTML("\n\t\t<tr>\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthis') . "</label>\n\t\t\t<input type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>" . $treecheckboxeshtml . "\n\t\t</td>\n\t</tr>\n\t<tr>\n\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input type='submit' id='wpUpload' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>"); }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload, $wgMaxUploadFiles; if ($msg == '' && !$this->mShowUploadForm) { return; } $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $wgOut->addHTML("<b>{$this->mUploadSaveName}</b>\n<br/>"); $sub = wfMsgHtml('addresswarnings'); $wgOut->addHTML("<b>{$sub}</b><br/><span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiText(wfMsg('multiuploadtext')); $wgOut->addHTML('</div>'); $sk = $wgUser->getSkin(); $sourcefilename .= wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsg('fileuploadsummary'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = Title::makeTitle(NS_SPECIAL, 'MultipleUpload'); $action = $titleObj->escapeLocalURL(); $watchChecked = $wgUser->getOption('watchdefault') ? 'checked="checked"' : ''; $wgOut->addHTML("\n<script type=\"text/javascript\">\nfunction fillDestFilenameMulti(i) {\n if (!document.getElementById)\n return;\n\tvar path = document.getElementById('wpUploadFile_' + i).value;\n // Find trailing part \n var slash = path.lastIndexOf('/');\n var backslash = path.lastIndexOf('\\\\');\n var fname;\n if (slash == -1 && backslash == -1) {\n fname = path;\n } else if (slash > backslash) {\n fname = path.substring(slash+1, 10000);\n } else {\n fname = path.substring(backslash+1, 10000);\n }\n \n // Capitalise first letter and replace spaces by underscores\n fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_');\n \n // Output result\n var destFile = document.getElementById('wpDestFile_' + i);\n if (destFile)\n destFile.value = fname;\n destFile.value = fname.substr(0, fname.lastIndexOf('.') )\n + \"_\" + Math.round(1000*Math.random())\n + fname.substr(fname.lastIndexOf('.') );\n} \n</script>\n <script type='text/javascript'>\n function checkFFBug() {\n if ((document.uploadform.wpLicense.value == '' || document.uploadform.wpLicense.value == 'No License' ) \n && navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) { \n return confirm('" . wfMsg('no_license_selected') . "'); \n }\n return true;\n }\n </script>\n\t<form id='upload' name='uploadform' method='post' enctype='multipart/form-data' action=\"{$action}\" onsubmit='return checkFFBug();'>\n\t\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align='left'><label for='wpUploadFile'><b>{$sourcefilename}:</b></label></td>\n\t\t\t<td align='left'><label for='wpDestFile'><b>{$destfilename}:</b></label></td>\n\t\t\t<td align='left' valign='middle'><b>{$summary}</b></td>\n\t\t</tr>"); for ($i = 0; $i < $wgMaxUploadFiles; $i++) { $encDestFile = htmlspecialchars($this->mDestFileArray[$i]); $wgOut->addHTML("\n\t\t<tr>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='1' type='file' name='wpUploadFile_{$i}' id='wpUploadFile_{$i}' " . ($this->mDestFile ? "" : "onchange='fillDestFilenameMulti({$i})' ") . "size='25' />\n\t\t\t</td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile_{$i}' id='wpDestFile_{$i}' size='25' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='3' name='wpUploadDescription_{$i}' id='wpUploadDescription' value=\"" . htmlspecialchars($this->mUploadDescription) . "\" size=25>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); } if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='left' colspan=3>\n\t\t\t<label for='wpLicense'>{$license}:</label>\n\t\t\t\t<script type='text/javascript' src=\"{$wgStylePath}/common/upload.js\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4' style='font-size: xx-small;'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mUploadCopyStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mUploadSource); $wgOut->addHTML("\n\t\t\t <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='right'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td>\n \t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n <label for='wpWatchthis'>" . wfMsgHtml('watchthis') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\n\t</tr>\n\t<tr>\n\t\t<td align='left'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>"); }
function mainUploadForm($msg = '') { global $wgOut, $wgUser, $wgLang, $wgMaxUploadSize; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $autofill = wfBoolToStr($this->mDesiredDestName == ''); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\nwgUploadAutoFill = {$autofill};\n</script>\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/upload.js?{$wgStyleVersion}\"></script>\n\t\t"); if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } if ($this->mDesiredDestName) { $title = Title::makeTitleSafe(NS_IMAGE, $this->mDesiredDestName); // Show a subtitle link to deleted revisions (to sysops et al only) if ($title instanceof Title && ($count = $title->isDeleted()) > 0 && $wgUser->isAllowed('deletedhistory')) { $link = wfMsgExt($wgUser->isAllowed('delete') ? 'thisisdeleted' : 'viewdeleted', array('parse', 'replaceafter'), $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete', $title->getPrefixedText()), wfMsgExt('restorelink', array('parsemag', 'escape'), $count))); $wgOut->addHtml("<div id=\"contentSub2\">{$link}</div>"); } // Show the relevant lines from deletion log (for still deleted files only) if ($title instanceof Title && $title->isDeleted() > 0 && !$title->exists()) { $this->showDeletionLog($wgOut, $title->getPrefixedText()); } } $cols = intval($wgUser->getOption('cols')); if ($wgUser->getOption('editwidth')) { $width = " style=\"width:100%\""; } else { $width = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } //$wgOut->addHTML( '<div id="uploadtext">' ); //$wgOut->addWikiMsg( 'uploadtext', $this->mDesiredDestName ); //$wgOut->addHTML( "</div>\n" ); # Print a list of allowed file extensions, if so configured. We ignore # MIME type here, it's incomprehensible to most people and too long. global $wgCheckFileExtensions, $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist; $allowedExtensions = ''; if ($wgCheckFileExtensions) { $delim = wfMsgExt('comma-separator', array('escapenoentities')); if ($wgStrictFileExtensions) { # Everything not permitted is banned $extensionsList = '<div id="mw-upload-permitted">' . wfMsgWikiHtml('upload-permitted', implode($wgFileExtensions, $delim)) . "</div>\n"; } else { # We have to list both preferred and prohibited $extensionsList = '<div id="mw-upload-preferred">' . wfMsgWikiHtml('upload-preferred', implode($wgFileExtensions, $delim)) . "</div>\n" . '<div id="mw-upload-prohibited">' . wfMsgWikiHtml('upload-prohibited', implode($wgFileBlacklist, $delim)) . "</div>\n"; } } # Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only # See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize $val = trim(ini_get('upload_max_filesize')); $last = strtoupper(substr($val, -1)); switch ($last) { case 'G': $val2 = substr($val, 0, -1) * 1024 * 1024 * 1024; break; case 'M': $val2 = substr($val, 0, -1) * 1024 * 1024; break; case 'K': $val2 = substr($val, 0, -1) * 1024; break; default: $val2 = $val; } $val2 = $wgAllowCopyUploads ? min($wgMaxUploadSize, $val2) : $val2; $maxUploadSize = wfMsgExt('upload-maxfilesize', array('parseinline', 'escapenoentities'), $wgLang->formatSize($val2)); $sourcefilename = wfMsgExt('sourcefilename', 'escapenoentities'); $destfilename = wfMsgExt('destfilename', 'escapenoentities'); $summary = wfMsgExt('fileuploadsummary', 'parseinline'); $licenses = new Licenses(); $license = wfMsgExt('license', array('parseinline')); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Mv_special_upload'); $encDestName = htmlspecialchars($this->mDesiredDestName); $watchChecked = $this->watchCheck() ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " . "onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked='checked' />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")' " . "onchange='fillDestFilename(\"wpUploadFile\")' size='60' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " . "onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " . "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")' " . "onchange='fillDestFilename(\"wpUploadFileURL\")' size='60' disabled='disabled' />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='60' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } if ($useAjaxDestCheck) { $warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>"; $destOnkeyup = 'onkeyup="wgUploadWarningObj.keypress();"'; } else { $warningRow = ''; $destOnkeyup = ''; } $encComment = htmlspecialchars($this->mComment); $wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $titleObj->getLocalURL(), 'enctype' => 'multipart/form-data', 'id' => 'mw-upload-form')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('upload')) . Xml::openElement('table', array('border' => '0', 'id' => 'mw-upload-table')) . "<tr>\n\t\t\t \t{$this->uploadFormTextTop}\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadFile'>{$sourcefilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t{$filename_form}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t{$maxUploadSize}\n\t\t\t\t\t{$extensionsList}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpDestFile'>{$destfilename}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'\n\t\t\t\t\t\tvalue=\"{$encDestName}\" onchange='toggleFilenameFiller()' {$destOnkeyup} />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='file_desc_msg'>stream desc msg</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<input tabindex='3' type='text' name='file_desc_msg' id='file_desc_msg' size='60'\n\t\t\t\t\t\tvalue=\"mv_ogg_low_quality\" />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t<label for='wpUploadDescription'>{$summary}</label>\n\t\t\t\t</td>\n\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t<textarea tabindex='4' name='wpUploadDescription' id='wpUploadDescription' rows='6'\n\t\t\t\t\t\tcols='{$cols}'{$width}>{$encComment}</textarea>\n\t\t\t\t\t{$this->uploadFormTextAfterSummary}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpLicense'>{$license}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t\t\t{$licenseshtml}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); if ($useAjaxLicensePreview) { $wgOut->addHtml("\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td id=\"mw-license-preview\"></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>"); } } if ($wgUseCopyrightUpload) { $filestatus = wfMsgExt('filestatus', 'escapenoentities'); $copystatus = htmlspecialchars($this->mCopyrightStatus); $filesource = wfMsgExt('filesource', 'escapenoentities'); $uploadsource = htmlspecialchars($this->mCopyrightSource); $wgOut->addHTML("\n\t\t\t\t\t<td class='mw-label' style='white-space: nowrap;'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filestatus}</label></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$copystatus}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='mw-label'>\n\t\t\t\t\t\t<label for='wpUploadCopyStatus'>{$filesource}</label>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus'\n\t\t\t\t\t\t\tvalue=\"{$uploadsource}\" size='60' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); } $wgOut->addHtml("\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' {$warningChecked}/>\n\t\t\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t{$warningRow}\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t\t<td class='mw-input'>\n\t\t\t\t\t\t<input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey('upload') . " />\n\t\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='mw-input'>"); //undesa $stream_id = $wgRequest->getVal('stream_id'); $wgOut->addHTML("<input type=hidden name=stream_id value={$stream_id}></input>"); //undesa $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t\t\t</td>\n\t\t\t</tr>" . Xml::closeElement('table') . Xml::hidden('wpDestFileWarningAck', '', array('id' => 'wpDestFileWarningAck')) . Xml::closeElement('fieldset') . Xml::closeElement('form')); $uploadfooter = wfMsgNoTrans('uploadfooter'); if ($uploadfooter != '-' && !wfEmptyMsg('uploadfooter', $uploadfooter)) { $wgOut->addWikiText(Xml::tags('div', array('id' => 'mw-upload-footer-message'), $uploadfooter)); } }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload; $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiText(wfMsg('uploadtext')); $wgOut->addHTML('</div>'); $sk = $wgUser->getSkin(); $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgWikiHtml('fileuploadsummary'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = Title::makeTitle(NS_SPECIAL, 'Upload'); $action = $titleObj->escapeLocalURL(); $encDestFile = htmlspecialchars($this->mDestFile); $watchChecked = $wgUser->getOption('watchdefault') ? 'checked="checked"' : ''; $wgOut->addHTML("\n\t<form id='upload' method='post' enctype='multipart/form-data' action=\"{$action}\">\n\t\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename()' ") . "size='40' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadDescription'>{$summary}</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='6' cols='{$cols}'{$ew}>" . htmlspecialchars($this->mUploadDescription) . "</textarea>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"{$wgStylePath}/common/upload.js\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mUploadCopyStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mUploadSource); $wgOut->addHTML("\n\t\t\t <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='right'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthis') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>"); }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser; global $wgUseCopyrightUpload; global $wgRequest, $wgAllowCopyUploads; if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = " style=\"width:100%\""; } else { $ew = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiText(wfMsg('uploadtext')); $wgOut->addHTML('</div>'); $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgWikiHtml('fileuploadsummary'); $licenses = new Licenses(); $license = wfMsgHtml('license'); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Upload'); $action = $titleObj->escapeLocalURL(); $encDestFile = htmlspecialchars($this->mDestFile); $watchChecked = $wgUser->getOption('watchdefault') || $wgUser->getOption('watchcreations') && $this->mDestFile == '' ? 'checked="checked"' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' onfocus='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='40' DISABLED />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } $wgOut->addHTML("\n\t<form id='upload' method='post' enctype='multipart/form-data' action=\"{$action}\">\n\t\t<table border='0'>\n\t\t<tr>\n\t {$this->uploadFormTextTop}\n\t\t\t<td align='right' valign='top'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t{$filename_form}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadDescription'>{$summary}</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='6' cols='{$cols}'{$ew}>" . htmlspecialchars($this->mUploadDescription) . "</textarea>\n\t {$this->uploadFormTextAfterSummary}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>"); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"{$wgStylePath}/common/upload.js\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mUploadCopyStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mUploadSource); $wgOut->addHTML("\n\t\t\t <td align='right' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t <td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='right'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t <td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>"); }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param string $msg as HTML * @access private */ function mainUploadForm($msg = '') { global $wgOut, $wgUser, $wgContLang; global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview; global $wgRequest, $wgAllowCopyUploads; global $wgStylePath, $wgStyleVersion; $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview; $adc = wfBoolToStr($useAjaxDestCheck); $alp = wfBoolToStr($useAjaxLicensePreview); $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\n</script>\n<script type=\"text/javascript\" src=\"{$wgStylePath}/common/upload.js?{$wgStyleVersion}\"></script>\n\t\t"); if (!wfRunHooks('UploadForm:initial', array(&$this))) { wfDebug("Hook 'UploadForm:initial' broke output of the upload form"); return false; } if ($this->mDesiredDestName) { $title = Title::makeTitleSafe(NS_IMAGE, $this->mDesiredDestName); // Show a subtitle link to deleted revisions (to sysops et al only) if ($title instanceof Title && ($count = $title->isDeleted()) > 0 && $wgUser->isAllowed('deletedhistory')) { $link = wfMsgExt($wgUser->isAllowed('delete') ? 'thisisdeleted' : 'viewdeleted', array('parse', 'replaceafter'), $wgUser->getSkin()->makeKnownLinkObj(SpecialPage::getTitleFor('Undelete', $title->getPrefixedText()), wfMsgExt('restorelink', array('parsemag', 'escape'), $count))); $wgOut->addHtml("<div id=\"contentSub2\">{$link}</div>"); } // Show the relevant lines from deletion log (for still deleted files only) if ($title instanceof Title && $title->isDeleted() > 0 && !$title->exists()) { $this->showDeletionLog($wgOut, $title->getPrefixedText()); } } $cols = intval($wgUser->getOption('cols')); if ($wgUser->getOption('editwidth')) { $width = " style=\"width:100%\""; } else { $width = ''; } if ('' != $msg) { $sub = wfMsgHtml('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n"); } $wgOut->addHTML('<div id="uploadtext">'); $wgOut->addWikiMsg('uploadtext', $this->mDesiredDestName); $wgOut->addHTML("</div>\n"); # Print a list of allowed file extensions, if so configured. We ignore # MIME type here, it's incomprehensible to most people and too long. global $wgCheckFileExtensions, $wgStrictFileExtensions, $wgFileExtensions, $wgFileBlacklist; if ($wgCheckFileExtensions) { $delim = wfMsgExt('comma-separator', array('escapenoentities')); if ($wgStrictFileExtensions) { # Everything not permitted is banned $wgOut->addHTML('<div id="mw-upload-permitted">' . wfMsgWikiHtml('upload-permitted', implode($wgFileExtensions, $delim)) . "</div>\n"); } else { # We have to list both preferred and prohibited $wgOut->addHTML('<div id="mw-upload-preferred">' . wfMsgWikiHtml('upload-preferred', implode($wgFileExtensions, $delim)) . "</div>\n" . '<div id="mw-upload-prohibited">' . wfMsgWikiHtml('upload-prohibited', implode($wgFileBlacklist, $delim)) . "</div>\n"); } } $sourcefilename = wfMsgHtml('sourcefilename'); $destfilename = wfMsgHtml('destfilename'); $summary = wfMsgExt('fileuploadsummary', 'parseinline'); $licenses = new Licenses(); $license = wfMsgExt('license', array('parseinline')); $nolicense = wfMsgHtml('nolicense'); $licenseshtml = $licenses->getHtml(); $ulb = wfMsgHtml('uploadbtn'); $titleObj = SpecialPage::getTitleFor('Upload'); $action = $titleObj->escapeLocalURL(); $encDestName = htmlspecialchars($this->mDesiredDestName); $watchChecked = $wgUser->getOption('watchdefault') || $wgUser->getOption('watchcreations') && $this->mDesiredDestName == '' ? 'checked="checked"' : ''; $warningChecked = $this->mIgnoreWarning ? 'checked' : ''; // Prepare form for upload or upload/copy if ($wgAllowCopyUploads && $wgUser->isAllowed('upload_by_url')) { $filename_form = "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' " . "onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . "onfocus='" . "toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");" . "toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . wfMsgHTML('upload_source_file') . "<br/>" . "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " . "onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" . "<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " . "onfocus='" . "toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\");" . "toggle_element_check(\"wpSourceTypeURL\",\"wpSourceTypeFile\")'" . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFileURL\")' ") . "size='40' DISABLED />" . wfMsgHtml('upload_source_url'); } else { $filename_form = "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDesiredDestName ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />" . "<input type='hidden' name='wpSourceType' value='file' />"; } if ($useAjaxDestCheck) { $warningRow = "<tr><td colspan='2' id='wpDestFile-warning'> </td></tr>"; $destOnkeyup = 'onkeyup="wgUploadWarningObj.keypress();"'; } else { $warningRow = ''; $destOnkeyup = ''; } $encComment = htmlspecialchars($this->mComment); $align1 = $wgContLang->isRTL() ? 'left' : 'right'; $align2 = $wgContLang->isRTL() ? 'right' : 'left'; $wgOut->addHTML(<<<EOT \t<form id='upload' method='post' enctype='multipart/form-data' action="{$action}"> \t\t<table border='0'> \t\t<tr> \t {$this->uploadFormTextTop} \t\t\t<td align='{$align1}' valign='top'><label for='wpUploadFile'>{$sourcefilename}:</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t{$filename_form} \t\t\t</td> \t\t</tr> \t\t<tr> \t\t\t<td align='{$align1}'><label for='wpDestFile'>{$destfilename}:</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' \t\t\t\t\tvalue="{$encDestName}" {$destOnkeyup} /> \t\t\t</td> \t\t</tr> \t\t<tr> \t\t\t<td align='{$align1}'><label for='wpUploadDescription'>{$summary}</label></td> \t\t\t<td align='{$align2}'> \t\t\t\t<textarea tabindex='3' name='wpUploadDescription' id='wpUploadDescription' rows='6' \t\t\t\t\tcols='{$cols}'{$width}>{$encComment}</textarea> \t {$this->uploadFormTextAfterSummary} \t\t\t</td> \t\t</tr> \t\t<tr> EOT ); if ($licenseshtml != '') { global $wgStylePath; $wgOut->addHTML("\n\t\t\t<td align='{$align1}'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='{$align2}'>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='4'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t<option value=''>{$nolicense}</option>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>"); if ($useAjaxLicensePreview) { $wgOut->addHtml("\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td id=\"mw-license-preview\"></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"); } } if ($wgUseCopyrightUpload) { $filestatus = wfMsgHtml('filestatus'); $copystatus = htmlspecialchars($this->mCopyrightStatus); $filesource = wfMsgHtml('filesource'); $uploadsource = htmlspecialchars($this->mCopyrightSource); $wgOut->addHTML("\n\t\t\t <td align='{$align1}' nowrap='nowrap'><label for='wpUploadCopyStatus'>{$filestatus}:</label></td>\n\t\t\t\t\t<td><input tabindex='5' type='text' name='wpUploadCopyStatus' id='wpUploadCopyStatus' \n\t\t\t\t\t value=\"{$copystatus}\" size='40' /></td>\n\t\t </tr>\n\t\t\t<tr>\n\t\t \t<td align='{$align1}'><label for='wpUploadCopyStatus'>{$filesource}:</label></td>\n\t\t\t\t\t<td><input tabindex='6' type='text' name='wpUploadSource' id='wpUploadCopyStatus' \n\t\t\t\t\t value=\"{$uploadsource}\" size='40' /></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t"); } $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthisupload') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' {$warningChecked}/>\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t{$warningRow}\n\t<tr>\n\t\t<td></td>\n\t\t<td align='{$align2}'><input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey('upload') . " /></td>\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='{$align2}'>\n\t\t"); $wgOut->addWikiText(wfMsgForContent('edittools')); $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t<input type='hidden' name='wpDestFileWarningAck' id='wpDestFileWarningAck' value=''/>\n\t</form>"); }