コード例 #1
0
 function template_redirect()
 {
     $bas_options = get_settings('bas_options');
     if (!is_array($bas_options)) {
         $bas_options = array();
     }
     /* Actually DO statistics logging */
     $do_logging = true;
     if (!in_array('log_admins', $bas_options)) {
         global $user_level;
         get_currentuserinfo();
         if (isset($user_level) && $user_level >= 8) {
             $do_logging = false;
         }
     }
     if (!in_array('log_console', $bas_options)) {
         if (strstr($_SERVER['REQUEST_URI'], '/wp-admin')) {
             $do_logging = false;
         }
     }
     if (!in_array('log_content', $bas_options)) {
         if (strstr($_SERVER['REQUEST_URI'], '/wp-content')) {
             $do_logging = false;
         }
     }
     if (!in_array('log_self', $bas_options)) {
         $serveraddr = $_SERVER['LOCAL_ADDR'];
         if ($serveraddr == '') {
             $serveraddr = $_SERVER['SERVER_ADDR'];
         }
         if ($_SERVER['REMOTE_ADDR'] == $serveraddr) {
             $do_logging = false;
         }
     }
     if ($do_logging) {
         BAStats::log($title);
     }
     //echo "<!-- BAStats Logged -->";
 }
コード例 #2
0
 function log_search($refer, $rid)
 {
     global $wpdb;
     $engs = BAStats::search_engines();
     foreach ($engs as $keng => $eng) {
         if (preg_match($keng, $refer, $matches)) {
             $wpdb->query("INSERT INTO {$wpdb->searches} (search_refer, search_phrase, search_engine) VALUES ({$rid}, '" . addslashes(urldecode($matches[$eng[1]])) . "', '" . addslashes($eng[0]) . "');");
             break;
         }
     }
 }