Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion inc/plugins/google_seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,15 @@ function google_seo_dynamic($url)
// This is complicated because of ?page&page=2, page being the thread title.

$query = explode('?', $url);
$query = $query[1];

if(isset($query[1]))
{
$query = $query[1];
}
else
{
$query = false;
}

if($query)
{
Expand Down
15 changes: 13 additions & 2 deletions inc/plugins/google_seo/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function google_seo_plugin_info()
if(google_seo_plugin_is_installed() &&
is_array($plugins_cache) &&
is_array($plugins_cache['active']) &&
$plugins_cache['active']['google_seo'])
isset($plugins_cache['active']['google_seo']))
{
$info['description'] = $info['description'].google_seo_plugin_status();
}
Expand Down Expand Up @@ -212,6 +212,7 @@ function google_seo_plugin_status()
$success[] = "<a href=\"{$urldb}\">{$lang->googleseo_plugin_url}</a>";

if($settings['google_seo_url_translate'] &&
if(!empty($settings['google_seo_url_translate']) &&
!file_exists(MYBB_ROOT."inc/plugins/google_seo/translate.php"))
{
$warning[] = $lang->googleseo_plugin_url_warn_translate;
Expand Down Expand Up @@ -371,6 +372,12 @@ function google_seo_plugin_status()
{
$url = "([^./]+)";
$rule = google_seo_expand($rule, array('url' => $url));

if(!isset($v[4]))
{
$v[4] = '';
}

$rule = "RewriteRule ^{$rule}\$ {$v[1]}?{$v[4]}{$v[2]}=\$1 [L,QSA,NC]";
}

Expand All @@ -394,7 +401,7 @@ function google_seo_plugin_status()
}
}

if($line)
if(isset($line))
{
$lines[] = $line;
$line = '';
Expand Down Expand Up @@ -486,6 +493,8 @@ function google_seo_plugin_status()
$query = $db->simple_select("settinggroups", "gid", "name='google_seo'");
$gid = $db->fetch_field($query, 'gid');

$configure = '';

if($gid)
{
$configure = $PL->url_append('index.php', array(
Expand All @@ -501,6 +510,8 @@ function google_seo_plugin_status()
$warning[] = $lang->googleseo_plugin_warn_setting;
}

$status = '';

// Build a list with success, warnings, errors:
if(count($error))
{
Expand Down
58 changes: 29 additions & 29 deletions inc/plugins/google_seo/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ function google_seo_redirect_hook()
switch(THIS_SCRIPT)
{
case 'forumdisplay.php':
$fid = (int)$mybb->input['fid'];
$page = (int)$mybb->input['page'];
$fid = (int)$mybb->get_input('fid');
$page = (int)$mybb->get_input('page');

if($fid)
{
Expand Down Expand Up @@ -126,29 +126,29 @@ function google_seo_redirect_hook()
case 'showthread.php':
// pid overrules tid, so we must check pid first,
// even at the cost of an additional query.
if((int)$mybb->input['pid'])
if((int)$mybb->get_input('pid'))
{
$tid = google_seo_tid((int)$mybb->input['pid'],
(int)$mybb->input['tid'],
$tid = google_seo_tid((int)$mybb->get_input('pid'),
(int)$mybb->get_input('tid'),
$settings['google_seo_redirect_posts']);
$target = get_post_link((int)$mybb->input['pid'], $tid);
$target = get_post_link((int)$mybb->get_input('pid'), $tid);
$kill['pid'] = '';
$kill['tid'] = '';
$kill['google_seo_thread'] = '';
$kill['google_seo'] = '';
}

else if((int)$mybb->input['tid'])
else if((int)$mybb->get_input('tid'))
{
$target = get_thread_link((int)$mybb->input['tid'],
(int)$mybb->input['page'],
(string)$mybb->input['action']);
$target = get_thread_link((int)$mybb->get_input('tid'),
(int)$mybb->get_input('page'),
(string)$mybb->get_input('action'));
$kill['tid'] = '';
$kill['action'] = '';
$kill['google_seo_thread'] = '';
$kill['google_seo'] = '';

if($mybb->input['page'] != 'last')
if($mybb->get_input('page') != 'last')
{
$kill['page'] = '';
}
Expand All @@ -157,9 +157,9 @@ function google_seo_redirect_hook()
break;

case 'announcements.php':
if((int)$mybb->input['aid'])
if((int)$mybb->get_input('aid'))
{
$target = get_announcement_link((int)$mybb->input['aid']);
$target = get_announcement_link((int)$mybb->get_input('aid'));
$kill['aid'] = '';
$kill['google_seo_announcement'] = '';
$kill['google_seo'] = '';
Expand All @@ -168,21 +168,21 @@ function google_seo_redirect_hook()
break;

case 'member.php':
if((int)$mybb->input['uid'])
if((int)$mybb->get_input('uid'))
{
if($settings['google_seo_redirect_litespeed']
&& $mybb->input['action'] != 'profile')
&& $mybb->get_input('action') != 'profile')
{
// Work around rewrite bug in LiteSpeed (double action conflict).
break;
}

$target = get_profile_link((int)$mybb->input['uid']);
$target = get_profile_link((int)$mybb->get_input('uid'));
$kill['uid'] = '';
$kill['google_seo_user'] = '';
$kill['google_seo'] = '';

if($mybb->input['action'] == 'profile')
if($mybb->get_input('action') == 'profile')
{
$kill['action'] = '';
}
Expand All @@ -191,29 +191,29 @@ function google_seo_redirect_hook()
break;

case 'calendar.php':
if((int)$mybb->input['eid'])
if((int)$mybb->get_input('eid'))
{
if($settings['google_seo_redirect_litespeed']
&& $mybb->input['action'] != 'profile')
&& $mybb->get_input('action') != 'profile')
{
// Work around rewrite bug in LiteSpeed (double action conflict).
break;
}

$target = get_event_link((int)$mybb->input['eid']);
$target = get_event_link((int)$mybb->get_input('eid'));
$kill['eid'] = '';
$kill['google_seo_event'] = '';
$kill['google_seo'] = '';

if($mybb->input['action'] == 'event')
if($mybb->get_input('action') == 'event')
{
$kill['action'] = '';
}
}

else
{
if(!(int)$mybb->input['calendar'])
if(!(int)$mybb->get_input('calendar'))
{
// Special case: Default calendar.
// Code taken from calendar.php
Expand All @@ -224,10 +224,10 @@ function google_seo_redirect_hook()
$mybb->input['calendar'] = $cid;
}

if($mybb->input['action'] == "weekview")
if($mybb->get_input('action') == "weekview")
{
$target = get_calendar_week_link((int)$mybb->input['calendar'],
(int)str_replace('n', '-', $mybb->input['week']));
$target = get_calendar_week_link((int)$mybb->get_input('calendar'),
(int)str_replace('n', '-', $mybb->get_input('week')));
$kill['calendar'] = '';
$kill['week'] = '';
$kill['action'] = '';
Expand All @@ -237,10 +237,10 @@ function google_seo_redirect_hook()

else
{
$target = get_calendar_link((int)$mybb->input['calendar'],
(int)$mybb->input['year'],
(int)$mybb->input['month'],
(int)$mybb->input['day']);
$target = get_calendar_link((int)$mybb->get_input('calendar'),
(int)$mybb->get_input('year'),
(int)$mybb->get_input('month'),
(int)$mybb->get_input('day'));
$kill['calendar'] = '';
$kill['year'] = '';
$kill['month'] = '';
Expand Down
Loading