} if (isset($_POST['action'])) { $action = $_POST['action']; } elseif (isset($_GET['action'])) { $action = $_GET['action']; } if (!isset($action)) { $action = 'home'; } switch ($action) { case 'home': $title = 'Home'; include 'view/home.php'; exit; case 'results': $searchList = getSearchList($_POST['srch-term']); $title = 'Results'; include 'view/results.php'; exit; case 'complexReview': $complex = getComplex($_GET['id']); $review = getReview($_GET['id']); $title = 'Complex Review'; include 'view/complexReview.php'; exit; case 'loginSignin': $title = 'Sign Up'; include 'view/signUp.php'; exit; case 'login': if ($_POST['type'] == 'signup') {
function checkKeywords($feed, $keywords) { if ($keywords != null) { $searchList = getSearchList($keywords); $blackList = getBlackList($keywords); //Unifico en un solo string el título y el texto del post (Por el momento, podrían agregarse otros campos) $text = $feed['name'] . ' ' . $feed['message']; //Divido el string en palabras, utilizando como separadores los blancos (espacios, tabs, etc.), comas, puntos y puntos y coma (Puede que haya que agregar otros símbolos a la expresión regular) foreach (preg_split("/[\\s,.;]+/", $text) as $word) { //Seteo un array de strings utilizando como índice la raiz de la palabra $string[stemm_es::stemm(strtolower($word))] = 1; } //Si no existen palabras en ninguna de las dos listas, no hay que filtran, por lo tanto retorno true if (empty($searchList) && empty($blackList)) { return true; } //Si existen palabras en la lista negra, pero no en la otra, solo filtro los post que contengan esas palabras if (empty($searchList) && !empty($blackList)) { //Chequeo si existen en el índice los keywords buscados (la raiz en realidad) y en ese caso retorno false para omitir el post foreach ($blackList as $keyword) { if (isset($string[stemm_es::stemm(strtolower($keyword))])) { return false; } } return true; } //Si existen palabras en la lista de términos a buscar, solo retorno los post que contengan esas palabras, y de ellos chequeo que no tengan palabras de la lista negra. foreach ($searchList as $keyword) { if (!empty($blackList)) { foreach ($blackList as $blackKeyword) { if (isset($string[stemm_es::stemm(strtolower($blackKeyword))])) { return false; } } } if (isset($string[stemm_es::stemm(strtolower($keyword))])) { return true; } return false; } } else { return true; } }
$template = 'helpdesk/ticket_edit.twig'; $c['id'] = $c['search']; header("Location: ./?stage=edit&id=" . $c['id']); } } $c['pagename'] = 'Поиск "' . $c['search'] . '" :: Задачник'; // $c['r'] = $CNF["rows_in_page"]; $row_count = getSearchListRowCount($c['search']); $row_count2 = getSearchListRowCount(switchLayout($c['search'])); if ($row_count2 > $row_count) { $c['changedSearchText'] = switchLayout($c['search']); } // $c['row_count'] = getSearchListRowCount($c['search']); $c['pages'] = ceil($c['row_count'] / $c['r']); $c['tickets'] = getSearchList($c['search'], $c['ob'], $c['od'], $c['page'], $c['r']); if ($c['ob'] == $default_order) { $c['ob'] = ''; } break; // Новая задача // Новая задача case "new": $c['pagename'] = 'Новая заявка :: Задачник'; $c['ticket'] = $DEFAULT_TICKET; if (!array_key_exists(2, $c['areas'])) { $c['ticket']['area'] = key($c['areas']); } $c['ticket']['contractor'] = $c['admin_id']; $c['ticket']['performers'] = $c['admin_id']; $c['ticket'][''] = $c['admin_id'];