Advanced mod Rewrite 0.2.2 - problém

Vaše dotazy, potíže nebo diskuze k phpBB2 MODům patří sem
Pravidla fóra
Dnem 1.1.2009 oficiálně skončila podpora pro phpBB2. Bezpečnostní aktualizace budou vydávány jen do 1.2.2009. Proto doporučujeme co nejrychleji přejít na aktuální verzi phpBB3, která je ke stažení zde nebo zde.
Uživatelský avatar
R-stick
V.I.P.
V.I.P.
Příspěvky: 907
Registrován: pát 13. led 2006 1:00:00
Bydliště: Vysoké Studnice
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od R-stick » ned 01. črc 2007 13:13:34

Co jsem se koukal, tak kódování máš už v pořádku, ovšem mod ti nepřepisuje korektně v některých tématech. To už si ale budeš muset doladit v té části pro přepisování. Resp zapátrat v databázi, co tam máš za znaky. Něco ti totiž chodí správně a něco ne. - a co máš v databázi tě pomůže nasměrovat.
http://www.rstick.com -bubenické paličky
http://www.sferabubeniku.info - bubenické diskusní fórum.
NEPOSKYTUJI podporu přes soukromé zprávy a mail. => ptejte se na fóru.

Uživatelský avatar
Matador
Příspěvky: 407
Registrován: sob 10. bře 2007 1:00:00
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od Matador » ned 01. črc 2007 13:20:00

Tak jsem to upravil, diakritika taky už funguje, ale u tohoto modu jen na půl.

Nezobrazuje se : ě , ř , č , ú , ů

Tyto nemam vyzkoušené : ď , ť ,

Tyto se zobrazují doře : í , á , ž , š , ý , é ,

Uživatelský avatar
Matador
Příspěvky: 407
Registrován: sob 10. bře 2007 1:00:00
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od Matador » pon 02. črc 2007 10:06:31

Aha nevšiml jsem si R-stickova příspěvku, odeslal jsem svůj a jel jsem na chalupu. Zkusím ten mod nejak poladit, ačkoli nevím jak :-D


PS : Chtěl bych se zeptat, jaký je rozdíl mezi tímto free SEO a placeným, jaké výhody přináší placený oproti free a kolik stojí . Díky

Uživatelský avatar
Matador
Příspěvky: 407
Registrován: sob 10. bře 2007 1:00:00
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od Matador » pon 02. črc 2007 11:10:39

Takže ted už funguje vše správně, udělal jsem postup který je na http://www.phpbbcz.com/navody.php?sid=8 ... 2d415255f4


WhiteWolfSix
Příspěvky: 9436
Registrován: pon 24. črc 2006 0:00:00
Bydliště: 48°43'N, 19°08'E
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od WhiteWolfSix » stř 15. srp 2007 9:51:39

Tento MOD prepisuje linky. Napríklad link tejto témy je:

Kód: Vybrat vše

http://www.phpbb.cz/posting.php?mode=reply&f=5&t=10531
po použití tohto MODu by vyzeral takto:

Kód: Vybrat vše

http://www.phpbb.cz/Advanced_mod_Rewrite_0.2.2.html
WhiteWolfSix (WW6)
Nežiadajte ma o pomoc prostredníctvom icq a SS (SZ)

Uživatelský avatar
smajlik
Příspěvky: 172
Registrován: úte 10. dub 2007 20:56:14
Kontaktovat uživatele:

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od smajlik » ned 14. říj 2007 11:51:35

Ahoj, mam problem s kodovanim u Advanced mod Rewrite 0.2.4 . Vysla nova verze a podle toho vaseho navodu to nejde upravit, protoze je to jine.

Kód: Vybrat vše

<?php
/** 
*
* @package Advanced phpBB SEO mod Rewrite
* @version $Id: phpbb_seo_class.php, 0.2.4 2007/02/07 13:48:48 dcz Exp $
* @copyright (c) 2006 dcz - www.phpbb-seo.com
* @license http://www.opensource.org/licenses/rpl.php RPL Public License 
*
*/

/**
* phpBB_SEO Class
* www.phpBB-SEO.com
* @package Advanced phpBB SEO mod Rewrite
*/
class phpbb_seo {
	var	$modrtype = 0;
	var	$seo_url = array();
	var	$seo_delim = array();
	var	$seo_ext = array();
	var	$seo_static = array();
	var	$seo_path = array();
	var	$seo_url_filter = array();
	var	$seo_stats = array();
	var	$get_var = array();
	var	$path = "";
	var	$start = "";
	var	$filename = "";
	var	$file = "";
	var	$url_in = "";
	var	$url = "";
	var	$page_url = "";
	var	$seo_opt = array();
	var	$encoding = "iso-8859-1";
	/**
	* constuctor
	*/
	function phpbb_seo() {
		global $phpEx, $board_config;
		// config
		$this->encoding = "iso-8859-1";
		$this->modrtype =  3; // 3 = Advanced
		$this->start = '';
		// --> DOMAIN SETTING <-- //
		// NOTE : If you add already declared a PHPBB_URL constant in common.php,
		// you should get rid of it and let this part do it instead.
		// You can hard-code the data to save process.
		$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
		$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
		$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
		// $this->seo_path['phpbb_script'] should be = '' if phpbb is installed in the domain's root
		// 'phpbb/' in case it's installed in the phpbb/ folder.
		$this->seo_path['phpbb_script'] = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
		$this->seo_path['phpbb_script'] = ($this->seo_path['phpbb_script'] == '') ? '' : $this->seo_path['phpbb_script'] . '/';
		// Domain URL 
		$this->seo_path['root_url'] = $server_protocol . $server_name . $server_port . '/';
		$this->seo_path['phpbb_url'] = $this->seo_path['root_url'] . $this->seo_path['phpbb_script'];
		// Populate the $seo_path['PathToUrl'] array for multifolder setups handling.
		// Pattern is $this->seo_path['PathToUrl']['phpbb/'] = "http://www.example.com/phpbb/";
		$this->seo_path['PathToUrl'][$this->seo_path['phpbb_script']] = $this->seo_path['phpbb_url'];
		// URL Settings
		$this->seo_url = array( 'cat' =>  array(), 
			'forum' =>  array(), 
			'topic' =>  array(), 
			'user' => array(),
		);
		$this->seo_delim = array('cat' => '-c', 
			'forum' => '-f', 
			'topic' => '-t', 
			'user' => '-u',
			// Rss
			'rss_forum' => '-rf',
			// Google
			'google_forum' => '-gf'
		);
		$this->seo_ext = array('cat' => '.html', 
			'forum' => '.html', 
			'topic' => '.html', 
			'user' => '.html',
			'gz_ext' => '',
		);
		$this->seo_static = array('cat' => 'cat', 
			'forum' => 'forum', 
			'topic' => 'topic', 
			'post' => 'post', 
			'user' => 'member',
			'start' => '-', 
			'gz_ext' => '.gz',
			'index' => ''
		);
		if ($board_config['default_lang'] === 'french') {
			$this->seo_static['user'] = 'membre';
		}
		// URL Filters
		$this->phpbb_filter = array('postdays' => 0, 'topicdays' => 0, 'postorder' => 'asc', 'highlight' => '');
		// Stop files
		$this->seo_stop_files = array("posting", "privmsg", "faq", "groupcp", "memberlist", "login", "search");
		// Stop vars
		$this->seo_stop_vars = array("view=", "mark=");

		return;
	}

	// --> URL rewriting functions <--
	/**
	* Prepare Titles for URL injection
	*/
	function format_url( $url, $type = 'topic' ) {
		$url = preg_replace("`\[.*\]`U","",$url);
		$url = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$url);
		$url = htmlentities($url, ENT_COMPAT, $this->encoding);
		$url = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i","\\1", $url );
		$url = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $url);
		$url = ( $url == "" ) ? $type : strtolower(trim($url, '-'));
		return $url;
	}
	/**
	* Rewrite URLs.
	* Allow adding of many more cases than just the
	* regular phpBB URL rewritting without slowing up the process.
	*/
	function url_rewrite($url, $non_html_amp = FALSE) {
		global $phpEx;
		$this->url = $this->url_in = $url;
		if ( strpos($this->url, ".$phpEx") === FALSE || defined('IN_ADMIN') || defined('IN_LOGIN') ) {
			return $url;
		}
		// Grabb params
		$this->url = str_replace('&', '&', $this->url);
		$parsed_url = @parse_url($this->url);
		parse_str($parsed_url['query'], $this->get_vars);
		$this->file = basename($parsed_url['path']);
		$this->path = trim(trim(dirname($parsed_url['path']), "."),  "/");
		$this->path = (!empty($this->path)) ? ( isset( $this->seo_path['PathToUrl'][$this->path . '/'] ) ? $this->seo_path['PathToUrl'][$this->path . '/'] : $this->path . '/' ) : '';
		$this->filename = trim(str_replace(".$phpEx", "", $this->file));
		if ( in_array($this->filename, $this->seo_stop_files) ) {
			return $url;
		}
		// Reset $url
		$this->url = $this->file;
		if ( @method_exists($this, $this->filename) ) {
			$this->{$this->filename}();
			// Assamble URL
			$this->url .= $this->query_string($this->get_vars);
			//$this->url = (!$non_html_amp) ? str_replace('&', '&', $this->url) : $this->url;
			return $this->path . $this->url . ((!empty($parsed_url['fragment'])) ? "#" . $parsed_url['fragment'] : '');
		} else {
			return $url;
		}
	}
	/**
	* Set the $start var proper
	* @access private
	*/
	function seo_pagination() {
		$this->start = intval($this->get_vars['start']);
		$this->start = ( $this->start > 0  ) ? $this->seo_static['start'] . $this->get_vars['start'] : '';
		unset($this->get_vars['start']);
	}
	/**
	* URL rewritting for viewtopic.php
	* @access private
	*/
	function viewtopic() {
		$this->filter_url($this->seo_stop_vars);
		if ( !empty($this->get_vars[POST_TOPIC_URL]) && !empty($this->seo_url['topic'][$this->get_vars[POST_TOPIC_URL]]) ) {
			// Filter default params
			$this->filter_get_var($this->phpbb_filter);
			$this->seo_pagination();
			$this->url = $this->seo_url['topic'][$this->get_vars[POST_TOPIC_URL]] . $this->seo_delim['topic'] . $this->get_vars[POST_TOPIC_URL] . $this->start . $this->seo_ext['topic'];
			unset($this->get_vars[POST_TOPIC_URL]);
		} elseif ( !empty($this->get_vars[POST_POST_URL]) ) {
			$this->url =  $this->seo_static['post'] . $this->get_vars[POST_POST_URL] . $this->seo_ext['topic'];
			unset($this->get_vars[POST_POST_URL]);
		}
		return;
	}
	/**
	* URL rewritting for viewforum.php
	* @access private
	*/
	function viewforum() {
		$this->filter_url($this->seo_stop_vars);
		if ( !empty($this->get_vars[POST_FORUM_URL]) && !empty($this->seo_url['forum'][$this->get_vars[POST_FORUM_URL]]) ) {
			// Filter default params
			$this->filter_get_var($this->phpbb_filter);
			$this->seo_pagination();
			$this->url = $this->seo_url['forum'][$this->get_vars[POST_FORUM_URL]] . $this->seo_delim['forum'] . $this->get_vars[POST_FORUM_URL] . $this->start . $this->seo_ext['forum'];
			unset($this->get_vars[POST_FORUM_URL]);
		}
		return;
	}
	/**
	* URL rewritting for profile.php
	* @access private
	*/
	function profile() {
		if ( !empty($this->get_vars[POST_USERS_URL]) && $this->get_vars['mode'] === 'viewprofile') {
			$this->url =  $this->seo_static['user'] . $this->get_vars[POST_USERS_URL] . $this->seo_ext['user'];
			unset($this->get_vars[POST_USERS_URL]);
			unset($this->get_vars['mode']);
		} 
		return;
	}
	/**
	* URL rewritting for index.php
	* @access private
	*/
	function index() {
		if ( !empty($this->get_vars[POST_CAT_URL]) && !empty($this->seo_url['cat'][$this->get_vars[POST_CAT_URL]]) ) {
			$this->url = $this->seo_url['cat'][$this->get_vars[POST_CAT_URL]] . $this->seo_delim['cat'] . $this->get_vars[POST_CAT_URL] . $this->seo_ext['cat'];
			unset($this->get_vars[POST_CAT_URL]);
		} else {
			$this->url = $this->seo_path['phpbb_url'] . $this->seo_static['index'];
		}
		return;
	}
	// --> Extra rewriting

	// <-- Extra rewriting
	/**
	* Will break if a $filter pattern is foundin $url.
	* Example $filter = array("view=", "mark=");
	* @access private
	*/
	function filter_url($filter = array()) {
		foreach ($filter as $patern ) {
			if ( strpos($this->url_in, $patern) !== FALSE ) {
				unset($this->get_vars);
				$this->url = $this->url_in;
				break;
			}
		}
		return;
	}
	/**
	* Will unset all default var stored in $filter array.
	* Example $filter = array('postdays' => 0, 'topicdays' => 0, 'postorder' => 'asc');
	* @access private
	*/
	function filter_get_var($filter = array()) {
		if ( !empty($this->get_vars) ) {
			foreach ($this->get_vars as $paramkey => $paramval) {
				if ( array_key_exists($paramkey, $filter) ) {
					if ( $filter[$paramkey] ==  $this->get_vars[$paramkey] ) {
						unset($this->get_vars[$paramkey]);
					}
				}
			}	
		}
		return;
	}
	/**
	* Will return the remaining GET vars to take care of
	* @access private
	*/
	function query_string() {
		if(empty($this->get_vars)) {
			return '';
		}
		$params = array();
		foreach($this->get_vars as $key => $value) {
			$params[] = $key . '=' . $value;
		}
		return '?' . implode('&', $params);
	}
	// --> Add on Functions <--
	// --> Gen stats
	/**
	* Returns usable microtime
	* Borrowed from php.net
	* Required for the phpBB SEO Google sitemaps module
	*/
	function microtime_float() {
		return array_sum(explode(' ',microtime()));
	}
}
?>
$encoding = "iso-8859-1"; jsem zkousel menit na CP1250 a nepohlo to.
http://test.jirikajinek.cz/ tady je ukázka.
Nebo pokud někdo máte verzi 0.2.2 tak sem s ní :-) .

PeterNet
Příspěvky: 44
Registrován: úte 22. led 2008 20:01:29

Re: Advanced mod Rewrite 0.2.2 - problém

Příspěvek od PeterNet » úte 09. zář 2008 11:19:03

Mám stejný problém, mám verzi 0.4.4... co s tím??

Zkusil jsem upraviti takto, ale nefunguje to:

Kód: Vybrat vše

static $find = array('ž', 'š', 'č', 'ř', 'ď', 'ť', 'ň', 'ě', '&', '/', '#', '+');
		static $replace = array('z', 's', 'c', 'r', 'd', 't', 'n', 'e', '%26', '%2F', '%23', '%2b');
		return rawurlencode(str_replace( $find, $replace, utf8_normalize_nfc(htmlspecialchars_decode(str_replace('&amp;', '%26', rawurldecode($url))))));
	}

Zamčeno