<?php
require_once (dirname(__DIR__, 2) . '/init.php');
if (!m_admin_check()) {
    m_redirect(ADMIN_URL . '/login');
}
$db = new DB();
$action = m_u_g('action');
$action = trim($action, '/');
$lang = m_get_session('editor_lang');
$query = $db->table('posts')->where('lang', '=',$lang)->where('module_type', '=',$action)->where_set('title', 'LIKE', m_a_g('text'))->order('id', 'desc')->get();
$data = [];
if ($query['total_count'] != 0){
    foreach ($query['data'] as $item) {
        $data[$item['id']] = $item['title'];
    }

}else{
    $data = ['Veri Bulunamadı'];
}
echo json_encode($data);
