<?php check_login(); if (!defined('BASEPATH')) { exit('Nu poti accesa acest fisier direct.'); } set_title(site_name() . ' - Caracterele mele'); $data = $DB->query("SELECT * FROM " . PLAYER_DATABASE . ".player WHERE account_id = '" . $_SESSION['user_data']['id'] . "'"); $users = array(); $i = 0; while ($row = $DB->fetch($data)) { $users[$i]['id'] = $row['id']; $users[$i]['name'] = $row['name']; $users[$i]['level'] = $row['level']; $users[$i]['time'] = $row['playtime'] > 0 ? duration($row['playtime'] * 60) : 'nedeterminat'; $users[$i]['class'] = char_class($row['job']); $i++; } $smarty->assign('users', $users); assign('content_tpl', 'content/character');
function tokenize_ml($txt, $exceptions, $prefixes) { $coeff = array(); $out = array(); $token = ''; $txt = Normalizer::normalize($txt, Normalizer::FORM_C); $res = sql_query("SELECT * FROM tokenizer_coeff"); while ($r = sql_fetch_array($res)) { $coeff[$r[0]] = $r[1]; } $txt .= ' '; for ($i = 0; $i < mb_strlen($txt, 'UTF-8'); ++$i) { $prevchar = $i > 0 ? mb_substr($txt, $i - 1, 1, 'UTF-8') : ''; $char = mb_substr($txt, $i + 0, 1, 'UTF-8'); $nextchar = mb_substr($txt, $i + 1, 1, 'UTF-8'); $nnextchar = mb_substr($txt, $i + 2, 1, 'UTF-8'); //$chain is the current word which we will perhaps need to check in the dictionary $chain = $chain_left = $chain_right = ''; $odd_symbol = ''; if (is_hyphen($char) || is_hyphen($nextchar)) { $odd_symbol = '-'; } elseif (preg_match('/([\\.\\/\\?\\=\\:&"!\\+\\(\\)])/u', $char, $match) || preg_match('/([\\.\\/\\?\\=\\:&"!\\+\\(\\)])/u', $nextchar, $match)) { $odd_symbol = $match[1]; } if ($odd_symbol) { for ($j = $i; $j >= 0; --$j) { $t = mb_substr($txt, $j, 1, 'UTF-8'); if ($odd_symbol == '-' && (is_cyr($t) || is_hyphen($t) || $t === "'") || $odd_symbol != '-' && !is_space($t)) { $chain_left = $t . $chain_left; } else { break; } if (mb_substr($chain_left, -1) === $odd_symbol) { $chain_left = mb_substr($chain_left, 0, -1); } } for ($j = $i + 1; $j < mb_strlen($txt, 'UTF-8'); ++$j) { $t = mb_substr($txt, $j, 1, 'UTF-8'); if ($odd_symbol == '-' && (is_cyr($t) || is_hyphen($t) || $t === "'") || $odd_symbol != '-' && !is_space($t)) { $chain_right .= $t; } else { break; } if (mb_substr($chain_right, 0, 1) === $odd_symbol) { $chain_right = mb_substr($chain_right, 1); } } $chain = $chain_left . $odd_symbol . $chain_right; } $vector = array_merge(char_class($char), char_class($nextchar), array(is_number($prevchar), is_number($nnextchar), $odd_symbol == '-' ? is_dict_chain($chain) : 0, $odd_symbol == '-' ? is_suffix($chain_right) : 0, is_same_pm($char, $nextchar), $odd_symbol && $odd_symbol != '-' ? looks_like_url($chain, $chain_right) : 0, $odd_symbol && $odd_symbol != '-' ? is_exception($chain, $exceptions) : 0, $odd_symbol == '-' ? is_prefix($chain_left, $prefixes) : 0, $odd_symbol == ':' && $chain_right !== '' ? looks_like_time($chain_left, $chain_right) : 0)); $vector = implode('', $vector); if (isset($coeff[bindec($vector)])) { $sum = $coeff[bindec($vector)]; } else { $sum = 0.5; } $token .= $char; if ($sum > 0) { $token = trim($token); if ($token !== '') { $out[] = array($token, $sum, bindec($vector) . '=' . $vector); } $token = ''; } } return $out; }