= 1; $num--) { $fname = './png/country-' . substr($phonenumber, 2, $num) . '.png'; if (file_exists($fname)) { // file found break; } } } elseif (($GLOBALS["default_ccode"] <> "423") && (!preg_match('/^0[^0]/', $phonenumber))) { // not country Liechtenstein and not starting with 0, internal caller $fname = './internal-call.png'; } else // national number $fname = './png/country-'. $GLOBALS["default_ccode"] . '.png'; if (!file_exists($fname)) // use default $fname = './country-unknown.png'; return $fname; } // -------------------------------------------------------------------------- // grep country abbreviation from file // -------------------------------------------------------------------------- function find_country_abbr($phonenumber) { // read file and remove all comments $lines = file($GLOBALS["country_code_file"]); $lines = preg_grep('/^#/', $lines, PREG_GREP_INVERT); $country_abbr = ''; if ($phonenumber == $GLOBALS["call_unknown"]) { // unknown caller $country_abbr = '--'; } elseif (preg_match("/^00/", $phonenumber)) { // international number for ($num = 4; $num >= 1; $num--) { // 31#NL#Niederlande $keys = preg_grep('/^'.substr($phonenumber, 2, $num).'#/', $lines); foreach ( $keys as $key ) { list($ccode, $cabbr, $cname) = preg_split('/#/', str_replace("\n", '', $key), 3); if ($cabbr) { // use first match $country_abbr = $cabbr; break 2; } } } } else { // national number // 49#DE#Deutschland $keys = preg_grep('/^'.$GLOBALS["default_ccode"].'#/', $lines); foreach ($keys as $key) { list($ccode, $cabbr, $cname) = preg_split('/#/', str_replace("\n", '', $key), 3); if ("$cabbr" != "") { // use first match $country_abbr = "$cabbr"; break; } } } if ($country_abbr == "") { // set default $country_abbr = '--'; } return $country_abbr; } // -------------------------------------------------------------------------- // grep country name from file // -------------------------------------------------------------------------- function find_country_name($phonenumber) { // read file and remove all comments $lines = file($GLOBALS["country_code_file"]); $lines = preg_grep('/^#/', $lines, PREG_GREP_INVERT); $country_name = ''; if ($phonenumber == $GLOBALS["call_unknown"]) { // unknown caller $country_name = $GLOBALS["call_unknown"]; } elseif (preg_match("/^00/", $phonenumber)) { // international number for ($num = 4; $num >= 1; $num--) { // 31#NL#Niederlande $keys = preg_grep('/^'.substr($phonenumber, 2, $num).'#/', $lines); foreach ( $keys as $key ) { list($ccode, $cabbr, $cname) = preg_split('/#/', str_replace("\n", '', $key), 3); if ($cname) { // use first match $country_name = $cname; break 2; } } } } elseif (($GLOBALS["default_ccode"] <> "423") && (!preg_match('/^0[^0]/', $phonenumber))) { // not starting with 0, internal caller $country_name = $GLOBALS["call_internal"]; } else { // national number // 49#DE#Deutschland $keys = preg_grep('/^'.$GLOBALS["default_ccode"].'#/', $lines); foreach ($keys as $key) { list($ccode, $cabbr, $cname) = preg_split('/#/', str_replace("\n", '', $key), 3); if ("$cname" != "") { // use first match $country_name = "$cname"; break; } } } if ($country_name == "") { // set default $country_name = $GLOBALS["call_unknown"]; } return $country_name; } // ---end of functions------------------------------------------------------- if (isset($_COOKIE['capi2text_filter'])) { // if exists refresh COOKIES setcookie("capi2text_filter", $_COOKIE['capi2text_filter'], time()+60*60*24*30); // valid for 30 days setcookie("capi2text_filter_msn", $_COOKIE['capi2text_filter_msn'], time()+60*60*24*30); } if (isset($_POST['filter'])) { // if exists update COOKIES setcookie("capi2text_filter", $_POST['filter'], time()+60*60*24*30); // valid for 30 days setcookie("capi2text_filter_msn", $_POST['filter_msn'], time()+60*60*24*30); } // read MSN replace file if it exists // // 'msn' -> valid MSN (extension), e.g. '31' // 'desc' -> description of MSN, e.g. 'Living Room' // 'fcolor' -> MSN specific foreground color, e.g. '#ffee00' // 'bcolor' -> MSN specific background color, e.g. '#00eeff' // $arr_msn_replace = array(array('msn' => '', 'desc' => '', 'fcolor' => '', 'bcolor' => '')); $arr_msn_color = array(); $msn_replace = false; $i = 0; if ($msn_replace_file <> '' && file_exists($msn_replace_file)) { $msn_replace = true; $mf = fopen($msn_replace_file, 'r') or die("Cannot open file '$msn_replace_file'!"); while (!feof($mf)) { $line = trim(fgets($mf, 500)); if (!preg_match("/^#/", $line) && !preg_match("/^$/", $line)) { // ignore comments and empty lines list($arr_msn_replace[$i]['msn'], $arr_msn_replace[$i]['desc'], $arr_msn_replace[$i]['fcolor'], $arr_msn_replace[$i]['bcolor']) = array_pad(explode("\t", $line), 4, ''); if ( $arr_msn_replace[$i]['desc'] == "" ) $arr_msn_replace[$i]['desc'] = $arr_msn_replace[$i]['msn']; if ( $arr_msn_replace[$i]['fcolor'] <> "" ) $arr_msn_color['msn' . $arr_msn_replace[$i]['msn']]['fcolor'] = $arr_msn_replace[$i]['fcolor']; if ( $arr_msn_replace[$i]['bcolor'] <> "" ) $arr_msn_color['msn' . $arr_msn_replace[$i]['msn']]['bcolor'] = $arr_msn_replace[$i]['bcolor']; $i++; } } fclose($mf); } ?>
|
||||||||
---|---|---|---|---|---|---|---|---|
" . strftime($date_format, mktime(0, 0, 0, (int) $call_date[1], (int) $call_date[2], (int) $call_date[0])) . " | ||||||||
" . $phone_call['time'] . " | \n"; if ($no_flags) // use country abbreviation echo "" . htmlspecialchars($phone_call['from']) . " | \n"; else // show from phone number as link echo "" . htmlspecialchars($phone_call['from']) . " | \n"; echo "" . htmlspecialchars($phone_call['to_replaced']) . " | \n"; if (htmlspecialchars($phone_call['address']) == '') echo "" . htmlspecialchars($phone_call['name']) . " | \n"; else echo "" . htmlspecialchars($phone_call['name']) . ", " . htmlspecialchars($phone_call['address']) . " | \n"; echo "" . $EditButton . " | \n"; echo "||
© the eisfair team |