Skip to content

Commit a181fd0

Browse files
committed
AjaxSearch 1.12.1 Security Fix was released
It contains an important security fix for previous Ajax Search versions. It is highly recommended Update to AjaxSearch 1.12.1 from the Extras Module or downloading from https://github.com/extras-evolution/ajaxSearch/releases/tag/1.12.1
1 parent 4851d74 commit a181fd0

135 files changed

Lines changed: 12262 additions & 4225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/modules/evogallery/js/uploadify/uploadify.php

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#Changelog:
2+
27-oct-18 (1.12.1)
3+
- Some refactor
4+
- Security Fix
5+
6+
11-jul-17 (1.11.0)
7+
- Refactor, no more use index-ajax.php
8+
9+
12-apr-16 (1.10.2)
10+
11+
- Bug fixes
12+
- see Github 05.06.14 - 12.04.16: https://github.com/modxcms/evolution/commits/develop/assets/snippets/ajaxSearch
13+
14+
05-jun-14 (1.10.1)
15+
16+
- Security/Bug fixes
17+
18+
27-mar-13 (1.10.0)
19+
20+
- Security/Bug fixes
21+
22+
26-sep-12 (1.9.3)
23+
24+
- Bug fixing
25+
- Removed ajaxsearch's own striptags functions and substituted the use of $modx->stripTags
26+
- minimum chars allowed to 2
27+
28+
05-dec-10 (1.9.2)
29+
30+
- Bug fixing
31+
32+
30-aug-10 (1.9.2)
33+
34+
- Bug fixing
35+
36+
18-may-10 (1.9.0)
37+
38+
- Completely refactored - MVC model implemented
39+
- Defines categories and display of group of results
40+
- Several AS call on same page
41+
- parents (in / not in), documents (in / not in)
42+
- Custom output
43+
- Filtering search results by tv name
44+
- Filter features (allow to set up specific search forms)
45+
- Bug fixing
46+
47+
20-oct-09 (1.8.4)
48+
49+
- Sites and subsites notions
50+
- Defines categories and display of group of results
51+
- Several AS call on same page
52+
- Bug fixing
53+
54+
14-jun-09 (1.8.4)
55+
56+
- Sites and subsites notions
57+
- Defines categories and display of group of results
58+
- Several AS call on same page
59+
- Bug fixing
60+
61+
08-jun-09 (1.8.3)
62+
63+
- Bug fixing
64+
- The number of results is available with the [+as.resultNumber+] placeholder
65+
66+
01-mar-09 (1.8.2)
67+
68+
- liveSearch parameter renamed
69+
- Initialisation of configuration parameters is modified
70+
- mbstring parameter added
71+
- Limit the amount of keywords that will be queried by a search
72+
- Capturing failed search criteria and search logs
73+
- Compatibility with mootools 1.2.1 library
74+
- Compatibility with jquery library
75+
- Always display paging parameter added
76+
- Bug fixing
77+
78+
02-oct-08 (1.8.1)
79+
80+
- subSearch added.
81+
- mysql query redesigned.
82+
- whereSearch parameter improved. Fields definition added
83+
- withTvs parameter added. specify the search in Tvs
84+
- metacharacter for filter
85+
- improvement of the searchword list parameter
86+
- debug - file and firebug console
87+
- Bug fixing
88+
89+
21 -July-08 (1.8.0)
90+
91+
- define where to do the search (&whereSearch parameter)
92+
- define which fields to use for the extracts (&extract parameter)
93+
- use AjaxSearch with non MOdx tables
94+
- order the results with the &order parameter
95+
- define the ranking value and sort the results with it
96+
- filter the unwanted documents of the search
97+
- define the extract eliipsis
98+
- define the extract separator
99+
- Extended place holder templating and template parameters
100+
- Improvement of the extract algorithm
101+
- Define the number of extracts displayed in the search results
102+
- Use of &advSearch parameter available from the front-end by the end user
103+
- Choose your search term from a predefined search word list
104+
- stripInput user function
105+
- stripOutput user function
106+
- Configuration file and $__ global parameters
107+
- snippet code completely refactored and objectified
108+
- Bugfixes regarding Quoted searchstring
109+
110+
06-Mar-08 (1.7.1)
111+
112+
- Advanced search (partial & relevance)
113+
- Search in hidden documents from menu
114+
- List of Ids limited to parent-documents ids in javascript
115+
- Code cleaning
116+
117+
06-Jan-08 (1.7)
118+
119+
- Added custom config file
120+
- Added list of parent-documents where to search
121+
- Added opacity parameter (between 0 (transparent) and 1 (opaque)
122+
- Added bugfixes regarding opacity with IE
123+
- Using of DBAPI function instead of deprecated function
124+
- Charset troubles corrected
125+
126+
22-Jan-07 (1.6)
127+
128+
- Added templating support (includes/templates.inc.php)
129+
- Added language support
130+
- Switched from prototype/scriptaculous to Mootools
131+
132+
03-Jan-07
133+
134+
- Added many bugfixes/additions from AjaxSearch forum
135+
136+
18-Sep-06
137+
138+
- Added code to only show results for allowed pages
139+
140+
05-May-06
141+
142+
- Added liveSearch functionality and new parameter
143+
144+
21-Apr-06
145+
146+
- Added code to make it compatible with tagcloud snippet
147+
148+
20-Apr-06
149+
150+
- Added code from eastbind & japanese community for other language searching
151+
152+
04-Apr-06
153+
154+
- Added search term highlighting
155+
156+
01-Apr-06
157+
158+
- initial commit into SVN
159+
160+
30-Mar-06
161+
162+
- initial work based on FSF_ajax from KyleJ

assets/snippets/ajaxSearch/README.md

Lines changed: 320 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/** ---------------------------------------------------------------------------
3+
* Snippet: AjaxSearch
4+
* -----------------------------------------------------------------------------
5+
* ajaxSearchPopup.php
6+
*
7+
* @author Coroico - www.evo.wangba.fr
8+
* @version 1.12.1
9+
* @date 27/10/2018
10+
*
11+
*/
12+
13+
/*!
14+
* getUserConfigName : parse the non default configuration file name from ucfg string
15+
*/
16+
function getUserConfigName($ucfg) {
17+
preg_match('/&config=`([^`]*)`/', $ucfg, $matches);
18+
return $matches[1];
19+
}
20+
21+
define('MODX_API_MODE', true);
22+
include_once(__DIR__ . '/../../../index.php');
23+
$modx->db->connect();
24+
if (empty($modx->config)) {
25+
$modx->getSettings();
26+
}
27+
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) ||
28+
(strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest') ||
29+
strpos($_SERVER['HTTP_REFERER'], $modx->getConfig('site_url')) !== 0
30+
) {
31+
$modx->sendErrorPage();
32+
}
33+
34+
if (isset($_POST['search'])) {
35+
define('AS_VERSION', '1.12.1');
36+
define('AS_SPATH', 'assets/snippets/ajaxSearch/');
37+
define('AS_PATH', MODX_BASE_PATH . AS_SPATH);
38+
39+
if (!isset($_POST['as_version']) || (strip_tags($_POST['as_version']) !== AS_VERSION)) {
40+
$output = 'AjaxSearch version obsolete.' .
41+
'<br />' .
42+
'Please check the snippet code in MODX manager.';
43+
} else {
44+
include_once AS_PATH . 'classes/ajaxSearch.class.inc.php';
45+
$tstart = $modx->getMicroTime();
46+
$default = AS_PATH . 'configs/default.config.php';
47+
48+
if (file_exists($default)) {
49+
include $default;
50+
} else {
51+
return '<h3>' .
52+
'AjaxSearch error: $default not found !' .
53+
'<br />' .
54+
'Check the existing of this file!' .
55+
'</h3>';
56+
}
57+
58+
if (!isset($dcfg)) {
59+
return '<h3>' .
60+
'AjaxSearch error: default configuration array not defined in $default!' .
61+
'<br />' .
62+
'Check the content of this file!' .
63+
'</h3>';
64+
}
65+
66+
$ucfg = isset($_POST['ucfg']) && is_scalar($_POST['ucfg']) ? $_POST['ucfg'] : '';
67+
$config = getUserConfigName(strip_tags($ucfg));
68+
69+
// Load the custom functions of the custom configuration file if needed
70+
if ($config) {
71+
if (strpos($config, '@FILE:') !== 0) {
72+
// remove all not alphanumeric chars exept underscore and minus in the filename
73+
$config = preg_replace('/[^a-zA-Z0-9_-]/i', '', $config);
74+
$lconfig = AS_PATH . "configs/{$config}.config.php";
75+
if (file_exists($lconfig)) {
76+
include $lconfig;
77+
} else {
78+
return '<h3>' .
79+
'AjaxSearch error: ' . $lconfig . ' not found !' .
80+
'<br />' .
81+
'Check your config parameter or your config file name!' .
82+
'</h3>';
83+
}
84+
} else {
85+
return '<h3>' .
86+
'AjaxSearch error: @FILE: prefix not allowed !' .
87+
'<br />' .
88+
'Check your config parameter or your config file name!' .
89+
'</h3>';
90+
}
91+
}
92+
if ($dcfg['version'] !== AS_VERSION) {
93+
return '<h3>' .
94+
'AjaxSearch error: Version number mismatch. Check the content of the default configuration file!' .
95+
'</h3>';
96+
}
97+
$as = new AjaxSearch();
98+
$output = $as->run($tstart, $dcfg);
99+
header('Content-type: text/html; charset=' . $modx->getConfig('modx_charset'));
100+
}
101+
echo $output;
102+
}

0 commit comments

Comments
 (0)