Pagina 1 di 2

Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 3:29
da Haku
Quando si aggiorna il SEO, nei file degli upgrade, ti indica:

Codice: Seleziona tutto

##			phpbb_seo/includes/setup_phpbb_seo.php (see contrib/setup_phpbb_seo_class_0.6.4_to_0.6.6.diff)
##			phpbb_seo/phpbb_seo_class.php (see contrib/phpbb_seo_class_0.6.4_to_0.6.6.diff)
E questo è il contenuto di uno di quei file:

Codice: Seleziona tutto

Index: phpbb_seo_class.php
===================================================================
--- phpbb_seo_class.php	(0.6.4)
+++ phpbb_seo_class.php	(0.6.6)
@@ -2,7 +2,7 @@
 /**
 *
 * @package Ultimate SEO URL phpBB SEO
-* @version $Id: phpbb_seo_class.php 236 2010-03-03 08:20:36Z dcz $
+* @version $Id: phpbb_seo_class.php 277 2010-11-25 12:09:02Z dcz $
 * @copyright (c) 2006 - 2010 www.phpbb-seo.com
 * @license http://www.opensource.org/licenses/rpl1.5.txt Reciprocal Public License 1.5
 *
@@ -20,7 +20,7 @@
 * @package Ultimate SEO URL phpBB SEO
 */
 class phpbb_seo extends setup_phpbb_seo {
-	var	$version = '0.6.4';
+	var	$version = '0.6.6';
 	var	$modrtype = 2; // We set it to mixed as a default value
 	var	$seo_path = array();
 	var	$seo_url = array( 'forum' =>  array(), 'topic' =>  array(), 'user' => array(), 'username' => array(), 'group' => array(), 'file' => array() );
@@ -52,6 +52,7 @@
 	var	$RegEx = array();
 	var	$sftpl = array();
 	var	$url_replace = array();
+	var	$ssl = array('requested' => false, 'forced' => false);
 	/**
 	* constuctor
 	*/
@@ -61,7 +62,7 @@
 		// and apparently, the bug is still here in php5.3
 		@ini_set("mbstring.internal_encoding", 'UTF-8');
 		// Nothing should be edited here, please do your custom settings in the
-		// phpbb_seo/includes/phpbb_seo_modules.php instead to make your updates easier.
+		// phpbb_seo/includes/setup_phpbb_seo.php instead to make your updates easier.
 		// reset the rewrite_method for $phpbb_root_path
 		$this->rewrite_method[$phpbb_root_path] = array();
 		// phpBB files must be treated a bit differently
@@ -85,8 +86,14 @@
 		$this->cache_config['topic'] = array(); // do not change
 		$this->cache_config['settings'] = array(); // do not change
 		// --> DOMAIN SETTING <-- //
-		// Path Settings, only rely on DB
-		$server_protocol = ($config['server_protocol']) ? $config['server_protocol'] : (($config['cookie_secure']) ? 'https://' : 'http://');
+		// SSL, beware with cookie secure, it won't force ssl here,
+		// so you will need to switch to ssl for your user to use cookie based session (no sid)
+		// could be done by using an https link to login form (or within the redirect after login)
+		$this->ssl['requested'] = (bool) ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === true)) || (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443));
+		$this->ssl['forced'] = (bool) (($config['server_protocol'] === 'https//'));
+		$this->ssl['use'] = (bool) ($this->ssl['requested'] || $this->ssl['forced']);
+		// Server Settings, rely on DB
+		$server_protocol = $this->ssl['use'] ? 'https://' : 'http://';
 		$server_name = trim($config['server_name'], '/ ');
 		$server_port = max(0, (int) $config['server_port']);
 		$server_port = ($server_port && $server_port <> 80) ? ':' . $server_port : '';
@@ -117,7 +124,7 @@
 			// basenamed page name (for example: index)
 			$this->seo_opt['req_file'] = urlencode(htmlspecialchars(str_replace(".$phpEx", '', basename($this->seo_opt['req_self']))));
 		}
-		// Load settings from phpbb_seo/includes/phpbb_seo_modules.php
+		// Load settings from phpbb_seo/includes/setup_phpbb_seo.php
 		$this->init_phpbb_seo();
 		$this->seo_path['phpbb_filesR'] = $this->seo_path['phpbb_urlR'] . $this->seo_static['file_index'] . $this->seo_delim['file'];
 		// see if we have some custom replacement
@@ -803,7 +810,7 @@
 			$forum_uri = request_var('forum_uri', '');
 			unset($_GET['forum_uri'], $_REQUEST['forum_uri']);
 		}
-		if (empty($forum_uri)) {
+		if (empty($forum_uri) || $forum_uri == $this->seo_static['global_announce']) {
 			return 0;
 		}
 		if ($id = @array_search($forum_uri, $this->cache_config['forum']) ) {
@@ -838,6 +845,20 @@
 		}
 	}
 	/**
+	* sslify($url, $ssl = true,  $proto_check = true)
+	* properly set http protocol (eg http or https)
+	* if no protocol is specified, will return false with $proto_check set to true
+	*/
+	function sslify($url, $ssl = true, $proto_check = true) {
+		static $mask = '`^https?://`i';
+		$url = trim($url);
+		if ($url && preg_match($mask, $url)) {
+			$replace = $ssl ? 'https://' : 'http://';
+			return preg_replace($mask, $replace, $url);
+		}
+		return $proto_check ? false : $url;
+	}
+	/**
 	* is_utf8($string)
 	* Borrowed from php.net : http://www.php.net/mb_detect_encoding (detectUTF8)
 	*/
Cosa significa esattamente?

Re: phpbb_seo/includes/setup_phpbb_seo.php

Inviato: 13/03/2011, 8:24
da Carlo
Quello è un file diff cui contiene comandi su righe da rimuovere/aggiungere.

Se possiedi un sistema operativo linux sul tuo PC, tramite il comando patch puoi applicare queste modifiche in automatico ai tuoi files.

Ma puoi procedere anche manualmente, anche se ti sarà un pò complicato.
Per esempio, il codice sottostante indica che devi eliminare la riga che inizia con - e aggiungere quella con il +.

Codice: Seleziona tutto

-   var   $version = '0.6.4';
+   var   $version = '0.6.6';
Quest'altro invece indica le "coordinate" del punto in cui si trova il testo da rimuovere/aggiungere.

Codice: Seleziona tutto

@@ -20,7 +20,7 @@

Re: Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 20:17
da Haku
Bisogna apportare queste modifiche per forza? °_° mi sembrano un tantino difficili ^^'

(Intanto mi scuso sia per la sezione errata sia per il titolo del topic ma non sapevo proprio dove metterla e cosa scrivere çç in più oggi giornata del cavolo finita per perdere pure il cellulare çç).

Re: Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 22:30
da Carlo
Se non vuoi effettuare queste modifiche, puoi sostituire il file con una versione pulita prendendola dal pacchetto 0.6.6. Però, potresti perdere eventuali modifiche effettuate a tale file eseguite per l'installazione di MOD SEO aggiuntive.

Re: Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 23:06
da Haku
Posso lasciare così invariato? Sempre se non devono essere per forza modificati

Re: Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 23:18
da Carlo
Devono essere modificati obbligatoriamente.

Re: Lettura file diff della phpBB SEO

Inviato: 13/03/2011, 23:56
da Haku
Allora uppo quelli puliti e riscarico tutte le mod seo che ho installato per vedere se modificano quei due file ;)

EDIT:
Ho scaricato il SEO, e ho sovrascritto con quelli puliti.
Ho solo dovuto aggiornare un pezzo per la gallery che stava nel file phpbb_seo/includes/setup_phpbb_seo.php.

Ora dovrei essere a posto con questi no? O devo fare dell'altro?

Re: Lettura file diff della phpBB SEO

Inviato: 14/03/2011, 9:20
da Carlo
Dovresti aver completato.

Re: Lettura file diff della phpBB SEO

Inviato: 14/03/2011, 23:16
da Haku
Però non è cambiato nulla xD magari ora però sono aggiornati secondo la versione (da me aggiornata).

Re: Lettura file diff della phpBB SEO

Inviato: 15/03/2011, 8:06
da Carlo
Cosa non è cambiato?