PDA

View Full Version : Solved Fatal error: Cannot redeclare vbseo_thread_seotitle() (not closed yet)



StarBuG
12-12-09, 09:22
Sorry but it is not closed.

Like I said, I DID the file changes (see code below) and uploaded it (and yes, I overwrote the old one).



if (!function_exists("vbseo_thread_seotitle")) {
function vbseo_thread_seotitle(&$vbseo_gcache_thread)
{
global $vbphrase;
if (!isset($vbseo_gcache_thread['seotitle']))
{
$ttl = ($vbseo_gcache_thread['title'] ? $vbseo_gcache_thread['title'] : $vbseo_gcache_thread['threadtitle']);
if(VBSEO_URL_THREAD_PREFIX &&
($prefid = $vbseo_gcache_thread['prefixid']) )
$ttl = (VBSEO_URL_THREAD_PREFIX_NAME ? $vbphrase["prefix_".$prefid."_title_plain"] : $prefid) . ' ' . $ttl;
$vbseo_gcache_thread['seotitle'] = vbseo_filter_replace_text ($ttl);
}
}
}


I set the vbseo option Keep Non-English Characters in URLs
Replace the 'META KEYWORDS' Content? is turned off.

Link Type is set to: VBSEO_URI

htaccess entries are added



Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.patientenfragen\.net$
RewriteRule (.*) http://www.patientenfragen.net/$1 [L,R=301]

RewriteRule ^/?(en|de)/$ vbenterprisetranslator_seo.php?vbet_lang=$1&redirected=/index.php [L,QSA]
RewriteRule ^/?(en|de)/(.*)?$ vbenterprisetranslator_seo.php?vbet_lang=$1&redirected=/$2 [L,QSA]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|vbseo_sitemap/|cron)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbenterprisetranslator_seo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule $ vbenterprisetranslator_seo.php [L,QSA]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]


uploaded and the error is displayed.

So please advice

Thank you

StarBuG

vBET
12-12-09, 15:24
The only reason why this communicate can be displayed is that vbseo_thread_seotitle function is declared twice. That is why it is necessary to add this one if statement. All other configurations have nothing to to with this issue.

Please make sure that after changes you uploaded file in appropriate place (I know you wrote you did, just please check it on server side does it have what it needs).

If you are 100% sure then please PM me access details to your FTP.

StarBuG
12-12-09, 17:13
FTP Access is not possible, sorry.
Let me know what you need to know and I'll provide it.

I attached the file as zip archive.

I hack vBulletin files for nearly 10 years now.
Adding two line of codes is not that hard you know.

There must be a problem somewhere else

ps: The file I attached I downloaded from my live forum about 20sek ago ;)
pps: I had vBSEO 3.3.1 running and just upgraded to 3.3.2. Same problem there after the changes.
ppps: my charset is: ISO-8859-1 (german) I hope that is not a problem

StarBuG
12-12-09, 18:17
Ok I found a partial solution for the problem.

My Charset was set with upper case letters (ISO-8859-1)
After I changed it to all lower case vBET works except for the main forum page.
(You should include that into your installation manual or change the code so that it works with upper case letters too ;))

At first I thought the entries in Define Homepage Aliases were the problem,
but even without entries the forum home page did gave the same error message.

In specific:
If Define Homepage Aliases is empty, only English (the translation having domain.de/en/ as main forum page) works
my main language (domain.de) does give the error.

If I add the entries index.php and index.php? to Define Homepage Aliases then the /en/ part gets striped from the url and both English and German don't work.

Please advice

ps: leaving Define Homepage Aliases empty gives me a little stomach ache because that is a serious PR leak if 3 main forum urls (index.php, index.php? and /) are present

vBET
13-12-09, 18:30
Hi.

Glad to hear you are step closer, and still sorry it happens to be so painful in your case. Hope that enjoying vBET when it finally runs will cover all those troubles :)

About lower and upper case - it has matter only for utf-8 charset and it is described in manual. Your change had nothing to do with "Cannot redeclare vbseo_thread_seotitle()" - since you are in php for so long you imagine that this communicate clearly says that function was already declared anc cannot be redeclared. So it should be coincidence, but the good message it that you do not have this issue anymore.

About the new one. Please make sure that you have good vBET configuration and .htaccess - especially when your forum is in subdirectory in URL. vBET options in Main category are important - check those and read descriptions - do not use any if it is not appropriate.
I cannot tell you to much more since you didn't gave the error message, or real forum URL. Please PM me address of your forum so I will be able to see this behavior.

StarBuG
13-12-09, 19:02
Hi

My Forum is www.patientenfragen.net
The forum does not run in a subdirectory.

The Main settings are:

Google API Key (problem with and without key)
Forum language: german
forum directory: empty
forum main domain: empty
link type: VBSEO_URI
translation link types: Create URL's according to SEO link consensus (i.e. '/en/address')
keep directories: empty

.htaccess


# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
Options +FollowSymLinks
RewriteEngine On

# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.patientenfragen\.net$
RewriteRule (.*) http://www.patientenfragen.net/$1 [L,R=301]

RewriteRule ^/?(en|de)/$ vbenterprisetranslator_seo.php?vbet_lang=$1&redirected=/index.php [L,QSA]
RewriteRule ^/?(en|de)/(.*)?$ vbenterprisetranslator_seo.php?vbet_lang=$1&redirected=/$2 [L,QSA]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|vbseo_sitemap/|cron)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbenterprisetranslator_seo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule $ vbenterprisetranslator_seo.php [L,QSA]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron|vbseo_sitemap|mrdump)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincp|modcp|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]


I can't show you the behaviour live because then my forum would not work for that time.

Please advice

ps: I tested upper and lower case and still works. Don't know why it worked better after the first change.

vBET
13-12-09, 19:39
About why it didn't work after first charset change - as I wrote it was coincidence, I have few theories what happen then (I know that you handle this - those ale only general theories about such issue not about you and your case):
- file could be changed in wrong way
- file could be uploaded before changes was saved
- file could be uploaded to server in wrong directory, so vBSEO still saw the old one
- server get stupid and ignored that new version of file occurs working still on old one (this sometimes happens - good cure is save file again and upload it again)

But the point is - this part is working now :)

About actual issue - right now vBET is disabled so I'm not able to see behavior. Is it possible that you turn it on and do not show flags (custom place) - so users will not go there and I will be able to check it manually?

Your vBET configuration seems to be ok, also .htaccess file. One forum had something similar, but they mess something in vBSEO configuration and vBSEO staff fixed it. Please check does vBSEO can mess this by custom redirects. You can also check does commenting "RewriteBase /" help - but it is just shooting.

At this moment I cannot tell you more. I will have to see it and maybe I will need access to provide you more support. Please at least give me error communicate which you see when you want to translate main page. Also please note that you shouldn't add to URL language of your default forum language (it doesn't work this way - for default you just have normal links).

Also I'm little lost with your issue description that is why touching it would be much better. If you are aware about security issues then you can create temporary accounts for support or made test forum with same configuration. We will gladly give you our full support, but you have to allow us for this. At this moment we can only guess what really happens.

vBET
13-12-09, 20:06
And another shot - looking on your default vBSEO rules please try to change:


RewriteRule $ vbenterprisetranslator_seo.php [L,QSA]


To:


RewriteRule ^(.+)$ vbenterprisetranslator_seo.php [L,QSA]

StarBuG
14-12-09, 08:25
The error message I get on the main page is



Fatal error: Cannot redeclare vbseo_thread_seotitle() (previously declared in /path/vbenterprisetranslator_seo.php:40) in /path/vbenterprisetranslator_seo.php on line 43


I can't demonstrate this behavior to you because then my forum would not work, even when flags are removed.
The error is always present on the main forum page with and without translation. All other pages work fine.
I can view sub forums, threads in both languages so on that end vBET works fine.
Only when I try the main forum page which is www.patientenfragen.net the error shows and the page does not load.
It does not matter if I access it via domain directly or the translated version www.patientenfragen.net/en/
My main language (which is domain.net not domain.net/de/) as well as the english translation is not working when htaccess changes are present.

Your htaccess suggestion does not help.
Also removing rewritebase does not do the trick.

My vBSEO custom rewrite rules are:


'^index\.php\?page=regeln' => 'regeln.html'
'^index\.php\?page=impressum' => 'impressum.html'
'^index\.php\?page=agb' => 'nutzungsbedingungen.html'
'^index\.php\?page=datenschutz' => 'datenschutzerklaerung.html'
'^index\.php\?page=notfallnummern' => 'notfallnummern.html'
'^index\.php\?page=links' => 'links.html'
'^index\.php\?page=impfkalender' => 'impfkalender.html'
'^werbung\.php' => 'werbung.html'
'^vbglossar\.php\?do=showentry&id=(\d+)&title=(.*)&catid=(\d+)&cattitle=(.*)'=>'lexikon/$2-$1/$4-$3.html'
'^vbglossar\.php\?do=(.*)&id=(\d+)&title=(.*)&catid=(\d+)&cattitle=(.*)'=>'lexikon/$3-$2/$5-$4-$1.html'
'^vbglossar\.php\?do=showcat&catid=(\d+)&cattitle=(.*)'=>'lexikon/$2-$1/'
'^vbglossar\.php'=>'lexikon/'

'^private\.php\?do=showpm&pmid=(\d+)' => 'private-nachrichten/$1.html'
'^private\.php' => 'private-nachrichten/'

'^faq\.php\?faq=vb_faq' => 'hilfe/vbulletin/'
'^faq\.php$' => 'hilfe/'

'^calendar\.php$' => 'kalender/'
'^calendar\.php\?c=1$' => 'kalender/'
'^calendar\.php\?(c=1&)?do=(display.+?)(&year=)?$' => 'kalender/$2/[NF]'
'calendar\.php\?(c=1&)?nojs=1' => 'kalender/nojs/[NF]'
'calendar\.php\?(c=1&)?do=(display.+?)&nojs=1' => 'kalender/$2/nojs/[NF]'
'calendar\.php\?(c=1&)?week=(\d+)&nojs=1' => 'kalender/woche-$2/nojs/[NF]'
'calendar\.php\?(c=1&)?month=(\d+)&year=(\d+)&nojs=1' => 'kalender/$3/$2/nojs/[NF]'
'^calendar\.php\?do=getinfo&(c=1&)?day=(\d+)-(\d+)-(\d+)(&c=1)?$' => 'kalender/$2/$3/$4/'
'^calendar\.php\?do=getinfo&e=(\d+)(&day=[0-9\-]+)?(&c=1)?$' => 'kalender/ereignis-$1/'
'^calendar\.php\?(s=&)?(c=1&)?(week=&)?month=(\d+)&year=(\d+)(&c=1)?(&do=displaymonth)?$' => 'kalender/$5/$4/'
'^calendar\.php\?c=1&week=(\d+)(&do=displayweek&month=.+?)?$' => 'kalender/woche-$1/'


Giving you access to my life site is not possible for security reasons, sorry (even Jelsoft Staff does not get access from me).

Let me know which infos you need and I am happy to provide them to you.

I can email you my vbseo_all.xml settings if you think it is a vbseo conflict. Just send me your email via PM

StarBuG
14-12-09, 08:46
When I set Force Forum Root as Homepage? to NO then patientenfragen.net/en/ does work
as well as patientenfragen.net/en/index.php

however patientenfragen.net (german, the main language) still does not work (see error message above)

BUT patientenfragen.net/index.php does work

Any more ideas?

If you have MSN or ICQ send me your ID and I can show you the behavior live ;)

ps:
I DON'T want to use index.php nor index.php?

I removed them from Define Homepage Aliases when I installed vBET but I really don't like it.
Please change that for the future.
This is a serious PR leak issue!

vBET
15-12-09, 02:04
As I see there is still issue with redeclaring function. I cannot check what exactly happens, but if you made appropriate changes in vBSEO file as described in installation manual, then the only idea at this moment I have is that some rule puts you back to vbenterprisetranslator_seo.php file - it shouldn't happens and I don't see how it is possible but without checking I have no other ideas right now.

Please go to vbenterprisetranslator_seo.php and made same edition as for includes/functions_vbseo_createurl.php - so find function vbseo_thread_seotitle and set the if clause around it. Please tell me does it help.

I understand your security issues - but still you can make forum copy - remove most content and leave only some dummy messages. What we need to help you is to go to exact configuration on exact server and see what happens and find out why. vBET is used by many forums - such things happens nowhere else, so unfortunately we are not able to give you answer from hand even if we would be very happy to help you.

About Define Homepage Aliases - we will made some experiments in this area. As I remember vBSEO freaks if redirect is made simply to "/", so we have to made internal redirect to index.php (it is not saw by browser) - defining your aliases would made redirection loop. We will check it again and see how to avoid this, but please remember that now you are talking about functionality of other mod and we are not responsible for its behavior - we give way to integrate with vBSEO, but still what happens inside of vBSEO it happens inside of vBSEO... Added in TODO list as to investigate this issue again. Also please try to define such aliases in htaccess under vBET rules - so it would give you 301 redirect avoiding leaks and vBET would be still able to work, since it would be before it not after (in vBSEO which would made 301 for vBET request). But please hold on with such experiments until we made vBET working fine on your forum.

StarBuG
15-12-09, 09:13
if i make changes to vbenterprisetranslator_seo.php I get a blank page

vBET
15-12-09, 23:02
At this moment the only thing which comes to my mind it is that by some way you have internal redirection loop. You come to vbenterprisetranslator_seo.php then it goes to vBSEO and vBSEO makes internal redirect again to vbenterprisetranslator_seo.php I do not know does it really happens, but this is my guess since I cannot check it. That would explain why you had redeclaring error and why after changes you get blank page now.

If you have idea what could cause this (some vBSEO configuration) please correct it. Otherwise please go with installation and integration procedure one more time - step by step. Making sure that everything is set as it should be.
If after this the issue still happens then we need access details to be able to give our support in this case. If not to real forum then to it's copy (can be without real threads data - we need your configuration).

vBET
17-12-09, 00:11
Great thanks for giving access to forum copy. Your users will be very glad knowing that you removed all their data in copy to save their privacy :)

Issue solved :D
I added this line to your vbenterprisetranslator_seo.php:


$_SERVER['REDIRECT_URL'] = '/vbseo.php';


Also please note that you can set on vBSEO option: Force Forum Root as Homepage? So you will not have PageRank Leakage on your own forum links.

And here comes another great news - it appears that after the change in vbenterprisetranslator_seo.php is is possible to use vBSEO option "Define Homepage Aliases" - it is just needed to modify first rule to:


RewriteRule ^/?(af|sq|ar|be|bg|ca|zh-CN|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt|ro|ru|sr|sk|sl|es|sw|sv|zh-TW|th|tr|uk|vi|cy|yi)/$ vbenterprisetranslator_seo.php?vbet_lang=$1&redirected=/ [L,QSA]

I will test it also on our 3 different forums with vBSEO. And if it will work there I will include this changes in official release :)

Hope that you are very happy now :)

StarBuG
17-12-09, 04:34
Works!

Perfect, thank you

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Thanks to vBET 4.9.2 you can enjoy automatic translations