コード例 #1
0
ファイル: functions_vbseo_crr.php プロジェクト: holandacz/nb4
function vbseo_back_customurl($url)
{
    global $vbseo_crules_back;
    $sugg_mark = '#s#';
    vbseo_cache_start();
    $vbseo_crules_back_array = $GLOBALS['vbseo_cache']->cacheget('vbseo_crules_back');
    if (!$vbseo_crules_back_array) {
        $vbseo_crules_back_array = array();
        foreach ($GLOBALS['vbseo_custom_rules'] as $k => $v) {
            $v = str_replace('[NF]', '', $v);
            preg_match_all('#\\$(\\d+)#', $v, $GLOBALS['vbseo_lv_vm']);
            preg_match_all('#\\(.*?\\)#', $k, $GLOBALS['vbseo_lv_km']);
            $v = preg_replace('#\\$(\\d+)#e', '$GLOBALS["vbseo_lv_km"][0][\\1-1]', str_replace('\\$', '$', preg_quote($v, '#')));
            $ki = 0;
            $k = preg_replace('#[^\\\\\\]\\)]\\?#', '', $k);
            $k = preg_replace('#\\(.*?\\)#e', '"$".(array_search(++$ki,$GLOBALS["vbseo_lv_vm"][1])+1)', stripslashes($k));
            $k = preg_replace('#\\$\\d+\\?#', '', $k);
            $k = preg_replace('#.[\\*\\+]\\??#', '', $k);
            if ($k[0] == '^') {
                $v = '^' . $v;
                $k = substr($k, 1);
            }
            $vadd = '';
            if ($k[strlen($k) - 1] == '$') {
                $vadd = '$';
                $k = substr($k, 0, strlen($k) - 1);
            }
            $vbseo_crules_back_array[0]['#' . $v . $vadd . '#'] = $k;
            if ($v[strlen($v) - 1] == '/') {
                $v .= '?';
                $k .= $sugg_mark;
            }
            $v = $v . $vadd;
            $vbseo_crules_back_array[1]['#' . $v . '#'] = $k;
        }
        $GLOBALS['vbseo_cache']->cacheset('vbseo_crules_back', $vbseo_crules_back_array);
    }
    $vbseo_crules_back = $vbseo_crules_back_array ? $vbseo_crules_back_array[$url[strlen($url) - 1] == '/' ? 0 : 1] : array();
    $newurl = preg_replace(array_keys($vbseo_crules_back), $vbseo_crules_back, $url);
    if ($newurl != $url) {
        if (strstr($newurl, $sugg_mark) && $url[strlen($url) - 1] != '/') {
            $GLOBALS['vbseo_url_suggest'] = $url . '/';
            return '';
        }
        $newurl = str_replace($sugg_mark, '', $newurl);
        return $newurl;
    } else {
        return '';
    }
}
コード例 #2
0
function vbseo_get_options($getuserinfo = true)
{
    global $vboptions, $bbuserinfo, $vbulletin, $vbseo_gcache, $forumcache, $threadcache, $config, $session, $GAS_settings, $vbseo_bitfields, $vbseo_cache;
    vbseo_cache_start();
    if (!isset($vboptions) || !isset($vboptions['bburl']) || !isset($forumcache)) {
        if (isset($vbulletin) && isset($vbulletin->options)) {
            $vboptions = $vbulletin->options;
            $forumcache = $vbulletin->forumcache;
            $session = $vbulletin->session->vars;
        } else {
            $options =& $vboptions;
            $bitfields =& $vbseo_bitfields;
            $optimported = false;
            if ($GLOBALS['config']['Datastore']['class'] == 'vB_Datastore_Filecache') {
                $dsfolder = VBSEO_DIRNAME . '/datastore';
                $include_return = @(include_once $dsfolder . '/datastore_cache.' . VBSEO_VB_EXT);
                if ($options) {
                    $optimported = true;
                }
            }
            if (!$optimported) {
                $optarr2 = array('options', 'bitfields', 'forumcache', 'GAS_settings');
                if ($optarr2) {
                    $db = vbseo_get_db();
                    $rid = $db->vbseodb_query("select title,data from " . vbseo_tbl_prefix('datastore') . "\nwhere title in ('" . implode("','", $optarr2) . "')");
                    if ($rid) {
                        while ($dstore = @$db->funcs['fetch_assoc']($rid)) {
                            ${$dstore}['title'] = @unserialize($dstore['data']);
                        }
                        $db->vbseodb_free_result($rid);
                    }
                }
            }
        }
    }
    if (defined('VBSEO_CUSTOM_BBURL')) {
        $vboptions['bburl'] = VBSEO_CUSTOM_BBURL;
    }
    $vboptions['bburl2'] = vbseo_http_s_url(preg_replace('#/+$#', '', $vboptions['bburl']));
    $vboptions['cutbburl'] = preg_replace('#^https?://[^/]+(.*)$#', '$1', $vboptions['bburl2']);
    $vboptions['relbburl'] = VBSEO_USE_HOSTNAME_IN_URL ? $vboptions['bburl2'] : $vboptions['cutbburl'];
    $vbseo_gcache['post'] = isset($GLOBALS['itemids']) ? $GLOBALS['itemids'] : (isset($GLOBALS['postcache']) ? $GLOBALS['postcache'] : array());
    if (isset($GLOBALS['getlastpost']) && $GLOBALS['getlastpost']['postid']) {
        $vbseo_gcache['post'][$GLOBALS['getlastpost']['postid']] = $GLOBALS['getlastpost'];
    }
    $url = isset($vboptions['forumhome']) ? $vboptions['forumhome'] . '.' . VBSEO_VB_EXT . '' : '';
    if (($url == 'index.' . VBSEO_VB_EXT || VBSEO_FORCEHOMEPAGE_ROOT) && VBSEO_HP_FORCEINDEXROOT) {
        $url = '';
    }
    @define('VBSEO_HOMEPAGE', $url);
    if (isset($threadcache)) {
        foreach ($threadcache as $threadid => $tar) {
            if ($tar['firstpostid'] && !isset($vbseo_gcache['post'][$tar['firstpostid']])) {
                $vbseo_gcache['post'][$tar['firstpostid']] = array('threadid' => $threadid, 'postid' => $tar['firstpostid']);
            }
            if ($tar['lastpostid'] && !isset($vbseo_gcache['post'][$tar['lastpostid']])) {
                $vbseo_gcache['post'][$tar['lastpostid']] = array('threadid' => $threadid, 'postid' => $tar['lastpostid']);
            }
        }
    }
    if ($getuserinfo) {
        if (isset($vbulletin) && (!$bbuserinfo || !$bbuserinfo['usergroupid'])) {
            $bbuserinfo = $vbulletin->userinfo;
        }
        if (!isset($bbuserinfo) || !$bbuserinfo['userid'] || isset($vbulletin) && !$bbuserinfo['usergroupid']) {
            $cvisit = @intval($_COOKIE[vbseo_vb_cprefix() . 'lastvisit']);
            $bbuserinfo['lastvisit'] = $cvisit ? $cvisit : time();
            if ($_COOKIE[vbseo_vb_cprefix() . 'userid'] && !$bbuserinfo['userid']) {
                $bbuserinfo['userid'] = $_COOKIE[vbseo_vb_cprefix() . 'userid'];
            }
        }
        $bbuserinfo['isadmin'] = isset($bbuserinfo['usergroupid']) && $bbuserinfo['usergroupid'] == 6;
    }
    vbseo_check_confirmation();
    vbseo_check_datastore();
}
コード例 #3
0
ファイル: vbseocp.php プロジェクト: holandacz/nb4
                    if ($vlink['cnt'] == 0) {
                        vbseo_linkback_recalc();
                    }
                    $vbo = vbseo_get_datastore('options');
                    $vbseoo = vbseo_get_datastore('vbseo_options');
                    $setcode = isset($p['editlic']) ? VBSEO_LICENSE_CODE : $vboptions['vbseo_confirmation_code'];
                    $vbseoo['settings_backup'] = $setm;
                    $vbo['vbseo_opt'] = array();
                    vbseo_set_datastore('vbseo_options', $vbseoo);
                    vbseo_set_datastore('options', $vbo);
                    $rid = $db->vbseodb_query("SHOW COLUMNS FROM " . vbseo_tbl_prefix('plugin') . " LIKE 'executionorder'");
                    $excolumn = $db->funcs['fetch_assoc']($rid);
                    if ($excolumn) {
                        $db->vbseodb_query($q = "UPDATE " . vbseo_tbl_prefix('plugin') . "\r\nSET executionorder = 15\r\nWHERE product = 'crawlability_vbseo' AND hookname = 'global_complete' AND executionorder = 5");
                    }
                    vbseo_cache_start();
                    $vbseo_cache->cachereset();
                    ?>
<p align="center"><strong><font color="#FF0000"><?php 
                    echo $alang['saved_ok'];
                    ?>
</font></strong><br />
<a href="vbseocp.php<?php 
                    echo $jumpto ? "#{$jumpto}" : "";
                    ?>
"><?php 
                    echo $alang['click_redirect'];
                    ?>
</a>
<script language="Javascript">setTimeout('document.location="vbseocp.php<?php 
                    echo $jumpto ? "#{$jumpto}" : "";
コード例 #4
0
ファイル: functions_vbseo_seo.php プロジェクト: holandacz/nb4
function vbseo_prepare_arc_links()
{
    global $vboptions, $vbseo_gcache, $vbulletin, $bbuserinfo;
    vbseo_cache_start();
    $links_str = $GLOBALS['vbseo_cache']->cacheget('vbseo_prepare_arc_links');
    if (!$links_str) {
        $perpage = $vboptions['archive_threadsperpage'];
        if (!defined('CANVIEW') && isset($vbulletin)) {
            define('CANVIEW', $vbulletin->bf_ugp_forumpermissions['canview']);
        }
        $linksno = 1;
        $opt = isset($vboptions['vbseo_opt']) ? $vboptions['vbseo_opt'] : array();
        foreach ($vbseo_gcache['forum'] as $forumid => $finfo) {
            $forumperms = $bbuserinfo['forumpermissions']["{$forumid}"];
            if (!($forumperms & CANVIEW) || $finfo['link']) {
                continue;
            }
            if (VBSEO_ARCHIVE_LINKS_FOOTER == 2 || VBSEO_ARCHIVE_LINKS_FOOTER == 4) {
                $totalthreads = $opt['forumthreads'][$forumid] ? $opt['forumthreads'][$forumid] : $finfo['threadcount'];
                $totalpages = max(ceil($totalthreads / $perpage), 1);
            } else {
                $totalpages = 1;
            }
            for ($p = 1; $p <= $totalpages; $p++) {
                $links_str .= '<a href="' . $vboptions['bburl2'] . VBSEO_ARCHIVE_ROOT . 'f-' . $forumid . ($p > 1 ? '-p-' . $p : '') . '.html"' . '>' . $linksno++ . '</a> ';
            }
        }
        $GLOBALS['vbseo_cache']->cacheset('vbseo_prepare_arc_links', $links_str);
    }
    return $links_str;
}
コード例 #5
0
ファイル: functions_vbseo_vb.php プロジェクト: holandacz/nb4
function vbseo_get_forum_info($implicit = false)
{
    global $vbseo_gcache, $vboptions, $usercache, $forumcache, $threadcache, $vbseo_cache, $found_object_ids;
    vbseo_cache_start();
    $f_allow = !$found_object_ids['forum_last'] || $found_object_ids['forum_last'][0] && $forumcache[$found_object_ids['forum_last'][0]] && $forumcache[$found_object_ids['forum_last'][0]]['lastposter'];
    $fp_cached = $vboptions['vbseo_opt']['forumpaths'] ? true : false;
    $vbseo_fp = $fp_cached ? $vboptions['vbseo_opt']['forumpaths'] : array();
    $savecache = false;
    if (!$vbseo_gcache['forum']) {
        $vbseo_gcache['forum'] = $vbseo_cache->cacheget('forum');
    }
    if (empty($vbseo_gcache['forum']) || $implicit && $f_allow) {
        $vbseo_gcache['forum'] = array();
        if (is_array($forumcache) && $f_allow) {
            foreach ($forumcache as $forum_id => $arr) {
                $arr['parentlist'] = substr($arr['parentlist'], 0, -3);
                $vbseo_gcache['forum'][$arr['forumid']] = $arr;
            }
        } else {
            $db = vbseo_get_db();
            $rid = $db->vbseodb_query("select forumid" . (VBSEO_GET_FORUM_TITLES ? ', title' : '') . ", parentlist, lastpost, lastposter, daysprune, parentid, threadcount from " . vbseo_tbl_prefix('forum'));
            if ($rid) {
                while ($arr = @$db->funcs['fetch_assoc']($rid)) {
                    $arr['parentlist'] = substr($arr['parentlist'], 0, -3);
                    $vbseo_gcache['forum'][$arr['forumid']] = $arr;
                }
                $db->vbseodb_free_result($rid);
            }
        }
        $forumids = array_keys($vbseo_gcache['forum']);
        foreach ($forumids as $forumid) {
            $forum =& $vbseo_gcache['forum'][$forumid];
            if (isset($forum['lastthreadid']) && ($tid = $forum['lastthreadid']) && !in_array(THIS_SCRIPT, array('showthread', 'printthread', 'showpost'))) {
                $threadcache[$tid] = array_merge(isset($threadcache[$tid]) ? $threadcache[$tid] : array(), array('threadid' => $forum['lastthreadid'], 'title' => $forum['lastthread'], 'forumid' => $forumid, 'lastpostid' => $forum['lastpostid'], 'lastposter' => $forum['lastposter']));
            }
            if ($fp_cached) {
                continue;
            }
            $parentlist = array_reverse(explode(',', $forum['parentlist']));
            $forum['patharr'] = array();
            for ($i = 0; isset($parentlist[$i]) && ($id = $parentlist[$i]); $i++) {
                vbseo_forum_seotitle($vbseo_gcache['forum'][$id]);
                $replace = array('%forum_id%' => $id, '%forum_title%' => $vbseo_gcache['forum'][$id]['seotitle']);
                $forum['patharr'][] = str_replace(array_keys($replace), $replace, VBSEO_FORUM_TITLE_BIT);
            }
            $forumcache[$forumid]['path'] = $forum['path'] = @implode('/', $forum['patharr']);
        }
        $savecache = true;
    }
    if (!$fp_cached) {
        $vboptions['vbseo_opt'] = array();
        vbseo_check_datastore();
    }
    foreach ($vbseo_gcache['forum'] as $forumid => $arr) {
        if (isset($arr['lastposter']) && $found_object_ids['forum_last'] && in_array($arr['forumid'], $found_object_ids['forum_last'])) {
            $found_object_ids['user_names'][] = $arr['lastposter'];
        }
        if (!isset($arr['path']) && $fp_cached) {
            $vbseo_gcache['forum'][$forumid]['path'] = $vbseo_fp[$forumid];
        }
        if (isset($arr['lastpostid'])) {
            $lpostid = $arr['lastpostid'];
            if (!isset($vbseo_gcache['post'][$lpostid]) && isset($arr['lastthreadid'])) {
                $vbseo_gcache['post'][$lpostid] = array('postid' => $lpostid, 'threadid' => $arr['lastthreadid']);
            }
        }
    }
    if ($savecache) {
        $vbseo_cache->cacheset('forum', $vbseo_gcache['forum']);
    }
    vbseo_prepare_cat_anchors();
    if (isset($id)) {
        return $vbseo_gcache['forum'][$id];
    }
    return $vbseo_gcache['forum'];
}