[22201] | 1 | <?php |
---|
| 2 | |
---|
| 3 | define('PHPWG_ROOT_PATH','../../'); |
---|
| 4 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
| 5 | |
---|
| 6 | if (!defined('RVAC_ID')) { |
---|
[22304] | 7 | set_status_header(501); |
---|
| 8 | exit; |
---|
[22201] | 9 | } |
---|
| 10 | |
---|
| 11 | include_once( 'functions.inc.php' ); |
---|
| 12 | |
---|
| 13 | $page['root_path'] = get_absolute_root_url(false); |
---|
| 14 | |
---|
| 15 | $data = rvac_get_index(); |
---|
| 16 | |
---|
| 17 | if (isset($_GET['txt'])) { |
---|
[22304] | 18 | foreach($data['src'] as $item) |
---|
| 19 | echo implode("\t", $item)."\n"; |
---|
| 20 | exit; |
---|
[22201] | 21 | } |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | $ds = str_replace( |
---|
[22304] | 25 | array('\\/', '"q":', '"label":', '"value":', '"w":'), |
---|
| 26 | array('/', 'q:', 'label:', 'value:', 'w:'), |
---|
| 27 | json_encode($data['src'])); |
---|
[22201] | 28 | $js = '$.extend(RVAC, { |
---|
[22304] | 29 | dataSource:'.$ds.', |
---|
| 30 | dataSourceAltLangIndex: '.$data['altLangIndex'].', |
---|
| 31 | roots: '.json_encode($data['roots']).', |
---|
| 32 | minForAltLang: 2, |
---|
| 33 | stopLookingAfter: 80, |
---|
| 34 | suggestions: 4, |
---|
[28181] | 35 | maxSuggestions: 8 |
---|
[22201] | 36 | }); |
---|
| 37 | $.each(RVAC.dataSource, function(i,item) { |
---|
[22304] | 38 | item.q = item.q || item.label.toLowerCase() |
---|
[22201] | 39 | }); |
---|
| 40 | RVAC.start && RVAC.start();'; |
---|
| 41 | |
---|
[22304] | 42 | header("Content-Type: application/javascript; charset=".get_pwg_charset()); |
---|
[22201] | 43 | echo $js; |
---|
| 44 | |
---|
| 45 | file_put_contents(PHPWG_ROOT_PATH.rvac_get_data_file(), $js); |
---|
| 46 | ?> |
---|