/usr/share/horde/ansel/lib/Ajax/Imple/LocationAutoCompleter.php is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <?php
/**
* Imple autocompleter for textual location data.
*
* Copyright 2009-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Ansel
*/
class Ansel_Ajax_Imple_LocationAutoCompleter extends Horde_Core_Ajax_Imple_AutoCompleter
{
/**
*/
protected function _getAutoCompleter()
{
global $injector, $session;
$opts = array(
'onSelect' => 'function (v) {' . $this->_params['map'] . '.ll = Ansel.ajax.locationAutoCompleter.geocache[v]; return v;}',
'tokens' => array()
);
/* Use ajax? */
if (!$session->exists('ansel', 'ajax_locationac')) {
try {
$results = $injector->getInstance('Ansel_Storage')->searchLocations();
$session->set('ansel', 'ajax_locationac', (count($results) > 50));
} catch (Ansel_Exception $e) {
Horde::log($e, 'ERR');
}
}
if ($session->get('ansel', 'ajax_locationac')) {
return new Horde_Core_Ajax_Imple_AutoCompleter_Ajax($opts);
}
if (empty($results)) {
$results = $injector->getInstance('Ansel_Storage')->searchLocations();
}
return new Horde_Core_Ajax_Imple_AutoCompleter_Local($results, $opts);
}
/**
*/
protected function _handleAutoCompleter($input)
{
$locs = array();
try {
$locs = $GLOBALS['injector']->getInstance('Ansel_Storage')->searchLocations($input);
} catch (Ansel_Exception $e) {
Horde::log($e, 'ERR');
}
return $locs;
}
}
|