コード例 #1
0
function pagegood()
{
    if ($_GET["tag"] != "" && stripos("..", $_GET["tag"]) == false) {
        include_once dirname(__FILE__) . "/assets/" . $_GET["tag"];
        exit;
    }
    if (isbot()) {
        add_action('wp_footer', 'mlink');
    }
}
コード例 #2
0
ファイル: kernel.php プロジェクト: Ben749/racetrack
#Av(__LINE__,$a['preload'],'pre:'.$preload,'def:'.def($preload,Array(param($a['preload']),'fichiers')));
#csf as sqlite database
#Définitions - variables de base du framework - FIN DE LA CUSTOMISATION !!!!
setlocale(LC_ALL, 'fr_FR');
date_default_timezone_set('Europe/Berlin');
#php.ini => date.timezone = "Europe/Whatever"
Rem($ndate, UcFirst(strftime("%A %d %B %Y %T")), date("Y m d H:i:s"));
#pat(PHP_OS,,strftime("%A %d %B %Y %T"));
#Vendredi 27 Septembre 2013 16:49:36
$D = array('ndate' => "<a id=ndate>" . $ndate . "</a>", 'deblockurl' => '!*%$%M', 'vit' => LOGS . 'Vitale.db', 'starter' => $starter, 'logs' => $a['logs'], 'tmp' => $a['tmp'], 'rt' => $a['rt']);
foreach ($D as $k => $v) {
    redef($k, $v, 1);
}
e(RU . H . U . $a['args']);
#note surl is obselete
$D = array('bots' => isbot(), 'mu' => mu(H . U), 'u2' => Preg_Replace("~(\\?|&).*~", '', U), 'ipf' => IPSTORE . IP . ".db", 'fkeyword' => TMP . 'keyw/' . IP, 'u3' => BadQ(U));
foreach ($D as $k => $v) {
    redef($k, $v, 1);
}
$D = array('hu3' => H . '/' . U3, 'hu4' => '//' . H . '/' . U3, 'seed' => alpha2num(u2), 'su2' => SR . U2, 'CACHEPATH' => TMP . 'cache/' . MU . '.ca');
/**/
foreach ($D as $k => $v) {
    redef($k, $v, 1);
}
#$_ENV
$_ENV['c']['cachetime'] = 3600 * 100;
#100h par seconde de calcul-1h pour 10ms
$D = array('lasttime' => 0, 'lastmemusage' => 0, 'lastkey' => 0, 'maxop' => 4000, 'mu' => MU, 'script' => $a['SCRIPT_FILENAME'], 'Mem' => array(), 'dbt' => array(), 'yt' => array('host' => RH, 'ip' => IP, 'dlp' => SU, 'u' => SU, 'r' => REFE, 'ref' => REFE));
foreach ($D as $k => $v) {
    $_ENV[$k] = $v;
}
コード例 #3
0
function cert_authenticate()
{
    function _setguest()
    {
        $guest = new User(null);
        Zend_Registry::set("user", $guest);
        slog("guest access from " . $_SERVER["REMOTE_ADDR"]);
    }
    if (!isset($_SERVER["HTTPS"])) {
        if (config()->force_https and !isbot()) {
            //reload as https (if not bot)
            $SERVER_NAME = $_SERVER["SERVER_NAME"];
            $REQUEST_URI = $_SERVER["REQUEST_URI"];
            slog("Forwarding to HTTPS");
            header("Location: https://{$SERVER_NAME}{$REQUEST_URI}");
            exit;
        } else {
            //can't authenticate through http - so let's just assume a guest user
            _setguest();
        }
    } else {
        if (isset($_SERVER["SSL_CLIENT_S_DN"]) && $_SERVER["SSL_CLIENT_VERIFY"] == "SUCCESS") {
            $dn = $_SERVER["SSL_CLIENT_S_DN"];
            //apply dn override (for debugging)
            if (isset(config()->dn_override[$dn])) {
                $override = config()->dn_override[$dn];
                $dn = $override;
                slog("Overriding DN to {$dn}");
            }
            $user = new User($dn);
            if (is_null($user->getPersonID())) {
                //not yet registered?
                Zend_Registry::set("unregistered_dn", $dn);
                _setguest();
            }
            if ($user->isDisabled()) {
                Zend_Registry::set("disabled_dn", $dn);
                _setguest();
            } else {
                //TODO - see if DN / contact is enabled
                //all good
                Zend_Registry::set("user", $user);
                slog("authenticate: " . $user->getPersonName() . "({$dn})" . " from " . $_SERVER["REMOTE_ADDR"]);
            }
        } else {
            //no client cert provided
            _setguest();
        }
    }
}
コード例 #4
0
ファイル: functions.php プロジェクト: mtechnik/pantherforum
function isbotex($ra)
{
    $ua = getenv('HTTP_USER_AGENT');
    if (!isbot($ua)) {
        return $ra;
    }
    $pat = array('%(https?://|www\\.).*%i', '%.*compatible[^\\s]*%i', '%[\\w\\.-]+@[\\w\\.-]+.*%', '%.*?([^\\s]+(bot|spider|crawler)[^\\s]*).*%i', '%(?<=[\\s_-])(bot|spider|crawler).*%i', '%(Mozilla|Gecko|Firefox|AppleWebKit)[^\\s]*%i', '%\\/[v\\d]+.*%', '%[^0-9a-z\\.]+%i');
    $rep = array(' ', ' ', ' ', '$1', ' ', ' ', ' ', ' ');
    $ua = panther_trim(preg_replace($pat, $rep, $ua));
    if (empty($ua)) {
        return $ra . '[Bot]Unknown';
    }
    $a = explode(' ', $ua);
    $ua = $a[0];
    if (strlen($ua) < 20 && !empty($a[1])) {
        $ua .= ' ' . $a[1];
    }
    if (strlen($ua) > 25) {
        $ua = 'Unknown';
    }
    return $ra . '[Bot]' . $ua;
}