示例#1
0
文件: post.php 项目: fugeris/8chan
     {
         if (strpos($ip, ':') !== false) {
             if (strpos($ip, '.') > 0) {
                 $ip = substr($ip, strrpos($ip, ':') + 1);
             } else {
                 return $ip;
             }
             //native ipv6
         }
         $iparr = array_pad(explode('.', $ip), 4, 0);
         $part7 = base_convert($iparr[0] * 256 + $iparr[1], 10, 16);
         $part8 = base_convert($iparr[2] * 256 + $iparr[3], 10, 16);
         return '::ffff:' . $part7 . ':' . $part8;
     }
     $country_code = geoip\geoip_country_code_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']));
     $country_name = geoip\geoip_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']));
     if (!$country_code) {
         $country_code = 'A1';
     }
     if (!$country_name) {
         $country_name = 'Unknown';
     }
     $post['body'] .= "\n<tinyboard flag>" . strtolower($country_code) . "</tinyboard>" . "\n<tinyboard flag alt>{$country_name}</tinyboard>";
 }
 if ($config['user_flag'] && isset($_POST['user_flag'])) {
     if (!empty($_POST['user_flag'])) {
         $user_flag = $_POST['user_flag'];
         if (!isset($config['user_flags'][$user_flag])) {
             error(_('Invalid flag selection!'));
         }
         $flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag];
示例#2
0
文件: post.php 项目: 0xjove/lainchan
         if (strpos($ip, ':') !== false) {
             if (strpos($ip, '.') > 0) {
                 $ip = substr($ip, strrpos($ip, ':') + 1);
             } else {
                 return $ip;
             }
             //native ipv6
         }
         $iparr = array_pad(explode('.', $ip), 4, 0);
         $part7 = base_convert($iparr[0] * 256 + $iparr[1], 10, 16);
         $part8 = base_convert($iparr[2] * 256 + $iparr[3], 10, 16);
         return '::ffff:' . $part7 . ':' . $part8;
     }
     if ($country_code = geoip\geoip_country_code_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR']))) {
         if (!in_array(strtolower($country_code), array('eu', 'ap', 'o1', 'a1', 'a2'))) {
             $post['body'] .= "\n<tinyboard flag>" . strtolower($country_code) . "</tinyboard>" . "\n<tinyboard flag alt>" . geoip\geoip_country_name_by_addr_v6($gi, ipv4to6($_SERVER['REMOTE_ADDR'])) . "</tinyboard>";
         }
     }
 }
 if ($config['user_flag'] && isset($_POST['user_flag'])) {
     if (!empty($_POST['user_flag'])) {
         $user_flag = $_POST['user_flag'];
         if (!isset($config['user_flags'][$user_flag])) {
             error(_('Invalid flag selection!'));
         }
         $flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag];
         $post['body'] .= "\n<tinyboard flag>" . strtolower($user_flag) . "</tinyboard>" . "\n<tinyboard flag alt>" . $flag_alt . "</tinyboard>";
     }
 }
 if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) {
     $post['body'] .= "\n<tinyboard tag>" . $_POST['tag'] . "</tinyboard>";