Esempio n. 1
0
function searchHandler()
{
    $terms = trim($_REQUEST['q']);
    if (!strlen($terms)) {
        throw new InvalidRequestArgException('q', $_REQUEST['q'], 'Search string cannot be empty.');
    }
    renderSearchResults($terms, searchEntitiesByText($terms));
}
Esempio n. 2
0
File: api.php Progetto: xtha/salt
     if (!in_array($_REQUEST['dict_value'], $words)) {
         throw new InvalidArgException('dict_value', $_REQUEST['dict_value'], "invalid argument: no such value in chapter ID " . $_REQUEST['chapter_no']);
     }
     usePreparedDeleteBlade('Dictionary', array('chapter_id' => $_REQUEST['chapter_no'], 'dict_value' => $_REQUEST['dict_value']));
     sendAPIResponse(array(), array('message' => 'dictionary entry deleted successfully', 'chapter_no' => $_REQUEST['chapter_no'], 'dict_value' => $_REQUEST['dict_value']));
     break;
     // perform a generic search
     //    UI equivalent: /index.php?page=search
     //    UI handler: searchEntitiesByText()
 // perform a generic search
 //    UI equivalent: /index.php?page=search
 //    UI handler: searchEntitiesByText()
 case 'search':
     require_once 'inc/init.php';
     assertStringArg('term', TRUE);
     sendAPIResponse(searchEntitiesByText($_REQUEST['term']));
     break;
     // <<DESCRIPTION>>
     //    UI equivalent: /index.php?page=
     //    UI handler: ()
     //case '':
     //        require_once 'inc/init.php';
     //        ...do stuff...
     //        sendAPIResponse();
     //        break;
 // <<DESCRIPTION>>
 //    UI equivalent: /index.php?page=
 //    UI handler: ()
 //case '':
 //        require_once 'inc/init.php';
 //        ...do stuff...