public function protect( $levels = null, $reason = null, $expiry = 'indefinite', $cascade = false, $watch = null ) {
		global $pgNotag, $pgTag;
		if( !in_array( 'protect', $this->wiki->get_userrights() ) ) {
			pecho( "User is not allowed to protect pages", PECHO_FATAL );
			return false;
		}

		if( $levels === null ){
			$levels = array( 'edit' => 'sysop', 'move' => 'sysop' );
		}

		$tokens = $this->wiki->get_tokens();
		if( !$pgNotag ) $reason .= $pgTag;
		$editarray = array(
			'action'      => 'protect',
			'title'       => $this->title,
			'token'       => $tokens['protect'],
			'reason'      => $reason,
			'protections' => array(),
			'expiry'      => $expiry
		);

		foreach( $levels as $type => $level ){
			$editarray['protections'][] = "$type=$level";
		}

		$editarray['protections'] = implode( "|", $editarray['protections'] );

		if( $cascade ) $editarray['cascade'] = '';

		if( !is_null( $watch ) ) {
			if( $watch ) {
				$editarray['watchlist'] = 'watch';
			} elseif( !$watch ) $editarray['watchlist'] = 'nochange';
			elseif( in_array(
				$watch, array(
					'watch', 'unwatch', 'preferences', 'nochange'
				)
			) ) {
				$editarray['watchlist'] = $watch;
			} else pecho( "Watch parameter set incorrectly.  Omitting...\n\n", PECHO_WARN );
		}
		try{
			$this->preEditChecks( "Protect" );
		} catch( EditError $e ){
			pecho( "Error: $e\n\n", PECHO_FATAL );
			return false;
		}
		if( !$editarray['protections'] == array() ) {
			pecho( "Protecting {$this->title}...\n\n", PECHO_NOTICE );
		} else pecho( "Unprotecting {$this->title}...\n\n", PECHO_NOTICE );

		Hooks::runHook( 'StartProtect', array( &$editarray ) );

		$result = $this->wiki->apiQuery( $editarray, true );

		if( isset( $result['protect'] ) ) {
			if( isset( $result['protect']['title'] ) ) {
				$this->__construct( $this->wiki, $this->title );
				return true;
			} else {
				pecho( "Protect error...\n\n" . print_r( $result['protect'], true ) . "\n\n", PECHO_FATAL );
				return false;
			}
		} else {
			pecho( "Protect error...\n\n" . print_r( $result, true ), PECHO_FATAL );
			return false;
		}
	}