Index: BlogAvatar.php
===================================================================
--- BlogAvatar.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ BlogAvatar.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -1,883 +0,0 @@
-<?php
-/**
- * Avatar extension
- *
- * @author Piotr Molski <moli@wikia-inc.com>
- * @uthor Krzysztof Krzyżaniak <eloy@wikia-inc.com>
- */
-
-if( !defined( 'MEDIAWIKI' ) ) {
-	echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
-	die( 1 );
-}
-
-define ("AVATAR_DEFAULT_WIDTH", 100);
-define ("AVATAR_DEFAULT_HEIGHT", 100);
-define ("AVATAR_LOG_NAME", 'useravatar');
-define ("AVATAR_USER_OPTION_NAME", 'avatar');
-define ("AVATAR_MAX_SIZE", 512000 );
-define ("AVATAR_UPLOAD_FIELD", 'wkUserAvatar');
-
-$wgLogTypes[] = AVATAR_LOG_NAME;
-$wgLogHeaders[AVATAR_LOG_NAME] = "blog-avatar-alt";
-$wgHooks['AdditionalUserProfilePreferences'][] = "BlogAvatar::additionalUserProfilePreferences";
-$wgHooks['SavePreferences'][] = "BlogAvatar::savePreferences";
-$wgHooks['MonacoBeforePageBar'][] = "BlogAvatar::userMasthead";
-
-$wgLogNames[AVATAR_LOG_NAME] = "useravatar-log";
-
-$wgLogActions[AVATAR_LOG_NAME . '/avatar_chn'] = 'blog-avatar-changed-log';
-$wgLogActions[AVATAR_LOG_NAME . '/avatar_rem'] = 'blog-avatar-removed-log';
-
-$wgExtensionCredits['specialpage'][] = array(
-    "name" => "RemoveAvatar",
-    "description" => "Remove User's avatars",
-    "author" => "Krzysztof Krzyzaniak (eloy) <eloy@wikia-inc.com>, Piotr Molski (moli) <moli@wikia-inc.com>"
-);
-
-#--- register special page (MW 1.10 way)
-if ( !function_exists( 'extAddSpecialPage' ) ) {
-    require( "$IP/extensions/ExtensionFunctions.php" );
-}
-
-/**
- * messages file
- */
-if (!array_key_exists("Blogs", $wgExtensionMessagesFiles)) {
-	$wgExtensionMessagesFiles["Blogs"] = dirname(__FILE__) . '/Blogs.i18n.php';
-}
-
-#--- permissions
-$wgAvailableRights[] = 'removeavatar';
-$wgGroupPermissions['staff']['removeavatar'] = true;
-#$wgGroupPermissions['sysop']['removeavatar'] = true;
-$wgGroupPermissions['helper']['removeavatar'] = true;
-extAddSpecialPage( '', 'RemoveAvatar', 'BlogAvatarRemovePage' );
-$wgSpecialPageGroups['RemoveAvatar'] = 'users';
-
-class BlogAvatar {
-
-	/**
-	 * default avatar path
-	 */
-	public $mDefaultPath = "http://images.wikia.com/messaging/images/";
-
-	/**
-	 * path to file, relative
-	 */
-	public $mPath = false;
-
-	/**
-	 * user object
-	 */
-	public $mUser = false;
-
-	/**
-	 * city_id for messaging.wikia.com, will be used for creating image urls
-	 */
-	private $mMsgCityId = 4036;
-
-	/**
-	 * avatars from mediawiki message
-	 */
-	public $mDefaultAvatars = false;
-
-	public function __construct( User $User ) {
-		wfProfileIn( __METHOD__ );
-		$this->mUser = $User;
-		wfLoadExtensionMessages("Blogs");
-		wfProfileOut( __METHOD__ );
-	}
-
-	/**
-	 * static constructor
-	 *
-	 * @static
-	 * @access public
-	 */
-	public static function newFromUser( User $User ) {
-		return new BlogAvatar( $User );
-	}
-
-	/**
-	 * static constructor
-	 * @static
-	 * @access public
-	 */
-	public static function newFromUserID( $userId ) {
-		wfProfileIn( __METHOD__ );
-
-		$User = User::newFromId( $userId );
-		$User->load();
-		$Avatar = new BlogAvatar( $User );
-
-		wfProfileOut( __METHOD__ );
-		return $Avatar;
-	}
-
-	/**
-	 * static constructor
-	 *
-	 * @static
-	 * @access public
-	 */
-	public static function newFromUserName( $login ) {
-		wfProfileIn( __METHOD__ );
-
-		$User = User::newFromName( $login );
-		if( $User ) {
-			$User->load();
-			$Avatar = new BlogAvatar( $User );
-		}
-		else {
-			/**
-			 * anonymous
-			 */
-			$Avatar = BlogAvatar::newFromUserID( 0 );
-		}
-		wfProfileOut( __METHOD__ );
-		return $Avatar;
-	}
-
-	/**
-	 * getDefaultAvatars -- get avatars stored in mediawiki message and return as
-	 * 	array
-	 *
-	 * @author Piotr Molski <moli@wikia-inc.com>
-	 * @author Krzysztof Krzyżaniak <eloy@wikia-inc.com>
-	 */
-	public function getDefaultAvatars() {
-
-		/**
-		 * parse message only once per request
-		 */
-		if( is_array( $this->mDefaultAvatars ) && count( $this->mDefaultAvatars )> 0) {
-			return $this->mDefaultAvatars;
-		}
-
-		wfProfileIn( __METHOD__ );
-
-		$this->mDefaultAvatars = array();
-		$images = getMessageAsArray( "blog-avatar-defaults" );
-
-		foreach( $images as $image ) {
-			$hash = FileRepo::getHashPathForLevel( $image, 2 );
-			$this->mDefaultAvatars[] = $this->mDefaultPath . $hash . $image;
-		}
-
-		wfProfileOut( __METHOD__ );
-
-		return $this->mDefaultAvatars;
-	}
-
-	/**
-	 * getUserName
-	 *
-	 * @access public
-	 *
-	 * @return String
-	 */
-	public function getUserName() {
-		$username = "";
-		if (isset($this->mUser)) {
-			$username = $this->mUser->getName();
-		}
-		return $username;
-	}
-
-	/**
-	 * getUrl -- read url from preferences or from defaults if preference is
-	 * not set.
-	 *
-	 * @access private
-	 *
-	 * @return String
-	 */
-	public function getUrl() {
-		global $wgBlogAvatarPath;
-		$url = $this->mUser->getOption( AVATAR_USER_OPTION_NAME );
-		if( $url ) {
-			/**
-			 * if default avatar we glue with messaging.wikia.com
-			 * if uploaded avatar we glue with common avatar path
-			 */
-			if( strpos( $url, "/" ) !== false ) {
-				/**
-				 * uploaded file, we are adding common/avatars path
-				 */
-				$url = $wgBlogAvatarPath . $url . "?" . $this->mUser->mTouched;
-			}
-			else {
-				/**
-				 * default avatar, path from messaging.wikia.com
-				 */
-				$hash = FileRepo::getHashPathForLevel( $url, 2 );
-				$url = $this->mDefaultPath . $hash . $url;
-			}
-		}
-		else {
-			$defaults = $this->getDefaultAvatars();
-			$url = array_shift( $defaults );
-		}
-		
-		return wfReplaceImageServer( $url );
-	}
-
-	/**
-	 * getImageTag -- return HTML <img> tag
-	 *
-	 * @access public
-	 *
-	 * @param Integer $width default AVATAR_DEFAULT_WIDTH -- width of image
-	 * @param Integer $height default AVATAR_DEFAULT_HEIGHT -- height of image
-	 * @param String  $alt	-- alternate text
-	 * @param String  $class -- which class should be used for element
-	 * @param String  $id -- DOM identifier
-	 */
-	public function getImageTag( $width = AVATAR_DEFAULT_WIDTH, $height = AVATAR_DEFAULT_HEIGHT, $alt = false, $class = "avatar", $id = false ) {
-		global $wgUser;
-
-		wfProfileIn( __METHOD__ );
-
-		$url = $this->getUrl();
-		Wikia::log( __METHOD__, "url", $url );
-
-		if ( ! $alt ) {
-			$alt = "[" .$this->mUser->getName() ."]";
-		}
-		$attribs = array (
-			'src' 		=> $url,
-			'border' 	=> 0,
-			'width'		=> $width,
-			'height'	=> $height,
-			'alt' 		=> $alt,
-		);
-		if( $class ) {
-			$attribs[ "class" ] = $class;
-			if( $wgUser->getID() == $this->mUser->getID( ) ) {
-				$attribs[ "class" ] .= " avatar-self";
-			}
-		}
-		if( $id ) {
-			$attribs[ "id" ] = $id;
-		}
-
-		wfProfileOut( __METHOD__ );
-		return Xml::element( 'img', $attribs, '', true );
-	}
-
-	/**
-	 * display -- return image with link to user page
-	 *
-	 * @param Integer $width default AVATAR_DEFAULT_WIDTH -- width of image
-	 * @param Integer $height default AVATAR_DEFAULT_HEIGHT -- height of image
-	 * @param String  $alt	-- alternate text
-	 * @param String  $class -- which class should be used for element
-	 * @param String  $id -- DOM identifier
-	 * @param Boolean $showEditMenu
-	 * @param String  $tracker -- what tracker to add, if any
-	 */
-	public function display( $width = AVATAR_DEFAULT_WIDTH, $height = AVATAR_DEFAULT_HEIGHT, $alt = false, $class = "avatar", $id = false, $showEditMenu = false, $tracker = false ) {
-
-		wfProfileIn( __METHOD__ );
-		$image = $this->getImageTag( $width, $height, $alt, $class, $id );
-		$additionalAttribs = "";
-		if (!empty($showEditMenu)) {
-			$showEditDiv = "document.getElementById('wk-avatar-change').style.visibility='visible'";
-			$hideEditDiv = "document.getElementById('wk-avatar-change').style.visibility='hidden'";
-			$additionalAttribs = "onmouseover=\"{$showEditDiv}\" onmouseout=\"{$hideEditDiv}\"";
-		}
-		if (!empty($tracker)) {
-			$additionalAttribs .= " onclick=\"WET.byStr('{$tracker}')\"";
-		}
-		if( ! $this->mUser->isAnon() ) {
-			$url = sprintf("<a href=\"%s\" %s>%s</a>", $this->mUser->getUserPage()->getFullUrl(), $additionalAttribs, $image );
-		}
-		else {
-			$url = $image;
-		}
-		wfProfileOut( __METHOD__ );
-
-		return $url;
-	}
-
-	/**
-	 * getLocalPath -- create file path from user identifier
-	 */
-	public function getLocalPath() {
-
-		if( $this->mPath ) {
-			return $this->mPath;
-		}
-
-		wfProfileIn( __METHOD__ );
-
-		$image  = sprintf("%s.png", $this->mUser->getID() );
-		$hash   = sha1( (string)$this->mUser->getID() );
-		$folder = substr( $hash, 0, 1)."/".substr( $hash, 0, 2 );
-
-		$this->mPath = "/{$folder}/{$image}";
-
-		wfProfileOut( __METHOD__ );
-
-		return $this->mPath;
-	}
-
-	/**
-	 * getFullPath -- return full path for image
-	 */
-	public function getFullPath() {
-		global $wgBlogAvatarDirectory;
-		return $wgBlogAvatarDirectory.$this->getLocalPath();
-	}
-
-	/**
-	 * isDefault -- check if user use default avatars
-	 */
-	public function isDefault() {
-		$url = $this->mUser->getOption( AVATAR_USER_OPTION_NAME );
-		if( $url ) {
-			/**
-			 * default avatar are only filenames without path
-			 */
-			if( strpos( $url, "/" ) !== false ) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * removeFile -- remove file from directory
-	 */
-	public function removeFile() {
-		wfProfileIn( __METHOD__ );
-		global $wgLogTypes, $wgUser;
-
-		$result = false;
-		$sImageFull = $this->getFullPath();
-
-		if (file_exists($sImageFull)) {
-			if (!unlink($sImageFull)) {
-				wfDebug( __METHOD__.": cannot remove avatar's files {$sImageFull}\n" );
-				$result = false;
-			} else {
-				/* add log */
-				$this->__setLogType();
-				$sUserText =  $this->mUser->getName();
-				$this->mUser->setOption( AVATAR_USER_OPTION_NAME, "" );
-				$this->mUser->saveSettings();
-				$mUserBlogPage = Title::newFromText( $sUserText, NS_BLOG_ARTICLE );
-				$oLogPage = new LogPage( AVATAR_LOG_NAME );
-				$oLogPage->addEntry( 'avatar_rem', $mUserBlogPage, '', array($sUserText));
-				/* */
-				$result = true;
-			}
-		}
-		wfProfileOut( __METHOD__ );
-		return $result;
-	}
-
-	private function __setLogType() {
-		global $wgLogTypes;
-		wfProfileIn(__METHOD__);
-		if (!in_array(AVATAR_LOG_NAME, $wgLogTypes)) {
-			$wgLogTypes[] = AVATAR_LOG_NAME;
-		}
-		wfProfileOut(__METHOD__);
-	}
-
-	/**
-	 * uploadFile -- save file when is in proper format, do resize and
-	 * other stuffs
-	 *
-	 * @param Request $request -- WebRequest instance
-	 * @param String $input    -- name of file input in form
-	 *
-	 * @return Integer -- error code of operation
-	 */
-	public function uploadFile($request, $input = AVATAR_UPLOAD_FIELD) {
-		global $wgTmpDirectory;
-		wfProfileIn(__METHOD__);
-
-		$this->__setLogType();
-
-		if( !isset( $wgTmpDirectory ) || !is_dir( $wgTmpDirectory ) ) {
-			$wgTmpDirectory = "/tmp";
-		}
-		Wikia::log( __METHOD__, "tmp", "Temp directory set to {$wgTmpDirectory}" );
-
-		$errorNo = $request->getUploadError( $input );
-		if ( $errorNo != UPLOAD_ERR_OK ) {
-			Wikia::log( __METHOD__, "error", "Upload error {$errorNo}" );
-			wfProfileOut(__METHOD__);
-			return $errorNo;
-		}
-		$iFileSize = $request->getFileSize( $input );
-
-		if( empty( $iFileSize ) ) {
-			/**
-			 * file size = 0
-			 */
-			Wikia::log( __METHOD__, "empty", "Empty file {$input} reported size {$iFileSize}" );
-			wfProfileOut(__METHOD__);
-			return UPLOAD_ERR_NO_FILE;
-		}
-
-		$sTmpFile = $wgTmpDirectory."/".substr(sha1(uniqid($this->mUser->getID())), 0, 16);
-		Wikia::log( __METHOD__, "tmp", "Temp file set to {$sTmpFile}" );
-		$sTmp = $request->getFileTempname($input);
-		Wikia::log( __METHOD__, "path", "Path to uploaded file is {$sTmp}" );
-
-		if( move_uploaded_file( $sTmp, $sTmpFile )  ) {
-			$aImgInfo = getimagesize($sTmpFile);
-
-			/**
-			 * check if mimetype is allowed
-			 */
-			$aAllowMime = array( "image/jpeg", "image/pjpeg", "image/gif", "image/png", "image/x-png", "image/jpg", "image/bmp" );
-			if (!in_array($aImgInfo["mime"], $aAllowMime)) {
-				Wikia::log( __METHOD__, "mime", "Imvalid mime type, allowed: " . implode(",", $aAllowMime) );
-				wfProfileOut(__METHOD__);
-				return $errorNo;
-			}
-
-			switch ($aImgInfo["mime"]) {
-				case "image/gif":
-					$oImgOrig = @imagecreatefromgif($sTmpFile);
-					break;
-				case "image/pjpeg":
-				case "image/jpeg":
-				case "image/jpg":
-					$oImgOrig = @imagecreatefromjpeg($sTmpFile);
-					break;
-				case "image/bmp":
-					$oImgOrig = @imagecreatefrombmp($sTmpFile);
-					break;
-				case "image/x-png":
-				case "image/png":
-					$oImgOrig = @imagecreatefrompng($sTmpFile);
-					break;
-			}
-			$aOrigSize = array("width" => $aImgInfo[0], "height" => $aImgInfo[1]);
-
-			/**
-			 * generate new image to png format
-			 */
-			$addedAvatars = array();
-			$sFilePath = $this->getFullPath();
-
-			/**
-			 * calculate new image size - should be 100 x 100
-			 */
-			$iImgW = AVATAR_DEFAULT_WIDTH;
-			$iImgH = AVATAR_DEFAULT_HEIGHT;
-			/* WIDTH > HEIGHT */
-			if ( $aOrigSize["width"] > $aOrigSize["height"] ) {
-				$iImgH = $iImgW * ( $aOrigSize["height"] / $aOrigSize["width"] );
-			}
-			/* HEIGHT > WIDTH */
-			if ( $aOrigSize["width"] < $aOrigSize["height"] ) {
-				$iImgW = $iImgH * ( $aOrigSize["width"] / $aOrigSize["height"] );
-			}
-
-			/* empty image with thumb size on white background */
-			$oImg = @imagecreatetruecolor($iImgW, $iImgH);
-			$white = imagecolorallocate($oImg, 255, 255, 255);
-			imagefill($oImg, 0, 0, $white);
-
-			imagecopyresampled(
-				$oImg,
-				$oImgOrig,
-				floor ( ( AVATAR_DEFAULT_WIDTH - $iImgW ) / 2 ) /*dx*/,
-				floor ( ( AVATAR_DEFAULT_HEIGHT - $iImgH ) / 2 ) /*dy*/,
-				0 /*sx*/,
-				0 /*sy*/,
-				$iImgW /*dw*/,
-				$iImgH /*dh*/,
-				$aOrigSize["width"]/*sw*/,
-				$aOrigSize["height"]/*sh*/
-			);
-
-			/**
-			 * save to new file ... but create folder for it first
-			 */
-			if ( !is_dir( dirname( $sFilePath ) ) && !wfMkdirParents( dirname( $sFilePath ) ) ) {
-				Wikia::log( __METHOD__, "dir", sprintf("Cannot create directory %s", dirname( $sFilePath ) ) );
-				wfProfileOut( __METHOD__ );
-				return UPLOAD_ERR_CANT_WRITE;
-			}
-
-			if ( !imagepng($oImg, $sFilePath) ) {
-				Wikia::log( __METHOD__, "save", sprintf("Cannot save png Avatar: %s", $sFilePath ));
-				$errorNo = UPLOAD_ERR_CANT_WRITE;
-			}
-			else {
-				/* remove tmp file */
-				imagedestroy($oImg);
-
-				$sUserText =  $this->mUser->getName();
-				$mUserBlogPage = Title::newFromText( $sUserText, NS_BLOG_ARTICLE );
-				$oLogPage = new LogPage( AVATAR_LOG_NAME );
-				$oLogPage->addEntry( 'avatar_chn', $mUserBlogPage, '');
-				unlink($sTmpFile);
-				$errorNo = UPLOAD_ERR_OK;
-			}
-		}
-		else {
-			Wikia::log( __METHOD__, "move", sprintf("Cannot move uploaded file from %s to %s", $sTmp, $sTmpFile ));
-			$errorNo = UPLOAD_ERR_CANT_WRITE;
-		}
-		wfProfileOut(__METHOD__);
-		return $errorNo;
-	}
-
-	/**
-	 * additionalUserProfilePreferences -- Hook handler
-	 *
-	 * @param PreferencesForm $oPrefs  -- preferences form instance
-	 * @param String $html -- generated html
-	 */
-	static public function additionalUserProfilePreferences( &$oPrefs, &$html) {
-		global $wgUser, $wgCityId;
-		wfProfileIn( __METHOD__ );
-		$oAvatarObj = BlogAvatar::newFromUser( $wgUser );
-		$aDefAvatars = $oAvatarObj->getDefaultAvatars();
-
-		if ( $wgUser->isBlocked() ) {
-			# if user is blocked - don't show avatar form
-			return true;
-		}
-		/**
-		 * run template
-		 */
-		$oTmpl = new EasyTemplate( dirname( __FILE__ ) . "/templates/" );
-		$oTmpl->set_vars( array(
-			"wgUser"		=> $wgUser,
-			"sUserAvatar"	=> $wgUser->getOption(AVATAR_USER_OPTION_NAME),
-			"cityId"		=> $wgCityId,
-			"aDefAvatars"	=> $aDefAvatars,
-			"oAvatarObj"	=> $oAvatarObj,
-			"sUserImg"		=> $oAvatarObj->getURL(),
-			"imgH"			=> AVATAR_DEFAULT_HEIGHT,
-			"imgW"			=> AVATAR_DEFAULT_WIDTH,
-			"sFieldName"	=> AVATAR_UPLOAD_FIELD,
-		) );
-
-		$html .= wfHidden( 'MAX_FILE_SIZE', AVATAR_MAX_SIZE );
-		$html .= $oTmpl->execute("pref-avatar-form");
-
-		wfProfileOut( __METHOD__ );
-		return true;
-	}
-
-	/**
-	 * savePreferences -- Hook handler
-	 *
-	 * @param PreferencesForm $oPrefs  -- preferences form instance
-	 * @param User $User -- user object
-	 * @param String $sMsg -- status message
-	 * @param $oldOptions
-	 */
-	static public function savePreferences( $oPrefs, $mUser, &$sMsg, $oldOptions ) {
-		global $wgRequest;
-		wfProfileIn( __METHOD__ );
-		$result = true;
-
-		$sUrl = wfBasename( $wgRequest->getVal( 'wkDefaultAvatar' ) );
-		$sUploadedAvatar = $wgRequest->getFileName( AVATAR_UPLOAD_FIELD );
-
-		/**
-		 * we store in different way default and uploaded pictures
-		 *
-		 * default: we store only filename
-		 * uploaded: we store relative path to filename
-		 */
-
-		/**
-		 * is user trying to upload something
-		 */
-		$isNotUploaded = ( empty( $sUploadedAvatar ) && empty( $sUrl ) );
-		if ( !$isNotUploaded ) {
-			$oAvatarObj = BlogAvatar::newFromUser( $mUser );
-			/* check is set default avatar for user */
-			if ( empty($sUrl) ) {
-				/* upload user avatar */
-				$errorNo = $oAvatarObj->uploadFile( $wgRequest );
-				if ( $errorNo != UPLOAD_ERR_OK ) {
-					switch( $errorNo ) {
-						case UPLOAD_ERR_NO_FILE:
-							$sMsg .= wfMsg( "blog-avatar-error-nofile");
-							break;
-
-						case UPLOAD_ERR_CANT_WRITE:
-							$sMsg .= wfMsg( "blog-avatar-error-cantwrite");
-							break;
-						case UPLOAD_ERR_FORM_SIZE:
-							$sMsg .= wfMsg( "blog-avatar-error-size", (int)(AVATAR_MAX_SIZE/1024) );
-							break;
-
-						default:
-							$sMsg .= wfMsg( "blog-avatar-error-cantwrite");
-					}
-					$result = false;
-				} else {
-					$sUrl = $oAvatarObj->getLocalPath();
-				}
-				Wikia::log( __METHOD__, "url", $sUrl );
-			}
-
-			if ( !empty($sUrl) ) {
-				/* set user option */
-				$mUser->setOption( AVATAR_USER_OPTION_NAME, $sUrl );
-			}
-		}
-		Wikia::log( __METHOD__, "url", "selected avatar for user ".$mUser->getID().": $sUrl" );
-
-		wfProfileOut( __METHOD__ );
-		return $result;
-	}
-
-	/**
-	 * userMasthead -- Hook handler
-	 *
-	 * @param
-	 *
-	 */
-	static public function userMasthead() {
-		global $wgTitle, $wgUser, $wgOut, $wgExtensionsPath, $wgStyleVersion, $wgRequest;
-		global $wgJsMimeType, $wgMergeStyleVersionJS;
-
-		$namespace = $wgTitle->getNamespace();
-		$dbKey = SpecialPage::resolveAlias( $wgTitle->getDBkey() );
-		$isAnon = $wgUser->isAnon();
-
-		$allowedNamespaces = array( NS_USER, NS_USER_TALK );
-		if ( defined("NS_BLOG_ARTICLE") ) {
-			$allowedNamespaces[] = NS_BLOG_ARTICLE;
-		}
-
-		# special pages visible only for the current user
-		# /$par is used for other things here
-		$allowedPagesSingle = array (
-			'Watchlist',
-			'WidgetDashboard',
-			'Preferences'
-		);
-
-		# special pages visible for other users
-		# /$par or target paramtere are used for username
-		$allowedPagesMulti = array (
-			'Contributions',
-			'Emailuser'
-		);
-
-		if( in_array( $namespace, $allowedNamespaces ) ||
-			( $namespace == NS_SPECIAL && ( in_array( $dbKey, $allowedPagesSingle ) || in_array( $dbKey, $allowedPagesMulti ) ) )
-		) {
-			/**
-			 * change dbkey for nonspecial articles, in this case we use NAMESPACE
-			 * as key
-			 */
-			if ( $namespace != NS_SPECIAL ) {
-				$dbKey = $namespace;
-			}
-
-			/* hides article/talk tabs in Monaco.php */
-			$Avatar = null;
-			$userspace = "";
-			$out = array();
-			/* check conditions */
-			if ( in_array( $namespace, $allowedNamespaces ) ) {
-				# Title::getBaseText only backs up one step, we need the leftmost part
-				list( $userspace ) = explode( "/", $wgTitle->getText(), 2 );
-				$Avatar = BlogAvatar::newFromUserName( $userspace );
-			} elseif ( in_array( $dbKey, $allowedPagesSingle ) ) {
-				$userspace = $wgUser->getName();
-				$Avatar = BlogAvatar::newFromUser( $wgUser );
-			} elseif ( in_array( $dbKey, $allowedPagesMulti ) ) {
-				$reqTitle = $wgRequest->getText("title", false);
-
-				# try to get a target user name
-				$userspace = $wgRequest->getText('target', false);
-				if ( empty( $userspace ) && strpos( $reqTitle, "/") !== false ) {
-					list ( , $userspace ) = explode( "/", $reqTitle, 2 );
-				}
-
-				# process the name
-				if ( !empty( $userspace ) ) {				
-					$user = User::newFromName( $userspace );
-					if( ! $user ) {
-						/**
-						 * means that url is malformed or page doesn't exists
-						 * or user doesn't exist. We don't know what user it is
-						 * and we give up
-						 */
-						return true;
-					}
-					$userspace = $user->getName();
-					$Avatar = BlogAvatar::newFromUserName( $userspace );
-				} else {
-					$userspace = $wgUser->getName();
-					$Avatar = BlogAvatar::newFromUser( $wgUser );
-				}
-			}
-
-			if ($userspace != "") {
-				$isDestinationUserAnon = User::isIP($userspace);
-				$out['userspace'] = $userspace;
-				$out['nav_links_head'] = array();
-
-				$oTitle = Title::newFromText( $userspace, NS_USER );
-				if ($oTitle instanceof Title) {
-					$out['nav_links'][] = array('text' => wfMsg('nstab-user'), 'href' => $oTitle->getLocalUrl(), "dbkey" => NS_USER, 'tracker' => 'user');
-				}
-				$oTitle = Title::newFromText( $userspace, NS_USER_TALK );
-				if ($oTitle instanceof Title) {
-					$out['nav_links'][] = array('text' => wfMsg('talkpage'), 'href' => $oTitle->getLocalUrl(), "dbkey" => NS_USER_TALK, 'tracker' => 'usertalk');
-				}
-				if ( defined("NS_BLOG_ARTICLE") && !$isDestinationUserAnon) {
-					$oTitle = Title::newFromText( $userspace, NS_BLOG_ARTICLE );
-					if ($oTitle instanceof Title) {
-						$out['nav_links'][] = array('text' => wfMsg('blog-page'), 'href' => $oTitle->getLocalUrl(), "dbkey" => NS_BLOG_ARTICLE, 'tracker' => 'userblog');
-					}
-				}
-
-				$oTitle = Title::newFromText( "Contributions/{$userspace}", NS_SPECIAL );
-				if ($oTitle instanceof Title) {
-					$out['nav_links'][] = array('text' => wfMsg('contris'), 'href' => $oTitle->getLocalUrl(), "dbkey" => "Contributions", 'tracker' => 'contributions');
-				}
-
-				if ( $wgUser->isLoggedIn() && $wgUser->getName() == $userspace ) {
-					$out['nav_links'][] = array('text' => wfMsg('prefs-watchlist'), 'href' => Title::newFromText("Watchlist", NS_SPECIAL )->getLocalUrl(), "dbkey" => "Watchlist", 'tracker' => 'watchlist');
-					$out['nav_links'][] = array('text' => wfMsg('blog-widgets-label'), 'href' => Title::newFromText("WidgetDashboard", NS_SPECIAL )->getLocalUrl(), "dbkey" => "WidgetDashboard", 'tracker' => 'widget');
-					$out['nav_links'][] = array('text' => wfMsg('preferences'), 'href' => Title::newFromText("Preferences", NS_SPECIAL )->getLocalUrl(), "dbkey" => "Preferences", 'tracker' => 'preferences');
-				} elseif ( !$isAnon && !$isDestinationUserAnon) {
-					$user = User::newFromName($userspace);
-					if ($user) {
-						$destinationUserId = $user->getId();
-						$skin = $wgUser->getSkin();
-						if ($skin->showEmailUser($destinationUserId)) {
-							$oTitle = Title::newFromText( "EmailUser/{$userspace}", NS_SPECIAL );
-							if ($oTitle instanceof Title) {
-								$out['nav_links_head'][] = array('text' => wfMsg("emailpage"), 'href' => $oTitle->getLocalUrl(), "dbkey" => "Emailuser", 'tracker' => 'emailuser');
-							}
-						}
-					}
-					if ($wgUser->isAllowed( 'block' )) {
-						$oTitle = Title::newFromText( "Block/{$userspace}", NS_SPECIAL );
-						if ($oTitle instanceof Title) {
-							$out['nav_links_head'][] = array('text' => wfMsg("blockip"), 'href' => $oTitle->getLocalUrl(), "dbkey" => "Blockip", 'tracker' => 'blockip');
-						}
-					}
-				}
-
-				$tmpl = new EasyTemplate( dirname( __FILE__ ) . '/templates/' );
-				$tmpl->set_vars( array(
-					'data'      => $out,
-					"avatar"    => $Avatar,
-					"current"   => $dbKey,
-					"userspace" => $userspace,
-				));
-				echo $tmpl->execute('UserMasthead');
-			}
-		}
-		return true;
-	}
-}
-
-class BlogAvatarRemovePage extends SpecialPage {
-	var $mAvatar;
-	var $mTitle;
-	var $mPosted;
-	var $mUser;
-	var $mCommitRemoved;
-
-	#--- constructor
-	public function __construct() {
-		wfLoadExtensionMessages( "Blogs" );
-		$this->mPosted = false;
-		$this->mCommitRemoved = false;
-		$this->mSysMsg = false;
-		$this->mTitle = Title::makeTitle( NS_SPECIAL, "RemoveAvatar" );
-		parent::__construct( "RemoveAvatar", 'removeavatar');
-	}
-
-	public function execute() {
-		global $wgUser, $wgOut, $wgRequest;
-		wfProfileIn( __METHOD__ );
-
-		if ( $wgUser->isBlocked() ) {
-			$wgOut->blockedPage();
-			wfProfileOut( __METHOD__ );
-			return;
-		}
-		if ( wfReadOnly() ) {
-			$wgOut->readOnlyPage();
-			wfProfileOut( __METHOD__ );
-			return;
-		}
-		if ( !$wgUser->isLoggedIn() ) {
-			$this->displayRestrictionError();
-			wfProfileOut( __METHOD__ );
-			return;
-		}
-		if ( !$wgUser->isAllowed( 'removeavatar' ) ) {
-			$this->displayRestrictionError();
-			wfProfileOut( __METHOD__ );
-			return;
-		}
-
-		$wgOut->setPageTitle( wfMsg("blog-avatar-removeavatar") );
-
-		if ($wgRequest->getVal("action") === "search_user") {
-			$this->mPosted = true;
-		}
-
-		if ($wgRequest->getVal("action") === "remove_avatar") {
-			$this->mCommitRemoved = true;
-		}
-
-		wfProfileOut( __METHOD__ );
-		$this->removeForm();
-	}
-
-	private function removeForm() {
-		global $wgUser, $wgOut, $wgRequest;
-
-		if ($this->mPosted) {
-			if ($wgRequest->getVal("av_user")) {
-				$avUser = User::newFromName($wgRequest->getVal("av_user"));
-				if ($avUser->getID() !== 0) {
-					$this->mAvatar = BlogAvatar::newFromUser($avUser);
-					$this->mUser = $avUser;
-				}
-			}
-		}
-
-		if ($this->mCommitRemoved) {
-			if ($wgRequest->getVal("av_user")) {
-				$avUser = User::newFromName($wgRequest->getVal("av_user"));
-				if ($avUser->getID() !== 0) {
-					$this->mAvatar = BlogAvatar::newFromUser($avUser);
-					if (!$this->mAvatar->removeFile($avUser->getID())) {
-						$this->iStatus = "WMSG_REMOVE_ERROR";
-					}
-					$this->mUser = $avUser;
-					$this->mPosted = true;
-				}
-			}
-		}
-
-		$oTmpl = new EasyTemplate( dirname( __FILE__ ) . "/templates/" );
-		$oTmpl->set_vars( array(
-			"title"     	=> $this->mTitle,
-			"avatar"   	 	=> $this->mAvatar,
-			"search_user"	=> $wgRequest->getVal("av_user"),
-			"user"			=> $this->mUser,
-			"is_posted" 	=> $this->mPosted,
-			"status"    	=> $iStatus
-		));
-		$wgOut->addHTML( $oTmpl->execute("remove-avatar-form") );
-	}
-}
Index: BlogComments.php
===================================================================
--- BlogComments.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ BlogComments.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -17,6 +17,8 @@
 $wgHooks[ "ArticleDeleteComplete" ][] = "BlogCommentList::articleDeleteComplete";
 $wgHooks[ "ArticleRevisionUndeleted" ][] = "BlogCommentList::undeleteComments";
 $wgHooks[ "UndeleteComplete" ][] = "BlogCommentList::undeleteComplete";
+$wgHooks[ "RecentChange_save" ][] = "BlogCommentList::watchlistNotify";
+# recentchanges
 $wgHooks[ "ChangesListMakeSecureName" ][] = "BlogCommentList::makeChangesListKey";
 $wgHooks[ "ChangesListHeaderBlockGroup" ][] = "BlogCommentList::setHeaderBlockGroup";
 
@@ -254,7 +256,7 @@
 				"title"     => $this->mTitle,
 				"author"    => $this->mUser,
 				"anchor"    => $anchor,
-				"avatar"    => BlogAvatar::newFromUser( $this->mUser )->display( 50, 50 ),
+				"avatar"    => Masthead::newFromUser( $this->mUser )->display( 50, 50 ),
 				"hidden"    => $hidden,
 				"timestamp" => $wgContLang->timeanddate( $this->mFirstRevision->getTimestamp() )
 			);
@@ -331,16 +333,18 @@
 		}
 
 		$devel    = 1; #$wgCityId == 4832 || $wgDevelEnvironment;
+		$res = false;
+		if ( $this->mUser ) {
+			$isAuthor = ($this->mUser->getId() == $wgUser->getId()) && (!$wgUser->isAnon());
+			$canEdit   = $wgUser->isAllowed( "edit" );
 
-		$isAuthor = $this->mUser->getId() == $wgUser->getId() && ! $wgUser->isAnon();
-		$isOwner  = $this->mOwner->getId() == $wgUser->getId();
+			$groups = $wgUser->getGroups();
+			$isAdmin = in_array( 'staff', $groups ) || in_array( 'sysop', $groups );
+			
+			$res = $devel && ( $isAuthor || $isAdmin ) && $canEdit;
+		} 
 
-		$canEdit   = $wgUser->isAllowed( "edit" );
-
-		$groups = $wgUser->getGroups();
-		$isAdmin = in_array( 'staff', $groups ) || in_array( 'sysop', $groups );
-
-		return $devel && ( $isAuthor || $isAdmin ) && $canEdit;
+		return $res;
 	}
 
 	/**
@@ -990,7 +994,7 @@
 		 * $pages is array of comment articles
 		 */
 		$owner     = $this->mTitle->getBaseText();
-		$avatar    = BlogAvatar::newFromUser( $wgUser );
+		$avatar    = Masthead::newFromUser( $wgUser );
 		$isSysop   = ( in_array('sysop', $wgUser->getGroups()) || in_array('staff', $wgUser->getGroups() ) );
 		$isOwner   = ( $owner == $wgUser->getName() );
 		$canEdit   = $wgUser->isAllowed( "edit" );
@@ -1198,6 +1202,22 @@
 		wfProfileOut( __METHOD__ );
 		return true;
 	}
+
+	/**
+	 * Hook
+	 *
+	 * @param Title $oTitle -- instance of Title class
+	 * @param User    $User    -- current user
+	 * @param string  $reason  -- undeleting reason
+	 *
+	 * @static
+	 * @access public
+	 *
+	 * @return true -- because it's hook
+	 */
+	static public function watchlistNotify ( RecentChange &$oRC ) {
+		return true;
+	}
 	
 	/**
 	 * Hook
Index: BlogTemplate.php
===================================================================
--- BlogTemplate.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ BlogTemplate.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -1103,6 +1103,21 @@
 		return $sPager;
 	}
 
+	public static function getSubpageText(Title $Title) {
+		if ( !$Title instanceof Title ) {
+			return "";
+		}
+		$parts = explode( '/', $Title->getText() );
+		$res = ""; $cnt = count( $parts );
+		if ( $cnt == 2 ) {
+			$res = $parts[ $cnt - 1 ];
+		} else {
+			array_shift($parts);
+			$res = implode( '/', $parts );
+		}
+		return $res;
+	}
+
 	public static function axShowCurrentPage ($articleId, $namespace, $offset) {
 		global $wgParser;
 		wfProfileIn( __METHOD__ );
@@ -1155,5 +1170,4 @@
 		wfProfileOut( __METHOD__ );
 		return $result;
 	}
-
 }
Index: css/Blogs.css
===================================================================
--- css/Blogs.css	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ css/Blogs.css	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -292,103 +292,8 @@
 margin:0;
 }
 
-#user_masthead {
-background:#d2d2b6;
-color: #000;
-font-size:10pt;
-margin:2px 2px 0;
-padding:4px;
-}
 
-#user_masthead h2 {
-font-size:14pt;
-margin:0 0 3px;
-float:left;
-position:relative;
-top:7px;
-}
 
-#user_masthead ul.nav_links li {
-float:left;
-font-size:9pt;
-font-weight:700;
-padding:5px;
-}
-
-#user_masthead ul.nav_links li.selected {
-background:#f2f2da;
--moz-border-radius:5px;
-border-radius:5px;
--webkit-border-radius:5px;
-}
-
-#user_masthead li a {
-color:#333;
-}
-
-#user_masthead li a.new {
-color:inherit;
-}
-
-#user_masthead_head {
-height: 2.5em;
-}
-
-#user_masthead_head ul.nav_links_head {
-position:relative;
-top:10px;
-left:10px;
-}
-
-#user_masthead_head ul.nav_links_head li {
-float:left;
-font-size:8pt;
-padding:5px;
-position:relative;
-}
-
-/* page-specific head links */
-.nav_links_head {
-	margin: 0;
-	padding: 0;
-}
-.nav_links_head li {
-	line-height: 1.5em;
-	padding: 2px 0;
-	position: relative;
-	font-size: 8pt;
-	float: left;
-	margin-right: 2px;
-	overflow: hidden !important; /* Opera fix */
-}
-.nav_links_head li div {
-	display: inline;
-	position: relative;
-	margin-left: 14px;
-}
-.nav_links_head img.sprite {
-	background: url(http://images.wikia.com/common/skins/monaco/images/sprite.png);
-	height: 16px;
-	margin-right: 16px;
-	position: absolute;
-	width: 464px;
-}
-/* fix for IE6 */
-* html .nav_links_head img.sprite {
-	background-image: none;
-	filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://images.wikia.com/common/skins/monaco/images/sprite.png', sizingMethod='crop');
-}
-#mt_emailuser_icon,
-#mt_emailuser_img {
-	clip: rect(0px 464px 16px 448px);
-	left: -448px;
-}
-#mt_blockip_icon,
-#mt_blockip_img {
-	clip: rect(0px 96px 16px 80px);
-	left: -80px;
-}
-
 div.blog-comm-input {
 background:#d2d2b6;
 padding:10px;
@@ -415,25 +320,6 @@
 font-size:10pt;
 }
 
-avatarOverlayRight {
-right:5px;
-top:5px;
-}
-
-.avatarOverlay {
-border:1px solid #000;
-position:absolute;
-top:0;
-margin:6px -6px;
-padding:3px;
-z-index:100;
-}
-
-.avatarOverlay span {
-cursor:pointer;
-margin:0 3px;
-}
-
 div.wk_blogs_panel .wk_blogs_date,#blog-comments .comment strong {
 font-weight:700;
 }
@@ -450,13 +336,3 @@
 clip:rect(0px,16px,16px,0px);
 left:0;
 }
-
-#user_masthead .avatar,div.blog-comment .avatar {
-background:#FFF;
-border:1px solid #666;
-float:left;
-height:50px;
-margin-right:5px;
-width:50px;
-padding:2px;
-}
Index: BlogLockdown.php
===================================================================
--- BlogLockdown.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ BlogLockdown.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -104,6 +104,12 @@
 				}
 				break;
 
+			case "autopatrol":
+			case "patrol":
+				$result = true;
+				$return = true;
+				break;
+
 			default:
 				/**
 				 * for other actions we demand that user has to be logged in
Index: Blogs.php
===================================================================
--- Blogs.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ Blogs.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -121,9 +121,6 @@
 /**
  * load other parts
  */
-if (empty($wgWikiaEnableUserMasthead)) {
-	$wgWikiaEnableUserMasthead = true;
-}
 include( dirname( __FILE__ ) . "/SpecialBlogPage.php");
 include( dirname( __FILE__ ) . "/BlogTemplate.php");
 include( dirname( __FILE__ ) . "/BlogArticle.php");
Index: templates/UserMasthead.tmpl.php
===================================================================
--- templates/UserMasthead.tmpl.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ templates/UserMasthead.tmpl.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -1,47 +0,0 @@
-<?php
-global $wgStyleVersion, $wgExtensionsPath, $wgTitle, $wgUser;
-
-if ($wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK) {
-	global $wgTitle;
-	$userMastheadName = $wgTitle;
-}
-if ($wgTitle == 'Special:Watchlist') {
-	$userMastheadName = $wgUser->getName();
-}
-
-?>
-
-<div id="user_masthead" class="reset clearfix">
-	<?php echo $avatar->display( 50, 50, false, "avatar", false, ( ( $userspace == $wgUser->getName() ) || ( $wgUser->isAllowed( 'removeavatar' ) && ( !$avatar-> isDefault() ) ) ), 'usermasthead/user' ) ?>
-<? if ( ( $userspace == $wgUser->getName() ) || ( $wgUser->isAllowed( 'removeavatar' ) ) ) { ?>
-	<span class="avatarOverlay color1" style="visibility: hidden;" id="wk-avatar-change" onmouseover="this.style.visibility='visible';" onmouseout="this.style.visibility='hidden';">
-<? if ( $userspace == $wgUser->getName() ) { ?>	
-		<span onclick="WET.byStr('usermasthead/editavatar');javascript:location='<?php echo Title::newFromText("Preferences", NS_SPECIAL)->getLocalUrl(); ?>'"><?=wfMsg('blog-avatar-edit')?></span>
-<? } ?>
-<? if ( ( $wgUser->isAllowed( 'removeavatar' ) ) && ( !$avatar-> isDefault() ) ) { ?>	
-		<span onclick="WET.byStr('usermasthead/removeavatar');javascript:location='<?php echo Title::newFromText("RemoveAvatar", NS_SPECIAL)->getLocalUrl("action=search_user&av_user={$avatar->getUserName()}"); ?>'"><?=wfMsg('blog-avatar-delete')?></span>
-<? } ?>		
-	</span>
-<? } ?>
-	<div id="user_masthead_head" class="clearfix">
-		<h2><?=$data['userspace']?></h2>
-		<?php if (!empty($data["nav_links_head"])): ?>
-		<ul class="nav_links_head">
-			<?
-			global $wgStylePath;
-			foreach( $data['nav_links_head'] as $navLink ) {
-				$id = strtolower($navLink['dbkey']);
-				echo '<li id="mt_' . $id . '"><a id="mt_' . $id . '_icon" href="'. $navLink['href'] .'" onclick="WET.byStr(\'usermasthead/' . $navLink['tracker'] . '\')" rel="nofollow"><img id="mt_' . $id . '_img" class="sprite" src="' . $wgStylePath . '/monobook/blank.gif" alt="'. $navLink['text'] .'"/></a> <div><a id="mt_' . $id . '_link" href="'. $navLink['href'] .'" onclick="WET.byStr(\'usermasthead/' . $navLink['tracker'] . '\')">'. $navLink['text'] .'</a></div></li>';
-			}
-			?>
-		</ul>
-		<?php endif; ?>
-	</div>
-	<ul class="nav_links">
-		<?
-		foreach( $data['nav_links'] as $navLink ) {
-			echo "<li ". ( ( $current  == $navLink[ "dbkey" ]) ? 'class="selected">' : ">" ) . '<a href="'. $navLink['href'] .'" onclick="WET.byStr(\'usermasthead/' . $navLink['tracker'] . '\')" rel="nofollow">'. $navLink['text'] .'</a></li>';
-		}
-		?>
-	</ul>
-</div>
Index: templates/pref-avatar-form.tmpl.php
===================================================================
--- templates/pref-avatar-form.tmpl.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ templates/pref-avatar-form.tmpl.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -1,102 +0,0 @@
-<!-- s:<?= __FILE__ ?> -->
-<tr><td class="pref-label" colspan="2"><h2><?=wfMsg('blog-avatar-preferences-title')?></h2></td></tr>
-<tr>
-<td class="pref-input" colspan="2">
-<table border="0" width="50" valign="top">
-<tr>
-	<td valign="top">
-		<table style="border:1px solid #DFDFDF;margin:8px 2px;width:<?=$imgW?>px;height:<?=$imgH?>px;">
-		    <tr><td valign="middle" align="center"><img src="<?=$sUserImg?>" border="0" /></td></tr>
-		</table>
-	</td>
-	<td><div style="text-align:left;padding:3px;">
-		<div style="text-align:left;padding:3px;" id="wkUserChooseDivText"></div>
-		<input type="hidden" name="wkDefaultAvatar" id="wkDefaultAvatar" value="" >
-		<script type="text/javascript">
-		/*<![CDATA[*/
-		YAHOO.util.Event.onDOMReady(function () {
-			if (document.createTextNode) {
-				var defaultAvatar = YAHOO.util.Dom.get("wkDefaultAvatar");
-				var listDiv = YAHOO.util.Dom.get("wkDefaultAvatarList");
-				if (!listDiv && !defaultAvatar) {
-					return;
-				}
-				var imgs = new Array();
-<? if ( !empty($aDefAvatars) && is_array($aDefAvatars) ) { $loop = 0; foreach ($aDefAvatars as $id => $sDefAvatarUrl) { ?>
-				imgs[<?=$loop?>] = document.createElement('img');
-				imgs[<?=$loop?>].src = '<?=$sDefAvatarUrl?>';
-				imgs[<?=$loop?>].style.border = '2px solid #FFFFFF';
-				imgs[<?=$loop?>].style.margin = '2px';
-				imgs[<?=$loop?>].style.cursor = 'pointer';
-				imgs[<?=$loop?>].setAttribute('width', '40');
-				imgs[<?=$loop?>].setAttribute('height', '40');
-				imgs[<?=$loop?>].onclick = function() {
-					clearBorders();
-					clearUploadAvatar();
-					if (defaultAvatar.value == this.src) {
-						this.style.border = '2px solid #FFFFFF';
-						defaultAvatar.value = "";
-					} else {
-						this.style.border = '2px solid #008000';
-						defaultAvatar.value = this.src;
-					}
-				}
-				listDiv.appendChild(imgs[<?=$loop?>]);
-<? $loop++; } } ?>
-
-				var chooseDivTxt = YAHOO.util.Dom.get("wkUserChooseDivText");
-				if (chooseDivTxt) {
-					chooseDivTxt.innerHTML = "<?=wfMsg('blog-avatar-choose-avatar')?>";
-				}
-
-				var uploadDivTxt = YAHOO.util.Dom.get("wkUserUploadDivText");
-				if (uploadDivTxt) {
-					uploadDivTxt.innerHTML = "<?=wfMsg('blog-avatar-upload-avatar')?>";
-				}
-
-				var uploadDiv = YAHOO.util.Dom.get("wkUserUploadDiv");
-				if (uploadDiv) {
-					uploadFile = document.createElement('input');
-					uploadFile.setAttribute('type', 'file');
-					uploadFile.setAttribute('name', '<?=$sFieldName?>');
-					uploadFile.setAttribute('id', '<?=$sFieldName?>');
-					uploadFile.onchange = function() {
-						clearBorders();
-						clearDefaultAvatar();
-					}
-					uploadDiv.appendChild(uploadFile);
-				}
-
-				function clearBorders() {
-					if (imgs && imgs.length > 0) {
-						for (var i in imgs) {
-							imgs[i].style.border = '2px solid #FFFFFF';
-						}
-					}
-				}
-				function clearDefaultAvatar() {
-					var defaultAvatar = YAHOO.util.Dom.get("wkDefaultAvatar");
-					if (defaultAvatar) {
-						defaultAvatar.value = "";
-					}
-				}
-				function clearUploadAvatar() {
-					var uploadAvatar = YAHOO.util.Dom.get("wkUserAvatar");
-					if (uploadAvatar) {
-						uploadAvatar.value = "";
-					}
-				}
-			}
-		});
-		</script>
-		</div>
-		<div style="padding:3px;" id="wkDefaultAvatarList"></div>
-		<div style="text-align:left;padding:3px;" id="wkUserUploadDivText"></div>
-		<div style="text-align:left;padding:3px;" id="wkUserUploadDiv"></div>
-	</td>
-</tr>
-</table>
-</td>
-</tr>
-<tr><td colspan="2"><?=wfMsg('blog-avatar-save-info')?></td></tr>	
-<!-- e:<?= __FILE__ ?> -->	
Index: templates/remove-avatar-form.tmpl.php
===================================================================
--- templates/remove-avatar-form.tmpl.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ templates/remove-avatar-form.tmpl.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -1,93 +0,0 @@
-<!-- s:<?= __FILE__ ?> -->
-<!-- css part -->
-<style type="text/css">
-/*<![CDATA[*/
-#wba-upload {border: 1px solid lightgrey;margin: 1em; padding: 1em;}
-#wba-upload li {display: inline; padding-left: 2em;}
-/*]]>*/
-</style>
-<!-- js part -->
-<script type="text/javascript">
-/*<![CDATA[*/
-YAHOO.namespace("Blog.Avatar");
-
-var YC = YAHOO.util.Connect;
-var YD = YAHOO.util.Dom;
-var YE = YAHOO.util.Event;
-var WA = YAHOO.Blog.Avatar;
-
-YAHOO.Blog.Avatar.Submit = function(e) {
-    YAHOO.util.Dom.get("wba-search-form").submit();
-}
-
-YAHOO.Blog.Avatar.SubmitRemove = function(e) {
-	if (confirm("<?= wfMsg("blog-avatar-remove-confirm") ?>")) {
-		YAHOO.util.Dom.get("wba-remove-form").submit();
-	} else {
-		YAHOO.util.Event.stopEvent(e);
-	}
-}
-YE.addListener("wba-search-user", "click", YAHOO.Blog.Avatar.Submit);
-YE.addListener("wba-remove-user", "click", YAHOO.Blog.Avatar.SubmitRemove);
-
-/*]]>*/
-</script>
-<?
-if (isset($status) && ($status == "WMSG_REMOVE_ERROR"))
-{
-?>
-<div id="wba-upload">
-    <div style="float:left;padding:2px;text-align:center;">
-    	<?= wfMsg("blog-avatar-cannot-remove") ?>
-    </div>	
-</div>
-<?
-}
-?>
-<div id="wba-upload">
-    <div style="float:left;padding:5px 2px;text-align:left;">
-    	<?= wfMsg("blog-avatar-remove-info") ?>
-    </div>	
-	<div style="clear: both;"></div>    
-	<div>
-		<form id="wba-search-form" enctype="multipart/form-data" action="<?= $title->getLocalUrl() ?>" method="post">
-			<input type="hidden" name="action" value="search_user" />
-			<input type="text" name="av_user" size="25" value="<?= $search_user ?>">
-			<input type="submit" name="wpSubmit" id="wba-search-user" value="<?= wfmsg("blog-avatar-getuser") ?>">
-		</form>            
-	</div>
-</div>
-<div style="clear: both;"></div>    
-<? if ($user && $is_posted) { ?>
-<div id="wba-upload">
-    <div style="text-align: center;padding: 5px;">
-        <div style="text-align:center;padding: 5px;font-weight:bold"><?= $user->getName() ?></div>
-        <div style="text-align: center;"><?= $avatar->getImageTag( 100, 100 )?></div>
-    </div>
-	<div style="clear: both;"></div>
-    <div style="text-align: center;padding: 5px;">
-<?if (!$avatar->isDefault()) { ?>
-        <form id="wba-remove-form" enctype="multipart/form-data" action="<?= $title->getLocalUrl() ?>" method="post">
-            <input type="hidden" name="action" value="remove_avatar" />
-            <input type="hidden" name="av_user" value="<?= $user->getName() ?>">
-            <input type="submit" name="wpSubmit" id="wba-remove-user" value="<?= wfmsg("blog-avatar-removeavatar") ?>">
-<? } ?>    
-    		<input type="button" value="<?= wfMsg("blog-avatar-goto-userpage", $user->getName()) ?>" onclick="window.location='<?= Title::makeTitle( NS_USER, $user->getName() )->getLocalUrl(); ?>'" />
-<?if (!$avatar->isDefault()) { ?>
-		</form> 
-<? } ?>    
-	</div>
-	<div style="clear: both;"></div>    
-</div>
-<? } else if ($is_posted) { ?>	
-<div>
-    <span style="float:left;padding:5px;text-align:center;">
-    	<strong><?= wfMsg("blog-avatar-nouser") ?></strong>
-    </span>
-</div>    
-<? } ?>
-
-<div style="clear: both;"></div>    
-<div id="wba-result">
-</div>
-<!-- e:<?= __FILE__ ?> -->
Index: templates/blog-post-page.tmpl.php
===================================================================
--- templates/blog-post-page.tmpl.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ templates/blog-post-page.tmpl.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -14,7 +14,7 @@
 		$isCommenting = $aRow['props']['commenting'];
 	}
 ?>
-<li class="list"><div class="wk_blogs_link"><a href="<?=$oTitle->getLocalUrl()?>"><?=$oTitle->getSubpageText()?></a></div>
+<li class="list"><div class="wk_blogs_link"> <a href="<?=$oTitle->getLocalUrl()?>"><?=BlogTemplateClass::getSubpageText($oTitle)?></a></div>
 <?
 /* s: TIMESTAMP */
 	if ( !empty($aOptions['timestamp']) ) {
Index: templates/blog-page.tmpl.php
===================================================================
--- templates/blog-page.tmpl.php	(.../releases/200909.3/extensions/wikia/Blogs)	(revision 12908)
+++ templates/blog-page.tmpl.php	(.../trunk/extensions/wikia/Blogs)	(revision 12908)
@@ -19,7 +19,7 @@
 	}
 ?>
 <li style="line-height:normal;margin:0;padding:0;">
-<div class="wk_blogs_link"><a href="<?=$oTitle->getLocalUrl()?>"><?=$oTitle->getSubpageText()?></a></div>
+<div class="wk_blogs_link"><a href="<?=$oTitle->getLocalUrl()?>"><?=BlogTemplateClass::getSubpageText($oTitle)?></a></div>
 <?
 /* s: TIMESTAMP */
 	if ( !empty($aOptions['timestamp']) ) {

Property changes on: .
___________________________________________________________________
Deleted: svn:mergeinfo
   Reverse-merged /wikia/branches/MyHome/extensions/wikia/Blogs:r11167,11390-11391,11399
   Reverse-merged /wikia/trunk/extensions/wikia/Blogs:r11186-12136,12777-12783,12859
   Reverse-merged /wikia/branches/emil/extensions/wikia/Blogs:r12252-12260
   Reverse-merged /wikia/branches/Marooned/PageSpecificLinks/extensions/wikia/Blogs:r10218-10613
   Reverse-merged /wikia/branches/WysiwygDevCycleL/extensions/wikia/Blogs:r10021-10462

