}
}
+ # The talk page isn't in the regular link tables, so we need to update manually:
+ $talkns = $ns ^ 1; # talk -> normal; normal -> talk
+ $sql = "UPDATE cur set cur_touched='$now' WHERE cur_namespace=$talkns AND cur_title='" . wfStrencode( $ttl ) . "'";
+ wfQuery( $sql );
+
$this->showArticle( $text, wfMsg( "newarticle" ) );
}
"cur_restrictions='{$limit}' WHERE cur_id={$id}";
wfQuery( $sql, DB_WRITE, "Article::protect" );
+ $log = new LogPage( wfMsg( "protectlogpage" ), wfMsg( "protectlogtext" ) );
+ if ( $limit === "" ) {
+ $log->addEntry( wfMsg( "unprotectedarticle", $wgTitle->getPrefixedText() ), "" );
+ } else {
+ $log->addEntry( wfMsg( "protectedarticle", $wgTitle->getPrefixedText() ), "" )
+ }
$wgOut->redirect( wfLocalUrl( $this->mTitle->getPrefixedURL() ) );
}
#
$tc = "[&;%\\-,.\\(\\)' _0-9A-Za-z\\/:\\x80-\\xff]";
$np = "[&;%\\-,.' _0-9A-Za-z\\/:\\x80-\\xff]"; # No parens
+ $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii!
$conpat = "/^({$np}+) \\(({$tc}+)\\)$/";
$p1 = "/\[\[({$np}+) \\(({$np}+)\\)\\|]]/"; # [[page (context)|]]
$p2 = "/\[\[\\|({$tc}+)]]/"; # [[|page]]
- $p3 = "/\[\[([A-Za-z _]+):({$np}+)\\|]]/"; # [[namespace:page|]]
- $p4 = "/\[\[([A-Aa-z _]+):({$np}+) \\(({$np}+)\\)\\|]]/";
+ $p3 = "/\[\[($namespacechar+):({$np}+)\\|]]/"; # [[namespace:page|]]
+ $p4 = "/\[\[($namespacechar+):({$np}+) \\(({$np}+)\\)\\|]]/";
# [[ns:page (cont)|]]
$context = "";
$t = $this->mTitle->getText();
( "" == $this->odt ) ||
( "" != $this->ot->getInterwiki() ) ||
( !$this->ot->userCanEdit() ) ||
+ ( !$this->oldid ) ||
( ! Namespace::isMovable( $nns ) ) ||
( "" == $this->ndt ) ||
( "" != $this->nt->getInterwiki() ) ||
global $wgUser, $wgOut, $wgUseDynamicDates, $action;
global $wpSaveprefs, $wpReset;
- $fields = array( "wpOldpass", "wpNewpass", "wpRetype",
- "wpEmail", "wpNick" );
+ $fields = array( "wpOldpass", "wpNewpass", "wpRetypePass",
+ "wpUserEmail", "wpNick" );
wfCleanFormFields( $fields );
if ( 0 == $wgUser->getID() ) {
/* private */ function savePreferences()
{
global $wgUser, $wgLang, $wgDeferredUpdateList;
- global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetype;
- global $wpSkin, $wpMath, $wpDate, $wpEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
+ global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetypePass;
+ global $wpSkin, $wpMath, $wpDate, $wpUserEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
global $wpSearchLines, $wpSearchChars, $wpStubs;
global $wpRows, $wpCols, $wpHourDiff, $HTTP_POST_VARS;
if ( "" != $wpNewpass ) {
- if ( $wpNewpass != $wpRetype ) {
+ if ( $wpNewpass != $wpRetypePass ) {
mainPrefsForm( wfMsg( "badretype" ) );
return;
}
}
$wgUser->setPassword( $wpNewpass );
}
- $wgUser->setEmail( $wpEmail );
+ $wgUser->setEmail( $wpUserEmail );
$wgUser->setOption( "nickname", $wpNick );
$wgUser->setOption( "quickbar", $wpQuickbar );
$wgUser->setOption( "skin", $wpSkin );
/* private */ function resetPrefs()
{
global $wgUser, $wgLang;
- global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetype, $wpStubs;
- global $wpRows, $wpCols, $wpSkin, $wpMath, $wpDate, $wpEmail, $wpEmailFlag, $wpNick;
+ global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetypePass, $wpStubs;
+ global $wpRows, $wpCols, $wpSkin, $wpMath, $wpDate, $wpUserEmail, $wpEmailFlag, $wpNick;
global $wpSearch, $wpRecent, $HTTP_POST_VARS;
global $wpHourDiff, $wpSearchLines, $wpSearchChars;
- $wpOldpass = $wpNewpass = $wpRetype = "";
- $wpEmail = $wgUser->getEmail();
+ $wpOldpass = $wpNewpass = $wpRetypePass = "";
+ $wpUserEmail = $wgUser->getEmail();
if ( 1 == $wgUser->getOption( "disablemail" ) ) { $wpEmailFlag = 1; }
else { $wpEmailFlag = 0; }
$wpNick = $wgUser->getOption( "nickname" );
$r1 .= "<label><input type=checkbox value=\"1\" name=\"" .
"wpNs$i\"{$checked}>{$name}</label>\n";
}
+ $name = str_replace( "_", " ", $ns[$i] );
+ if ( "" == $name ) { $name = wfMsg( "blanknamespace" ); }
+
+ if ( 0 != $i ) { $r1 .= " "; }
+ $r1 .= "<label><input type=checkbox value=\"1\" name=\"" .
+ "wpNs{$i}\"{$checked}>{$name}</label>\n";
}
return $r1;
/* private */ function mainPrefsForm( $err )
{
global $wgUser, $wgOut, $wgLang, $wgUseDynamicDates;
- global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetype;
- global $wpSkin, $wpMath, $wpDate, $wpEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
+ global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetypePass;
+ global $wpSkin, $wpMath, $wpDate, $wpUserEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
global $wpRows, $wpCols, $wpSaveprefs, $wpReset, $wpHourDiff;
global $wpSearchLines, $wpSearchChars, $wpStubs, $wgValidSkinNames;
#
$wpOldpass = wfEscapeHTML( $wpOldpass );
$wpNewpass = wfEscapeHTML( $wpNewpass );
- $wpRetype = wfEscapeHTML( $wpRetype );
+ $wpRetypePass = wfEscapeHTML( $wpRetypePass );
$wgOut->addHTML( "</td><td vaign=top nowrap><b>$cp:</b><br>
<label>$opw: <input type=password name=\"wpOldpass\" value=\"$wpOldpass\" size=20></label><br>
<label>$npw: <input type=password name=\"wpNewpass\" value=\"$wpNewpass\" size=20></label><br>
-<label>$rpw: <input type=password name=\"wpRetype\" value=\"$wpRetype\" size=20></label><br>
+<label>$rpw: <input type=password name=\"wpRetypePass\" value=\"$wpRetypePass\" size=20></label><br>
</td></tr>\n" );
# Skin setting
# Email, etc.
#
- $wpEmail = wfEscapeHTML( $wpEmail );
+ $wpUserEmail = wfEscapeHTML( $wpUserEmail );
$wpNick = wfEscapeHTML( $wpNick );
if ( $wpEmailFlag ) { $emfc = "checked"; }
else { $emfc = ""; }
$ps = namespacesCheckboxes();
$wgOut->addHTML( "<td valign=top nowrap>
-<label>$yem: <input type=text name=\"wpEmail\" value=\"{$wpEmail}\" size=20></label><br>
+<label>$yem: <input type=text name=\"wpUserEmail\" value=\"{$wpUserEmail}\" size=20></label><br>
<label><input type=checkbox $emfc value=\"1\" name=\"wpEmailFlag\"> $emf</label><br>
<label>$ynn: <input type=text name=\"wpNick\" value=\"{$wpNick}\" size=12></label><br>
<label>$rcc: <input type=text name=\"wpRecent\" value=\"$wpRecent\" size=6></label><br>
/* private */ function mailPassword()
{
global $wgUser, $wpName, $wgDeferredUpdateList, $wgOutputEncoding;
-
+ global $wgCookiePath, $wgCookieDomain, $wgDBname;
+
if ( "" == $wpName ) {
mainLoginForm( wfMsg( "noname" ) );
return;
$np = User::randomPassword();
$u->setNewpassword( $np );
- setcookie( "wcUserPassword", "", time() - 3600 );
+ setcookie( "{$wgDBname}Password", "", time() - 3600, $wgCookiePath, $wgCookieDomain );
$u->saveSettings();
$ip = getenv( "REMOTE_ADDR" );
{
global $wgUser, $wgOut, $wgLang, $returnto;
global $wpName, $wpPassword, $wpRetype, $wpRemember;
- global $wpEmail, $HTTP_COOKIE_VARS;
+ global $wpEmail, $HTTP_COOKIE_VARS, $wgDBname;
$le = wfMsg( "loginerror" );
$yn = wfMsg( "yourname" );
if ( 0 != $wgUser->getID() ) {
$name = $wgUser->getName();
} else {
- $name = $HTTP_COOKIE_VARS["wcUserName"];
+ $name = $HTTP_COOKIE_VARS["{$wgDBname}UserName"];
}
}
$pwd = $wpPassword;
}
$wgOut->addHTML( "
-<form id=\"userlogin\" method=\"post\" action=\"{$action}\">
+<form name=\"userlogin\" id=\"userlogin\" method=\"post\" action=\"{$action}\">
<table border=0><tr>
<td align=right>$yn:</td>
<td colspan=2 align=left>
} else {
return new User();
}
- } else if ( isset( $HTTP_COOKIE_VARS["wcUserID"] ) ) {
- $sId = $HTTP_COOKIE_VARS["wcUserID"];
+ } else if ( isset( $HTTP_COOKIE_VARS["{$wgDBname}UserID"] ) ) {
+ $sId = $HTTP_COOKIE_VARS["{$wgDBname}UserID"];
$wsUserID = $sId;
} else {
return new User();
}
if ( isset( $wsUserName ) ) {
$sName = $wsUserName;
- } else if ( isset( $HTTP_COOKIE_VARS["wcUserName"] ) ) {
- $sName = $HTTP_COOKIE_VARS["wcUserName"];
+ } else if ( isset( $HTTP_COOKIE_VARS["{$wgDBname}UserName"] ) ) {
+ $sName = $HTTP_COOKIE_VARS["{$wgDBname}UserName"];
$wsUserName = $sName;
} else {
return new User();
if ( isset( $wsUserPassword ) ) {
$passwordCorrect = $wsUserPassword == $user->mPassword;
- } else if ( isset( $HTTP_COOKIE_VARS["wcUserPassword"] ) ) {
- $user->mCookiePassword = $HTTP_COOKIE_VARS["wcUserPassword"];
+ } else if ( isset( $HTTP_COOKIE_VARS["{$wgDBname}Password"] ) ) {
+ $user->mCookiePassword = $HTTP_COOKIE_VARS["{$wgDBname}Password"];
$wsUserPassword = $user->addSalt( $user->mCookiePassword );
$passwordCorrect = $wsUserPassword == $user->mPassword;
} else {
function setCookies()
{
global $wsUserID, $wsUserName, $wsUserPassword;
- global $wgCookieExpiration;
+ global $wgCookieExpiration, $wgCookiePath, $wgCookieDomain, $wgDBname;
if ( 0 == $this->mId ) return;
$this->loadFromDatabase();
$exp = time() + $wgCookieExpiration;
$wsUserID = $this->mId;
- setcookie( "wcUserID", $this->mId, $exp, "/" );
+ setcookie( "{$wgDBname}UserID", $this->mId, $exp, $wgCookiePath, $wgCookieDomain );
$wsUserName = $this->mName;
- setcookie( "wcUserName", $this->mName, $exp, "/" );
+ setcookie( "{$wgDBname}UserName", $this->mName, $exp, $wgCookiePath, $wgCookieDomain );
$wsUserPassword = $this->mPassword;
if ( 1 == $this->getOption( "rememberpassword" ) ) {
- setcookie( "wcUserPassword", $this->mCookiePassword, $exp, "/" );
+ setcookie( "{$wgDBname}Password", $this->mCookiePassword, $exp, $wgCookiePath, $wgCookieDomain );
} else {
- setcookie( "wcUserPassword", "", time() - 3600 );
+ setcookie( "{$wgDBname}Password", "", time() - 3600 );
}
}
function logout()
{
- global $wsUserID;
+ global $wsUserID, $wgCookiePath, $wgCookieDomain, $wgDBname;
$this->mId = 0;
$wsUserID = 0;
- setcookie( "wcUserID", "", time() - 3600 );
- setcookie( "wcUserPassword", "", time() - 3600 );
+ setcookie( "{$wgDBname}UserID", "", time() - 3600, $wgCookiePath, $wgCookieDomain );
+ setcookie( "{$wgDBname}Password", "", time() - 3600, $wgCookiePath, $wgCookieDomain );
}
function saveSettings()