Skocz do zawartości

Rekomendowane odpowiedzi

Opublikowano (edytowane)

Witam,

Podczas instalacji CommunitySeo mam kilka problemów - wrzuciłem pliki instalacyjne na serwer - zainstalowałem i teraz zostało mi ręczne przerabianie plików tak jak to jest napisane tutaj:

=============================================================================================================
STEP 2 :: Modififying Files
-------------------------------------------------------------------------------------------------------------
IpsRegistry.php
-------------------------------------------------------------------------------------------------------------
Then find
-------------------------------------------------------------------------------------------------------------

/**
 * INIT furls
 * Performs set up and figures out any incoming links
 *
 * @access	private
 * @return	void
 */
private static function _fUrlInit()
{
	/**
	 * Don't run if we are in the ACP.  Also, running this causes problems because it will take any data submitted (including in _POST params)
	 * and then loop over it later in this function, recreating query_string_real, which then breaks the params in the ACP in some cases.
	 * @link	http://community.invisionpower.com/tracker/issue-21539-logout-issue/
	 */
	if( IN_ACP )
	{
		return;
	}

	if ( ipsRegistry::$settings['use_friendly_urls'] )
	{
		/* IIS rewrite */
		if( $_SERVER['HTTP_X_ORIGINAL_URL'] )		// IIS 7 with Microsoft Rewrite module
		{
			$_SERVER['REQUEST_URI']	= $_SERVER['HTTP_X_ORIGINAL_URL'];
		}
		else if( $_SERVER['HTTP_X_REWRITE_URL'] )	// IIS with ISAPI_Rewrite
		{
			$_SERVER['REQUEST_URI']	= $_SERVER['HTTP_X_REWRITE_URL'];
		}

		/* Grab and store accessing URL */
		self::$_uri = preg_replace( "/s=(&|$)/", '', str_replace( '/?', '/index.php?', $_SERVER['REQUEST_URI'] ) );

		$_urlBits = array();

		/* Grab FURL data... */
		if ( ! IN_DEV AND file_exists( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' ) )
		{
			require( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' );
			self::$_seoTemplates = $templates;
		}
		else
		{
			/* Attempt to write it */
			self::$_seoTemplates = IPSLib::buildFurlTemplates();

			try
			{
				IPSLib::cacheFurlTemplates();
			}
			catch( Exception $e )
			{
			}
		}

		if ( is_array( self::$_seoTemplates ) AND count( self::$_seoTemplates ) )
		{ 
			if ( !isset( $_SERVER['REQUEST_URI'] ) )
			{
				$_SERVER['REQUEST_URI'] = substr( $_SERVER['PHP_SELF'], 1 );

				if ( isset( $_SERVER['QUERY_STRING'] ) )
				{
					$_SERVER['REQUEST_URI']	.= '?' . $_SERVER['QUERY_STRING'];
				}
			}

			$uri = $_SERVER['REQUEST_URI']  ? $_SERVER['REQUEST_URI']  : @getenv('REQUEST_URI');

			/* Bug 21295 - remove known URL from test URI */
			$_t      = @parse_url( ipsRegistry::$settings['board_url'] );
			$_toTest = ( $_t['path'] AND $_t['path'] != '/' ) ? preg_replace( "#^{$_t['path']}#", '', $uri ) : str_replace( $_t['scheme'] . '://' . $_t['host'], '', $uri );
			$_toTest = str_replace( '/index.php?', '', $_toTest );

			foreach( self::$_seoTemplates as $key => $data )
			{
				if ( ! isset( $data['in']['regex'] ) OR ! $data['in']['regex'] )
				{
					continue;
				}

				if ( preg_match( $data['in']['regex'], $_toTest, $matches ) )
				{ 
					if ( is_array( $data['in']['matches'] ) )
					{
						foreach( $data['in']['matches'] as $_replace )
						{
							$k = IPSText::parseCleanKey( $_replace[0] );

							if ( strpos( $_replace[1], '$' ) !== false )
							{
								$v = IPSText::parseCleanValue( $matches[ intval( str_replace( '$', '', $_replace[1] ) ) ] );
							}
							else
							{
								$v = IPSText::parseCleanValue( $_replace[1] );
							}

							$_GET[ $k ]     = $v;
							$_POST[ $k ]    = $v;
							$_REQUEST[ $k ] = $v;
							$_urlBits[ $k ] = $v;

							ipsRegistry::$request[ $k ]	= $v;
						}
					}

					if ( strpos( $_toTest, self::$_seoTemplates['__data__']['varBlock'] ) !== false )
					{ 
						$_parse = substr( $_toTest, strpos( $_toTest, self::$_seoTemplates['__data__']['varBlock'] ) + strlen( self::$_seoTemplates['__data__']['varBlock'] ) );

						$_data = explode( self::$_seoTemplates['__data__']['varSep'], $_parse );
						$_c    = 0;

						foreach( $_data as $_v )
						{
							if ( ! $_c )
							{
								$k = IPSText::parseCleanKey( $_v );
								$v = '';
								$_c++;
							}
							else
							{
								$v  = IPSText::parseCleanValue( $_v );
								$_c = 0;

								$_GET[ $k ]     = $v;
								$_POST[ $k ]    = $v;
								$_REQUEST[ $k ] = $v;
								$_urlBits[ $k ] = $v;

								ipsRegistry::$request[ $k ]	= $v;
							}
						}
					}

					break;
				}
			}

			//-----------------------------------------
			// If using query string furl, extract any
			// secondary query string.
			// Ex: http://localhost/index.php?/path/file.html?key=value
			// Will pull the key=value properly
			//-----------------------------------------

			$_qmCount = substr_count( $_toTest, '?' );

			if ( $_qmCount > 1 )
			{ 
				$_secondQueryString	= substr( $_toTest, strrpos( $_toTest, '?' ) + 1 );
				$_secondParams		= explode( '&', $_secondQueryString );

				if( count($_secondParams) )
				{
					foreach( $_secondParams as $_param )
					{
						list( $k, $v )	= explode( '=', $_param );

						$k	= IPSText::parseCleanKey( $k );
						$v	= IPSText::parseCleanValue( $v );

						$_GET[ $k ]     = $v;
						$_REQUEST[ $k ] = $v;
						$_urlBits[ $k ] = $v;

						ipsRegistry::$request[ $k ]	= $v;
					}
				}
			}

			/* Process URL bits for extra ? in them */
			if ( is_array( $_GET ) AND count( $_GET ) )
			{
				foreach( $_GET as $k => $v )
				{
					/**
					 * Have to protect against openid_return_to, which will have a valid IPB url in it (breaks openid)
					 */
					if ( ! is_array( $v ) AND strstr( $v, '?') AND $k != 'openid_return_to' )
					{
						list( $rvalue, $more ) = explode( '?', $v );

						if ( $rvalue AND $more )
						{
							//$k	= IPSText::parseCleanKey( $_k );
							$v	= IPSText::parseCleanValue( $_v );

							/* Reset key with correct value */
							$_v = $rvalue;

							$_GET[ $k ]     = $_v;
							$_REQUEST[ $k ] = $_v;
							$_urlBits[ $k ] = $_v;

							ipsRegistry::$request[ $k ]	= $_v;

							/* Now add in the other value */
							if ( strstr( $more, '=' ) )
							{
								list( $_k, $_v ) = explode( '=', $more );

								if ( $_k and $_v )
								{
									$_GET[ $_k ]     = $_v;
									$_REQUEST[ $_k ] = $_v;
									$_urlBits[ $_k ] = $_v;

									ipsRegistry::$request[ $_k ]	= $_v;
								}
							}
						}
					}
				}
			}
		}

		/* Reformat basic URL */
		if ( is_array( $_urlBits ) )
		{
			ipsRegistry::$settings['query_string_real'] = '';

			foreach( $_urlBits as $k => $v )
			{
				ipsRegistry::$settings['query_string_real'] .= '&' . $k . '=' . $v;
			}

			ipsRegistry::$settings['query_string_real'] = trim( ipsRegistry::$settings['query_string_real'], '&' );
		}
	}
}

-------------------------------------------------------------------------------------------------------------
Replace the entire function (from about lines 1160-1282) with
-------------------------------------------------------------------------------------------------------------

/**
 * INIT furls
 * Performs set up and figures out any incoming links
 *
 * @access	private
 * @return	void
 */
private static function _fUrlInit()
{
	/* @MOD */
	if( !ipsRegistry::isClassLoaded('communityseo') )
	{
		require_once( IPSLib::getAppDir( 'communityseo' ) . '/sources/functions.php' );
	}

	$results	= seoFunctions::initFurl();

	self::$_uri				= $results['uri'];
	self::$_seoTemplates	= $results['templates'];
	/* @END MOD */
}

-------------------------------------------------------------------------------------------------------------
Save, close and upload the file
Download, backup, and open "admin/sources/class/output/adminOutput.php"
Find
-------------------------------------------------------------------------------------------------------------

class adminOutput extends output

-------------------------------------------------------------------------------------------------------------
Change this to
-------------------------------------------------------------------------------------------------------------

/* @MOD: CSEO */
//class adminOutput extends output
class adminOutput extends communityseoOutput
/* @MOD END */

-------------------------------------------------------------------------------------------------------------
Save, close and upload the file
-------------------------------------------------------------------------------------------------------------

Odnośnie pierwszej konfiguracji to moja zawartość pliku jest inna - linie też się nie zgadzają - podaje jak to jest u mnie:

	/**
 * INIT furls
 * Performs set up and figures out any incoming links
 *
 * @return	void
 */
private static function _fUrlInit()
{
	/**
	 * Fix request uri
	 */
	self::_fixRequestUri();

	/**
	 * Don't run if we are in the ACP.  Also, running this causes problems because it will take any data submitted (including in _POST params)
	 * and then loop over it later in this function, recreating query_string_real, which then breaks the params in the ACP in some cases.
	 * @link	http://community.invisionpower.com/tracker/issue-21539-logout-issue/
	 */
	if( IN_ACP )
	{
		return;
	}

	if ( ipsRegistry::$settings['use_friendly_urls'] )
	{
		/* Grab and store accessing URL */
		self::$_uri = preg_replace( "/s=(&|$)/", '', str_replace( '/?', '/index.php?', $_SERVER['REQUEST_URI'] ) );

		$_urlBits = array();

		/* Grab FURL data... */
		if ( ! IN_DEV AND file_exists( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' ) )
		{
			$templates = array();
			require( DOC_IPS_ROOT_PATH . 'cache/furlCache.php' );
			self::$_seoTemplates = $templates;
		}
		else
		{
			/* Attempt to write it */
			self::$_seoTemplates = IPSLib::buildFurlTemplates();

			try
			{
				IPSLib::cacheFurlTemplates();
			}
			catch( Exception $e )
			{
			}
		}

		if ( is_array( self::$_seoTemplates ) AND count( self::$_seoTemplates ) )
		{ 
			$uri = $_SERVER['REQUEST_URI']  ? $_SERVER['REQUEST_URI']  : @getenv('REQUEST_URI');

			/* Bug 21295 - remove known URL from test URI */
			$_t        = ( isset(ipsRegistry::$settings['board_url']) AND ipsRegistry::$settings['board_url'] ) ? @parse_url( ipsRegistry::$settings['board_url'] ) : @parse_url( ipsRegistry::$settings['base_url'] );
			$_toTest   = ( $_t['path'] AND $_t['path'] != '/' ) ? preg_replace( "#^{$_t['path']}#", '', $uri ) : str_replace( $_t['scheme'] . '://' . $_t['host'], '', $uri );
			$_404Check = $_toTest; //We want to retain any /index.php for this test later in this block of code
			$_toTest   = str_ireplace( array( '//index.php?', '/index.php?', '/index.php' ), '', $_toTest );
			$_gotMatch = false;

			foreach( self::$_seoTemplates as $key => $data )
			{
				if ( ! isset( $data['in']['regex'] ) OR ! $data['in']['regex'] )
				{
					continue;
				}

				if ( preg_match( $data['in']['regex'], $_toTest, $matches ) )
				{ 
					$_gotMatch = true;

					if ( is_array( $data['in']['matches'] ) )
					{
						foreach( $data['in']['matches'] as $_replace )
						{
							$k = IPSText::parseCleanKey( $_replace[0] );

							if ( strpos( $_replace[1], '$' ) !== false )
							{
								$v = IPSText::parseCleanValue( $matches[ intval( str_replace( '$', '', $_replace[1] ) ) ] );
							}
							else
							{
								$v = IPSText::parseCleanValue( $_replace[1] );
							}

							$_GET[ $k ]     = $v;
							$_POST[ $k ]    = $v;
							$_REQUEST[ $k ] = $v;
							$_urlBits[ $k ] = $v;

							ipsRegistry::$request[ $k ]	= $v;
						}
					}

					if ( strpos( $_toTest, self::$_seoTemplates['__data__']['varBlock'] ) !== false )
					{ 
						$_parse = substr( $_toTest, strpos( $_toTest, self::$_seoTemplates['__data__']['varBlock'] ) + strlen( self::$_seoTemplates['__data__']['varBlock'] ) );

						$_data = explode( self::$_seoTemplates['__data__']['varSep'], $_parse );
						$_c    = 0;

						foreach( $_data as $_v )
						{
							if ( ! $_c )
							{
								$k = IPSText::parseCleanKey( $_v );
								$v = '';
								$_c++;
							}
							else
							{
								$v  = IPSText::parseCleanValue( $_v );
								$_c = 0;

								$_GET[ $k ]     = $v;
								$_POST[ $k ]    = $v;
								$_REQUEST[ $k ] = $v;
								$_urlBits[ $k ] = $v;

								ipsRegistry::$request[ $k ]	= $v;
							}
						}
					}

					break;
				}
			}

			if (
				! defined('CCS_GATEWAY_CALLED')
				AND ! defined('IPS_ENFORCE_ACCESS')
				AND ! defined('LOFIVERSION_CALLED')
				AND IPS_DEFAULT_PUBLIC_APP == 'forums'
				AND $_gotMatch === false
				AND $_toTest
				AND $_toTest != '/'
				AND $_toTest != '/?'
				AND ( strstr( $_404Check, 'index.php?/' ) OR ! strstr( $_404Check, '.php' ) )
				AND ! strstr( $_404Check, '&' )
				AND ! strstr( $_404Check, '=' )
			  )
			{
				self::$_noFurlMatch = true;
			}

			//-----------------------------------------
			// If using query string furl, extract any
			// secondary query string.
			// Ex: http://localhost/index.php?/path/file.html?key=value
			// Will pull the key=value properly
			//-----------------------------------------

			$_qmCount = substr_count( $_toTest, '?' );

			if ( $_qmCount > 1 )
			{ 
				$_secondQueryString	= substr( $_toTest, strrpos( $_toTest, '?' ) + 1 );
				$_secondParams		= explode( '&', $_secondQueryString );

				if( count($_secondParams) )
				{
					foreach( $_secondParams as $_param )
					{
						list( $k, $v )	= explode( '=', $_param );

						$k	= IPSText::parseCleanKey( $k );
						$v	= IPSText::parseCleanValue( $v );

						$_GET[ $k ]     = $v;
						$_REQUEST[ $k ] = $v;
						$_urlBits[ $k ] = $v;

						ipsRegistry::$request[ $k ]	= $v;
					}
				}
			}

			/* Process URL bits for extra ? in them */
			if ( is_array( $_GET ) AND count( $_GET ) )
			{
				foreach( $_GET as $k => $v )
				{
					/**
					 * Have to protect against openid_return_to, which will have a valid IPB url in it (breaks openid)
					 */
					if ( ! is_array( $v ) AND strstr( $v, '?') AND $k != 'openid_return_to' )
					{
						list( $rvalue, $more ) = explode( '?', $v );

						if ( $rvalue AND $more )
						{
							//$k	= IPSText::parseCleanKey( $_k );
							$v	= IPSText::parseCleanValue( $_v );

							/* Reset key with correct value */
							$_v = $rvalue;

							$_GET[ $k ]     = $_v;
							$_REQUEST[ $k ] = $_v;
							$_urlBits[ $k ] = $_v;

							ipsRegistry::$request[ $k ]	= $_v;

							/* Now add in the other value */
							if ( strstr( $more, '=' ) )
							{
								list( $_k, $_v ) = explode( '=', $more );

								if ( $_k and $_v )
								{
									$_GET[ $_k ]     = $_v;
									$_REQUEST[ $_k ] = $_v;
									$_urlBits[ $_k ] = $_v;

									ipsRegistry::$request[ $_k ]	= $_v;
								}
							}
						}
					}
				}
			}
		}

Co do ostatniej modyfikacji to nie mam wogóle takiego folderu jak class/output/adminOutput.php

Edytowane przez ProHax0r
Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.