/** * Displays the form for editing custom (site-specific) information * @return $form Mixed: HTML output */ function displayCustomForm() { global $wgRequest, $wgUser, $wgOut; $dbr = wfGetDB(DB_MASTER); $s = $dbr->selectRow('user_profile', array('up_custom_1', 'up_custom_2', 'up_custom_3', 'up_custom_4', 'up_custom_5'), array('up_user_id' => $wgUser->getID()), __METHOD__); if ($s !== false) { $custom1 = $s->up_custom_1; $custom2 = $s->up_custom_2; $custom3 = $s->up_custom_3; $custom4 = $s->up_custom_4; } $wgOut->setHTMLTitle(wfMsg('pagetitle', wfMsg('user-profile-tidbits-title'))); $form = '<h1>' . wfMsg('user-profile-tidbits-title') . '</h1>'; $form .= UserProfile::getEditProfileNav(wfMsg('user-profile-section-custom')); $form .= '<form action="" method="post" enctype="multipart/form-data" name="profile"> <div class="profile-info clearfix"> <div class="profile-update"> <p class="profile-update-title">' . wfMsgForContent('user-profile-tidbits-title') . '</p> <div id="profile-update-custom1"> <p class="profile-update-unit-left">' . wfMsgForContent('custom-info-field1') . '</p> <p class="profile-update-unit"> <textarea name="custom1" id="fav_moment" rows="3" cols="75">' . (isset($custom1) ? $custom1 : '') . '</textarea> </p> </div> <div class="cleared"></div> <div id="profile-update-custom2"> <p class="profile-update-unit-left">' . wfMsgForContent('custom-info-field2') . '</p> <p class="profile-update-unit"> <textarea name="custom2" id="least_moment" rows="3" cols="75">' . (isset($custom2) ? $custom2 : '') . '</textarea> </p> </div> <div class="cleared"></div> <div id="profile-update-custom3"> <p class="profile-update-unit-left">' . wfMsgForContent('custom-info-field3') . '</p> <p class="profile-update-unit"> <textarea name="custom3" id="fav_athlete" rows="3" cols="75">' . (isset($custom3) ? $custom3 : '') . '</textarea> </p> </div> <div class="cleared"></div> <div id="profile-update-custom4"> <p class="profile-update-unit-left">' . wfMsgForContent('custom-info-field4') . '</p> <p class="profile-update-unit"> <textarea name="custom4" id="least_fav_athlete" rows="3" cols="75">' . (isset($custom4) ? $custom4 : '') . '</textarea> </p> </div> <div class="cleared"></div> </div> <input type="button" class="site-button" value="' . wfMsg('user-profile-update-button') . '" size="20" onclick="document.profile.submit()" /> </div> </form>'; return $form; }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param $msg String: error message as HTML * @param $sessionKey String: session key in case this is a stashed upload * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box * @return HTML output */ protected function getUploadForm($message = '', $sessionKey = '', $hideIgnoreWarning = false) { global $wgUseCopyrightUpload; if ($message != '') { $sub = $this->msg('uploaderror')->plain(); $this->getOutput()->addHTML("<h2>{$sub}</h2>\n" . "<h4 class='error'>{$message}</h4>\n"); } $ulb = $this->msg('uploadbtn'); $source = null; if ($wgUseCopyrightUpload) { $source = "\n\t\t\t\t<td align='right' nowrap='nowrap'>" . $this->msg('filestatus')->plain() . "</td>\n\t\t\t\t<td><input tabindex='3' type='text' name=\"wpUploadCopyStatus\" value=\"" . htmlspecialchars($this->mUploadCopyStatus) . "\" size='40' /></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t<td align='right'>" . $this->msg('filesource')->plain() . "</td>\n\t\t\t\t<td><input tabindex='4' type='text' name='wpUploadSource' value=\"" . htmlspecialchars($this->mUploadSource) . "\" style='width:100px' /></td>\n\t\t\t\t"; } $output = '<h1>' . $this->msg('uploadavatar')->plain() . '</h1>'; $output .= UserProfile::getEditProfileNav($this->msg('user-profile-section-picture')->plain()); $output .= '<div class="profile-info">'; if ($this->getAvatar('l') != '') { $output .= '<table> <tr> <td> <p class="profile-update-title">' . $this->msg('user-profile-picture-currentimage')->plain() . '</p> </td> </tr>'; $output .= '<tr> <td>' . $this->getAvatar('l') . '</td> </tr> </table>'; } $output .= '<form id="upload" method="post" enctype="multipart/form-data" action="">'; // The following two lines are delicious copypasta from HTMLForm.php, // function getHiddenFields() and they are required; wpEditToken is, as // of MediaWiki 1.19, checked _unconditionally_ in // SpecialUpload::loadRequest() and having the hidden title doesn't // hurt either // @see https://bugzilla.wikimedia.org/show_bug.cgi?id=30953 $output .= Html::hidden('wpEditToken', $this->getUser()->getEditToken(), array('id' => 'wpEditToken')) . "\n"; $output .= Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . "\n"; $output .= '<table border="0"> <tr> <td> <p class="profile-update-title">' . $this->msg('user-profile-picture-choosepicture')->plain() . '</p> <p style="margin-bottom:10px;">' . $this->msg('user-profile-picture-picsize')->plain() . '</p> <input tabindex="1" type="file" name="wpUploadFile" id="wpUploadFile" size="36"/> </td> </tr> <tr>' . $source . '</tr> <tr> <td> <input tabindex="5" type="submit" name="wpUpload" class="site-button" value="' . $ulb . '" /> </td> </tr> </table> </form>' . "\n"; $output .= '</div>'; return $output; }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param $msg String: error message as HTML * @param $sessionKey String: session key in case this is a stashed upload * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box * @return HTML output */ protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { global $wgOut, $wgUser, $wgUseCopyrightUpload; if ( $message != '' ) { $sub = wfMsg( 'uploaderror' ); $wgOut->addHTML( "<h2>{$sub}</h2>\n" . "<h4 class='error'>{$message}</h4>\n" ); } $sk = $wgUser->getSkin(); $ulb = wfMsg( 'uploadbtn' ); $source = null; if ( $wgUseCopyrightUpload ) { $source = " <td align='right' nowrap='nowrap'>" . wfMsg( 'filestatus' ) . ":</td> <td><input tabindex='3' type='text' name=\"wpUploadCopyStatus\" value=\"" . htmlspecialchars( $this->mUploadCopyStatus ) . "\" size='40' /></td> </tr><tr> <td align='right'>" . wfMsg( 'filesource' ) . ":</td> <td><input tabindex='4' type='text' name='wpUploadSource' value=\"" . htmlspecialchars( $this->mUploadSource ) . "\" style='width:100px' /></td> "; } $output = '<h1>' . wfMsg( 'uploadavatar' ) . '</h1>'; $output .= UserProfile::getEditProfileNav( wfMsg( 'user-profile-section-picture' ) ); $output .= '<div class="profile-info">'; if ( $this->getAvatar( 'l' ) != '' ) { $output .= '<table> <tr> <td> <p class="profile-update-title">' . wfMsg( 'user-profile-picture-currentimage' ) . '</p> </td> </tr>'; $output .= '<tr> <td>' . $this->getAvatar( 'l' ) . '</td> </tr> </table>'; } $output .= '<form id="upload" method="post" enctype="multipart/form-data" action=""> <table border="0"> <tr> <td> <p class="profile-update-title">' . wfMsg( 'user-profile-picture-choosepicture' ) . '</p> <p style="margin-bottom:10px;">' . wfMsg( 'user-profile-picture-picsize' ) . '</p> <input tabindex="1" type="file" name="wpUploadFile" id="wpUploadFile" size="36"/> </td> </tr> <tr>' . $source . '</tr> <tr> <td> <input tabindex="5" type="submit" name="wpUpload" class="site-button" value="' . $ulb . '" /> </td> </tr> </table> </form>' . "\n"; $output .= '</div>'; return $output; }
/** * Displays the main upload form, optionally with a highlighted * error message up at the top. * * @param $msg String: error message as HTML * @param $sessionKey String: session key in case this is a stashed upload * @param $hideIgnoreWarning Boolean: whether to hide "ignore warning" check box * @return HTML output */ protected function getUploadForm($message = '', $sessionKey = '', $hideIgnoreWarning = false) { global $wgOut, $wgUser, $wgLang, $wgUploadDirectory, $wgRequest, $wgUseCopyrightUpload; $cols = intval($wgUser->getOption('cols')); $ew = $wgUser->getOption('editwidth'); if ($ew) { $ew = ' style="width:100%"'; } else { $ew = ''; } if ('' != $message) { $sub = wfMsg('uploaderror'); $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<h4 class='error'>{$message}</h4>\n"); } $sk = $wgUser->getSkin(); $sourcefilename = wfMsg('sourcefilename'); $destfilename = wfMsg('destfilename'); $fd = wfMsg('filedesc'); $ulb = wfMsg('uploadbtn'); $iw = wfMsg('ignorewarning'); $titleObj = SpecialPage::getTitleFor('Upload'); $action = $titleObj->escapeLocalURL(); $encDestFile = htmlspecialchars($this->mDesiredDestName); $source = null; if ($wgUseCopyrightUpload) { $source = "\r\n\t\t\t\t<td align='right' nowrap='nowrap'>" . wfMsg('filestatus') . ":</td>\r\n\t\t\t\t<td><input tabindex='3' type='text' name=\"wpUploadCopyStatus\" value=\"" . htmlspecialchars($this->mUploadCopyStatus) . "\" size='40' /></td>\r\n\t\t\t\t</tr><tr>\r\n\t\t\t\t<td align='right'>" . wfMsg('filesource') . ":</td>\r\n\t\t\t\t<td><input tabindex='4' type='text' name='wpUploadSource' value=\"" . htmlspecialchars($this->mUploadSource) . "\" style='width:100px' /></td>\r\n\t\t\t\t"; } $watchChecked = $wgUser->getOption('watchdefault') ? 'checked="checked"' : ''; $output = '<h1>' . wfMsg('uploadavatar') . '</h1>'; $output .= UserProfile::getEditProfileNav(wfMsg('user-profile-section-picture')); $output .= '<div class="profile-info">'; if ($this->getAvatar('l') != '') { $output .= '<table> <tr> <td> <p class="profile-update-title">' . wfMsg('user-profile-picture-currentimage') . '</p> </td> </tr>'; $output .= '<tr> <td>' . $this->getAvatar('l') . '</td> </tr> </table>'; } $output .= '<form id="upload" method="post" enctype="multipart/form-data" action=""> <table border="0"> <tr> <td> <p class="profile-update-title">' . wfMsg('user-profile-picture-choosepicture') . '</p> <p style="margin-bottom:10px;">' . wfMsg('user-profile-picture-picsize') . '</p> <input tabindex="1" type="file" name="wpUploadFile" id="wpUploadFile" size="36"/> </td> </tr> <tr>' . $source . '</tr> <tr> <td> <input tabindex="5" type="submit" name="wpUpload" class="site-button" value="' . $ulb . '" /> </td> </tr> </table> </form>' . "\n"; $output .= '</div>'; return $output; }