function addvisit_2_exec($Frm, $Err) { if (!$Err) { if (!isset($_SESSION["make_visit_tmp"]["klient"])) { $Frm->_gui->ERR("Клиент не определен"); return; } $kln = kln_get($_SESSION["make_visit_tmp"]["klient"]); if (!$kln) { $Frm->_gui->ERR("Клиент не определен"); return; } $ord_id = 0; if (isset($_SESSION["make_visit_tmp"]["order"]) && intval($_SESSION["make_visit_tmp"]["order"])) { $ord_id = intval($_SESSION["make_visit_tmp"]["order"]); if (!Order::find($ord_id)) { $Frm->_gui->ERR("Заказ не найден"); return; } } // Проверить время $t1 = $Frm->GetNmValue("start"); $t2 = $Frm->GetNmValue("finish"); if ($t2 <= $t1) { $Frm->_gui->ERR("Некорректно задано время"); return; } $dt = explode("-", $_SESSION["make_visit_tmp"]["date"]); $dt = mktime(0, 0, 0, $dt[1], $dt[0], $dt[2]); $fil = intval($_SESSION["make_visit_tmp"]["filial_id"]); if ($fil <= 0) { $Frm->_gui->ERR("Некорректный филиал"); return false; } $courier_id = $Frm->GetNmValueI("user"); $visits = db::get_single_value("SELECT COUNT(*) FROM " . TABLE_VISITS . " WHERE user_id = " . db::input($courier_id) . " AND tm_start <= " . db::input($t1) . " AND tm_finish > " . db::input($t1) . " AND date = " . db::input($dt)); if ($visits) { $Frm->_gui->ERR("На это время уже назначена встреча"); return false; } $vis_id = Meeting::create(array("user_id" => $courier_id, "date" => $dt, "status" => 0, "tm_start" => $t1, "tm_finish" => $t2, "client_id" => $kln["id"], "order_id" => $ord_id, "filial_id" => $fil, "created" => time(), "creator_id" => $_SESSION["user"]["data"]["id"], "summa" => $_SESSION["make_visit_tmp"]["summa1"], "about" => $_SESSION["make_visit_tmp"]["about"], "opisanie_klienta" => $Frm->GetNmValueH("opisanie_klienta"), "opisanie_pyti" => $Frm->GetNmValueH("opisanie_pyti"), "station_id" => $Frm->GetNmValueI("station"))); $Frm->_gui->OK("Встреча создана"); // Создаем сообщение при необходимости if ($courier_id != $_SESSION["user"]["data"]["id"]) { $prior = 1; $msg_id = mls_Send("u" . $courier_id, "u" . $_SESSION["user"]["data"]["id"], "Новая встреча №" . $vis_id, "Вы проводите встречу " . date("d.m.Y", $dt) . " c " . utils_cvt_i2times($t1) . " по " . utils_cvt_i2times($t2) . "." . " <a href='?section=vis&subsection=2&visit=" . $vis_id . "'>Подробнее...</a><br>Внимание! Ответ на данное сообщение обязателен!", $prior, 0, 0, 0, 0, $vis_id, 0); if ($msg_id) { \Components\Classes\Author::enqueue_message_to_email($msg_id, array($courier_id), \Components\Entity\EmailNotificationType::TO_CLIENT_ON_ORDER_CHANGE); Meeting::update($vis_id, array('uved_umsg' => $msg_id)); } } page_reloadToSec("2"); } }
function loginform_exec($Frm, $Err) { if ($Err) { $Frm->_gui->Vars["login_message"] = "Ошибки при заполнении формы"; return; } // clr db::delete(TABLE_LOGIN_HOST, "time < " . (time() - 900)); $last_login_time = db::get_arrays("SELECT time FROM " . TABLE_LOGIN_HOST . " WHERE ip = '" . db::input($_SERVER["REMOTE_ADDR"]) . "' ORDER BY time"); $cnt = count($last_login_time); $rowx["time"] = 0; if ($cnt) { $rowx = $last_login_time[0]; } $user = Employee::findOneBy(array('email' => strtolower($Frm->GetValue(0)), 'hpwd' => md5($Frm->GetValue(1) . $Frm->GetValue(0)))); if (!$user || $cnt > 2) { if ($cnt > 1) { $t = 900 - time() + $rowx["time"]; if ($t > 60) { $w = floor($t / 60) . " мин."; } else { $w = " минуту"; } $Frm->_gui->Vars["login_message"] = "Попытки исчерпаны. Подождите " . $w; } else { $Frm->_gui->Vars["login_message"] = "Ошибка. Осталось попыток: " . (2 - $cnt); db::insert(TABLE_LOGIN_HOST, array('ip' => $_SERVER['REMOTE_ADDR'], 'time' => time())); } return; } else { // ok if ($user["blocked"] || $user["black_list"]) { $Frm->_gui->Vars["login_message"] = "Доступ запрещен"; return; } $ll = array(); if ($user["last_login"]) { $ll = unserialize($user["last_login"]); while (count($ll) > 99) { array_shift($ll); } } $ll[] = array("ip" => $_SERVER['REMOTE_ADDR'], "time" => time()); Employee::update($user['id'], array('last_act' => time(), 'last_login' => serialize($ll))); unset($user["last_act"]); unset($user["last_login"]); $_SESSION["user"]["auth"] = true; $_SESSION["user"]["data"] = $user; page_reload(); } }
/** * Finds entities by a set of criteria. * * @param array $criteria * @param array|null $orderBy * @param int|null $limit * @param int|null $offset * * @throws InvalidArgumentException * @return array The objects. */ public static function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) { if (is_array($criteria)) { $where = ''; foreach ($criteria as $key => $value) { if (is_null($value)) { continue; } if (!empty($where)) { $where .= " AND "; } $where .= $key . " = '" . db::input($value) . "'"; } if (!empty($where)) { $where = "WHERE " . $where; } else { $where = "WHERE 1"; } $order = ''; if (is_array($orderBy) && count($orderBy)) { $order = 'ORDER BY '; foreach ($orderBy as $key => $value) { $order .= $key . ' ' . $value; } } $sLimit = ''; if (!is_null($offset) || !is_null($limit)) { $sLimit = 'LIMIT '; if (!is_null($offset)) { $sLimit .= $offset . ', '; } if (!is_null($limit)) { $sLimit .= $limit; } } return db::get_arrays("\n SELECT *\n FROM " . static::TABLE . "\n " . $where . "\n " . $order . "\n " . $sLimit . "\n "); } else { throw new InvalidArgumentException(self::getEntity()); } }
if ($fltr != "") { $fltr .= " AND "; } // Чтобы не показывать заказ со статусом "ждет предоплаты" всем подряд, если он за кем-то закреплен $fltr .= "(status_id = " . $distribution_status_id . " OR author_id = " . $_SESSION["user"]["data"]["id"] . ")"; // $fltr .= "(status_id IN(" . $distribution_status_id . ", " . get_status_id_by_iname('WAITING_PREPAYMENT') . ") OR author_id = " . $_SESSION["user"]["data"]["id"] . ")"; if ($_SESSION['cgui_filcol_ord']['selset'] != "std2") { //Если выбран набор "мои заказы" - пропускаем фильтрацию по дисциплинам $author_disciplines = db::get_single_values_string("SELECT discipline_id FROM " . TBL_PREF . "author_to_discipline WHERE author_id = " . $_SESSION["user"]["data"]["id"]); if (!empty($author_disciplines)) { $fltr .= " AND disc_id IN(" . $author_disciplines . ")"; } } } elseif ($_SESSION["user"]["data"]["group_id"] == 5) { $delivery_boy_orders = array(); foreach (db::get_arrays("SELECT order_id FROM " . TBL_PREF . "data_visits WHERE user_id = " . db::input($_SESSION["user"]["data"]["id"])) as $res_order) { $delivery_boy_orders[] = $res_order['order_id']; } if ($fltr != "") { $fltr .= " AND "; } $fltr .= "id IN (" . join(', ', $delivery_boy_orders) . ")"; } if (!empty($fltr) && !empty($search_filter)) { $result_filter = $search_filter . ' AND ' . $fltr; } elseif (!empty($fltr)) { $result_filter = $fltr; } elseif (!empty($search_filter)) { $result_filter = $search_filter; } else { $result_filter = '';
<?php use Components\Classes\db; require_once '../../includes/application_top.php'; if (!$_SESSION["user"]["auth"]) { die("запрещено"); } if (!isset($_REQUEST["num"])) { die("нет данных"); } $num = intval($_REQUEST["num"]); $message = db::get_single_row("SELECT * FROM " . TABLE_MESSAGES . " WHERE id = " . db::input($num) . " AND (creator_id = 'u" . $_SESSION["user"]["data"]["id"] . "' OR addr = 'u" . $_SESSION["user"]["data"]["id"] . "')"); if (!$message) { die("сообщение не найдено"); } $tp = "i"; if ($message["addr"] != "u" . $_SESSION["user"]["data"]["id"]) { $tp = "o"; } if ($message["basket"]) { $tp = "b"; } die("<p><input type='button' value='Перейти' onclick='document.location.href=\"?section=mls&subsection=2&type=" . $tp . "&read=" . $num . "\"'></p>" . text_to_html($message["text"]));
public static function getDisciplines($napravl_id) { return db::get_single_values_array("SELECT discipline_id FROM " . TABLE_DISCIPLINE_TO_NAPRAVL . " WHERE napravl_id = " . db::input($napravl_id)); }
function impdiscip_exec($Frm, $Err) { if (!$Err) { $v = $Frm->GetValue(0); if (!strpos($v["type"], "ms-excel")) { $Frm->_gui->informer->ERR("Неправильный тип файла"); page_reloadSubSec(); } else { $s = ""; if ($Frm->GetValue(1)) { db::truncate(TABLE_DISCIPLINE); db::truncate(TABLE_DISCIPLINE_TO_NAPRAVL); db::truncate(TABLE_AUTHOR_TO_DISCIPLINE); $s = "Таблица очищена. "; } require_once DIR_FS_DOCUMENT_ROOT . "/ext/PHPExcel/PHPExcel.php"; $loader = PHPExcel_IOFactory::load($v['tmp_name']); $loader->setActiveSheetIndex(0); $sheet = $loader->getActiveSheet(); $colNumber = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()); if ($colNumber < 1 or $colNumber > 2) { $Frm->_gui->informer->ERR("В таблице должно быть от 1 до 2 колонок(сейчас " . $colNumber . ")"); page_reloadSubSec(); } $rowIterator = $sheet->getRowIterator(); $addcnt = 0; foreach ($rowIterator as $row) { // Получили ячейки текущей строки и обойдем их в цикле $cellIterator = $row->getCellIterator(); foreach ($cellIterator as $cell) { $value = trim($cell->getValue()); $color = $sheet->getStyle($cell->getCoordinate())->getFill()->getEndColor()->getRGB(); if ($color == '000000') { $napravl = db::get_single_row("SELECT * FROM " . TABLE_NAPRAVL . " WHERE LOWER(name) = '" . db::input(strtolower($value)) . "'"); if ($napravl) { $napravl_id = $napravl['id']; } else { $napravl_id = Napravl::create(array('name' => $value)); } } else { if (empty($napravl_id)) { continue 2; } $discipline = db::get_single_row("SELECT * FROM " . TABLE_DISCIPLINE . " WHERE LOWER(name) = '" . db::input(strtolower($value)) . "'"); if ($discipline) { Disciplines::addToNaprav($discipline['id'], $napravl_id); continue 2; } else { $discipline_id = Discipline::create(array('name' => $value)); Disciplines::addToNaprav($discipline_id, $napravl_id); $addcnt++; } } } } $Frm->_gui->informer->OK($s . "Добавлено " . $addcnt . " строк"); page_reloadSubSec(); } } }
if (!empty($searchWhere)) { $searchWhere .= ' OR'; } $searchWhere .= " referrer_phone LIKE '%" . db::input($_REQUEST['search_phone']) . "%'"; } if (!empty($_REQUEST['search_city'])) { if (!empty($searchWhere)) { $searchWhere .= ' OR'; } $searchWhere .= " referrer_city LIKE '%" . db::input($_REQUEST['search_city']) . "%'"; } if (!empty($_REQUEST['search_referrer'])) { if (!empty($searchWhere)) { $searchWhere .= ' OR'; } $searchWhere .= " referrer_code LIKE '%" . db::input($_REQUEST['search_referrer']) . "%'"; } } $sp->AddHTML("<div style='margin-left: 4px; margin-bottom: 5px; text-align:left'>"); $sp->AddHTML("<form method='post'>"); $sp->AddHTML("<input type='hidden' name='kln_search' value='1'>"); $sp->AddHTML("<label class='search_field'>по номеру<br/>"); $sp->AddHTML("<input type='text' name='search_id' style='width:100px;' value='" . (!empty($_REQUEST['search_id']) ? $_REQUEST['search_id'] : '') . "'>"); $sp->AddHTML("</label>"); $sp->AddHTML("<label class='search_field'>по имени<br/>"); $sp->AddHTML("<input type='text' name='search_name' style='width:100px;' value='" . (!empty($_REQUEST['search_name']) ? $_REQUEST['search_name'] : '') . "'>"); $sp->AddHTML("</label>"); $sp->AddHTML("<label class='search_field'>по почте<br/>"); $sp->AddHTML("<input type='text' name='search_mail' style='width:100px;' value='" . (!empty($_REQUEST['search_mail']) ? $_REQUEST['search_mail'] : '') . "'>"); $sp->AddHTML("</label>"); $sp->AddHTML("<label class='search_field'>по телефону<br/>");
function edit_offer($Frm, $Err) { if (!$Err) { $order_id = $Frm->GetNmValueI("order_id"); $order_info = Order::find($order_id); if ($order_info['cost_auth'] != 0) { $price = $order_info['cost_auth']; } else { $price = $Frm->GetNmValueI("price"); } db::update(TABLE_AUTHOR_OFFERS, array('price' => $price, 'comment' => $Frm->GetNmValueH("comment")), "order_id = " . db::input($Frm->GetNmValueI("order_id")) . " AND author_id = " . db::input($Frm->GetNmValueI("author_id"))); $Frm->_gui->OK("Предложение обновлено"); page_reloadSubSec(); } }
public static function deleteDisciplines($author_id) { db::delete(TABLE_AUTHOR_TO_DISCIPLINE, 'author_id = ' . db::input($author_id)); }
function add_city_exec($Frm, $Err) { if (!$Err) { $name = str_replace("'", '"', htmlspecialchars($Frm->GetValue(0))); if (db::get_single_value("SELECT COUNT(*) FROM " . TABLE_CITIES . " WHERE name = '" . db::input($name) . "'")) { $Frm->_gui->informer->ERR("Запись существует"); page_reloadAll(); } db::insert(TABLE_CITIES, array('name' => $name)); $Frm->_gui->informer->OK("Добавлено"); page_reloadSubSec(); } }
$stat_tbl = $GUI->Table("cabinet_orders_stats" . $_SESSION["frame"]["client"]["id"]); $stat_tbl->Width = "50%"; $column = $stat_tbl->NewColumn(); $column->Caption = "Итого"; $column->Key = "id"; $column = $stat_tbl->NewColumn(); $column->Caption = "Стоимость"; $column->Key = "client_price"; $column = $stat_tbl->NewColumn(); $column->Caption = "Оплачено"; $column->Key = "client_payed"; $column = $stat_tbl->NewColumn(); $column->Caption = "Долг"; $column->Key = "client_debt"; $result = array('id' => '', 'client_price' => 0, 'client_payed' => 0, 'client_debt' => 0); foreach (db::get_arrays("SELECT cost_kln, oplata_kln FROM " . TABLE_ORDERS . " WHERE klient_id = " . db::input($_SESSION["frame"]["client"]["id"])) as $row) { $result['client_price'] += $row['cost_kln']; $result['client_payed'] += $row['oplata_kln']; $result['client_debt'] += $row['cost_kln'] - $row['oplata_kln']; } $stat_tbl->AddRow($result, "id"); echo '<center>'; echo $GUI->tables[1]->PrintTable(); echo '</center>'; } else { echo "У Вас нет заказов"; } } } function get_client_debt($value, $row, $table, &$info) {
<?php use Components\Classes\db; require_once '../../includes/application_top.php'; if (!$_SESSION["user"]["auth"]) { die("запрещено"); } if (db::get_single_value("SELECT id FROM " . TABLE_MESSAGES . " WHERE addr = 'u" . db::input($_SESSION["user"]["data"]["id"]) . "' AND readed = '0' AND basket = '0'")) { die("1"); } else { die("0"); }
$usrs = array(); $usrs[0] = "-выберите-"; $ruk_group = Role::findOneBy(array('name' => 'Руководитель')); $elder_manager_group = Role::findOneBy(array('name' => 'Старший менеджер')); foreach ($data_users as $u) { if ($u["black_list"]) { continue; } if ($u["group_id"] == $ruk_group['id'] || $u["group_id"] == $elder_manager_group['id']) { $usrs[$u["id"]] = sotr_getFullName($u["id"]); } } $f = $frm->Select(310, $ypos, 278, $usrs, "", $filial["user_id"]); $f->linkName = 'manager'; $f->AddValidator(new CGUI_VALIDATOR_NOZERO()); $h = $frm->Hidden(db::get_single_values_string("SELECT city_id FROM " . TBL_PREF . "filial_to_city WHERE filial_id = " . db::input($filial['id']), '_')); $h->linkName = 'city'; city_modal($h->idname, $id); $b = $frm->Button("Города", 10, $ypos += 30, 70); $b->Event = 'open_cities("' . $h->idname . '", "' . $GUI->Vars["city_modal_form"]->idname . '");'; $frm->Label("Email филиала", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 573, $filial["email"]); $t->linkName = 'email'; $frm->Label("Адрес сайта", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 573, $filial["web"]); $t->linkName = 'url'; $frm->Label("Путь к форме заказа", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 573, $filial["order_form_path"]); $t->linkName = 'order_form_path'; $frm->Label("Описание", 10, $ypos += 30); $t = $frm->TextArea(10, $ypos += 20, 573, 50, $filial["about"]);
<?php use Components\Classes\db; if (!empty($_REQUEST['term'])) { echo json_encode(array_unique(db::get_single_values_array("SELECT `name` FROM " . TABLE_EXPENSES . " WHERE `name` LIKE '%" . db::input($_REQUEST['term']) . "%'"))); die; }
<div class="cgui_form_text" style="width: 530px; height: 30px; margin-left:50px; margin-top: 50px;"> <input type="text" value="{$subject}" name="subject" style="position: absolute; width:530px;"> </div> <div class="cgui_form_label" style="margin-left: 10px; margin-top: 90px;">Текст</div> <div class="cgui_form_text" style="width: 530px; height: 100px; margin-left:50px; margin-top: 90px;"> <textarea name="text" style="position: absolute; width:530px; height:100px"></textarea> </div> <button class="cgui_form_button" style="width: 100px; margin-left: 250px; margin-top: 210px">Отправить</button> </form></div> HTML; die; } $messages = db::get_assoc_arrays("SELECT * FROM " . TABLE_MESSAGES . " WHERE addr = 'k" . db::input($_SESSION['frame']['client']["id"]) . "' OR creator_id = 'k" . db::input($_SESSION['frame']['client']["id"]) . "' ORDER BY created DESC"); $output_messages = $readed_messages = $unreded_messages = array(); foreach ($messages as $o) { if ($o["readed"]) { $readed_messages[$o["id"]] = $o; } else { $unreded_messages[$o["id"]] = $o; } if ($o['creator_id'] == 'k' . $_SESSION['frame']['client']["id"]) { $output_messages[$o["id"]] = $o; } } function print_messages_table($ms) { $cnt = 0; $out = "";
private static function generate_where_clause($params = array()) { if (!count($params)) { return ' 1'; } $result = ''; foreach ($params as $key => $value) { if (empty($value)) { continue; } if (empty($result)) { $result .= $key . " = '" . db::input($value) . "'"; } else { $result .= " AND " . $key . " = '" . db::input($value) . "'"; } } return empty($result) ? '1' : $result; }
<?php use Components\Classes\db; $client_change_history = db::get_single_row("SELECT * FROM " . TABLE_CLIENTS_HISTORY . " WHERE id = " . db::input($_REQUEST['change'])); /******************** before edit start ********************/ $h = 580; $frm = $GUI->Form("Данные о клиенте до изменений", 400, $h); $frm->VLine(10, $h - 80, 380); $b = $frm->Button("Назад", 155, $h - 60, 100); $b->Event = "document.location.href=\"?section=kln&subsection=2&kln_id=" . $_REQUEST['kln_id'] . "&action=history_table\""; $ypos = 10; $frm->Label("Имя", 10, $ypos); $t = $frm->Text(10, $ypos += 20, 380, $client_change_history["fio_old"]); //1 $t->linkName = "fio"; $frm->Label("Филиал", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 380, get_filial_name($client_change_history["filial_id_old"])); //1 $t->linkName = "filial_id"; $before_edit_pass = '******'; $frm->Label("Пароль", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 380, $before_edit_pass); //1 $t->linkName = "hpwd"; $frm->Label("Почта", 10, $ypos += 30); $t = $frm->Text(10, $ypos += 20, 180, $client_change_history["email_old"]); //4 $t->linkName = "email"; $frm->Label("Телефон", 210, $ypos - 20); $t = $frm->Text(210, $ypos, 180, $client_change_history["telnum_old"]); //5
/** * @deprecated * @return array */ function kln_getrawlist() { if ($_SESSION["user"]["data"]["group_id"] == 1 || $_SESSION["user"]["data"]["group_id"] == 0) { $sql = "SELECT * FROM " . TABLE_CLIENTS; } else { $sql = "SELECT * FROM " . TABLE_CLIENTS . " WHERE filial_id = " . db::input($_SESSION["user"]["data"]["filial_id"]); } return db::get_assoc_arrays($sql); }
public static function getAuthors($discipline_id) { return db::get_assoc("\n SELECT u.id, u.fio\n FROM " . TABLE_USERS . " u\n JOIN " . TABLE_AUTHOR_TO_DISCIPLINE . " atd ON atd.author_id = u.id\n WHERE\n u.group_id in ( " . Author::ROLE_ID . " ) AND\n u.blocked = 0 AND\n u.black_list = 0 AND\n atd.discipline_id = " . db::input($discipline_id)); }
function delete_city_to_filial($filial_id) { db::delete('filial_to_city', 'filial_id = ' . db::input($filial_id)); }
$result[] = 'Оплачено'; Order::update($_GET['order_id'], array('referrer_payment_date' => date('Y-m-d H:i:s'))); break; case 'oplata_kln': case 'cost_kln': case 'cost_auth': case 'author_paid': case 'company_paid': case 'about_mng': //коментарий $result[] = $value = $_GET['value']; break; case 'time_auth': $value = utils_cvt_date2i(str_replace('.', '-', $_GET['value'])); $result[] = $_GET['value']; $author_info = db::get_single_row("\n SELECT u.id, u.email, u.fio\n FROM " . TABLE_USERS . " u\n JOIN " . TABLE_ORDERS . " o ON o.author_id = u.id\n WHERE o.id = " . db::input($_GET['order_id']) . "\n "); if ($author_info) { // Author::sendEmail($_GET['order_id'], array($author_info['id']), '№' . $_GET['order_id'] . ' ИЗМЕНИЛАСЬ ДАТА', '№' . $_GET['order_id'] . ' ИЗМЕНИЛАСЬ ДАТА на ' . $_GET['value']); $message_id = mls_Send("u" . $author_info['id'], "u" . $_SESSION["user"]["data"]["id"], '№' . $_GET['order_id'] . ' ИЗМЕНИЛАСЬ ДАТА', '№' . $_GET['order_id'] . ' ИЗМЕНИЛАСЬ ДАТА на ' . $_GET['value'], 1, 0); Author::enqueue_message_to_email($message_id, array($author_info['id']), \Components\Entity\EmailNotification::TO_AUTHOR_ON_ORDER_CHANGE); } break; case 'debt_to_author': $bDoUpdate = false; $orders = explode(',', $_GET['order_id']); foreach ($orders as $order_id) { $order_id = trim($order_id); if (empty($order_id)) { continue; } $order_info = get_order_info($order_id);
<?php use Components\Classes\db; if (!empty($_REQUEST['term']) && !empty($_REQUEST['entity'])) { $result = array(); switch ($_REQUEST['entity']) { case 'disciplina': $result = db::get_single_values_array("SELECT `name` FROM " . TABLE_DISCIPLINE . " WHERE `name` LIKE '" . db::input($_REQUEST['term']) . "%' ORDER BY `name`"); break; } echo json_encode(array_unique($result)); die; }