evolution-cms /
evolution
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
||
| 3 | exit(); |
||
| 4 | } |
||
| 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
||
| 6 | // Catch $_REQUEST['searchid'] for compatibility |
||
| 7 | if (isset($_REQUEST['searchid'])) { |
||
| 8 | $_REQUEST['searchfields'] = $_REQUEST['searchid']; |
||
| 9 | $_POST['searchfields'] = $_REQUEST['searchid']; |
||
| 10 | } |
||
| 11 | ?> |
||
| 12 | |||
| 13 | <script language="javascript"> |
||
| 14 | var actions = { |
||
| 15 | cancel: function() { |
||
| 16 | documentDirty = false; |
||
| 17 | document.location.href = 'index.php?a=2'; |
||
| 18 | } |
||
| 19 | }; |
||
| 20 | </script> |
||
| 21 | |||
| 22 | <h1> |
||
| 23 | <i class="fa fa-search"></i><?= $_lang['search_criteria'] ?> |
||
| 24 | </h1> |
||
| 25 | |||
| 26 | <?= ManagerTheme::getStyle('actionbuttons.static.cancel') ?> |
||
| 27 | |||
| 28 | <div class="tab-page"> |
||
| 29 | <div class="container container-body"> |
||
| 30 | <form action="index.php?a=71" method="post" name="searchform" enctype="multipart/form-data" class="form-group"> |
||
| 31 | <div class="row form-row"> |
||
| 32 | <div class="col-md-3 col-lg-2"><?= $_lang['search_criteria_top'] ?></div> |
||
| 33 | <div class="col-md-9 col-lg-10"> |
||
| 34 | <input name="searchfields" type="text" value="<?= entities(get_by_key($_REQUEST, 'searchfields', '', 'is_scalar'), $modx->getConfig('modx_charset')) ?>" /> |
||
| 35 | <small class="form-text"><?= $_lang['search_criteria_top_msg'] ?></small> |
||
| 36 | </div> |
||
| 37 | </div> |
||
| 38 | <div class="row form-row"> |
||
| 39 | <div class="col-md-3 col-lg-2"><?= $_lang['search_criteria_template_id'] ?></div> |
||
| 40 | <div class="col-md-9 col-lg-10"> |
||
| 41 | <?php |
||
| 42 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_templates')); |
||
| 43 | $option[] = '<option value="">' . $_lang['none'] . '</option>'; |
||
| 44 | $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : ''; |
||
| 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
||
| 46 | $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
||
| 47 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
||
| 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
||
| 50 | $option[] = sprintf('<option value="%s"%s>%s(%s)</option>', $row['id'], $selected, $templatename, $row['id']); |
||
| 51 | } |
||
| 52 | $tpls = sprintf('<select name="templateid">%s</select>', implode("\n", $option)); |
||
| 53 | ?> |
||
| 54 | <?= $tpls ?> |
||
| 55 | <small class="form-text"><?= $_lang['search_criteria_template_id_msg'] ?></small> |
||
| 56 | </div> |
||
| 57 | </div> |
||
| 58 | <div class="row form-row"> |
||
| 59 | <div class="col-md-3 col-lg-2">URL</div> |
||
| 60 | <div class="col-md-9 col-lg-10"> |
||
| 61 | <input name="url" type="text" value="<?= entities(get_by_key($_REQUEST,'url', '', 'is_scalar'), $modx->getConfig('modx_charset')) ?>" /> |
||
| 62 | <small class="form-text"><?= $_lang['search_criteria_url_msg'] ?></small> |
||
| 63 | </div> |
||
| 64 | </div> |
||
| 65 | <div class="row form-row"> |
||
| 66 | <div class="col-md-3 col-lg-2"><?= $_lang['search_criteria_content'] ?></div> |
||
| 67 | <div class="col-md-9 col-lg-10"> |
||
| 68 | <input name="content" type="text" value="<?= entities(get_by_key($_REQUEST, 'content', '', 'is_scalar'), $modx->getConfig('modx_charset')) ?>" /> |
||
| 69 | <small class="form-text"><?= $_lang['search_criteria_content_msg'] ?></small> |
||
| 70 | </div> |
||
| 71 | </div> |
||
| 72 | |||
| 73 | <a class="btn btn-success" href="javascript:;" onClick="document.searchform.submitok.click();"><i class="<?= $_style["actions_search"] ?>"></i> <?= $_lang['search'] ?> |
||
| 74 | </a> |
||
| 75 | <a class="btn btn-secondary" href="index.php?a=2"><i class="<?= $_style["actions_cancel"] ?>"></i> <?= $_lang['cancel'] ?></a> |
||
| 76 | <input type="submit" value="Search" name="submitok" style="display:none" /> |
||
| 77 | </form> |
||
| 78 | </div> |
||
| 79 | </div> |
||
| 80 | <?php |
||
| 81 | //TODO: сделать поиск по уму пока сделаю что б одно поле было для id,longtitle,pagetitle,alias далее нужно думаю добавить что б и в елементах искало |
||
|
0 ignored issues
–
show
Coding Style
Best Practice
introduced
by
Loading history...
|
|||
| 82 | if (isset($_REQUEST['submitok'])) { |
||
| 83 | $tbl_site_content = $modx->getDatabase()->getFullTableName('site_content'); |
||
| 84 | $tbldg = $modx->getDatabase()->getFullTableName('document_groups'); |
||
| 85 | |||
| 86 | $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, ManagerTheme::getCharset()); |
||
| 87 | $searchlongtitle = $modx->getDatabase()->escape(trim($_REQUEST['searchfields'])); |
||
| 88 | $search_alias = $modx->getDatabase()->escape(trim($_REQUEST['searchfields'])); |
||
| 89 | $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : ''; |
||
| 90 | $searchcontent = $modx->getDatabase()->escape($_REQUEST['content']); |
||
| 91 | |||
| 92 | $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type'; |
||
| 93 | |||
| 94 | $sqladd = ""; |
||
| 95 | |||
| 96 | // Handle Input "Search by exact URL" |
||
| 97 | $idFromAlias = false; |
||
| 98 | if (isset($_REQUEST['url']) && $_REQUEST['url'] !== '') { |
||
| 99 | $url = $modx->getDatabase()->escape($_REQUEST['url']); |
||
| 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
||
| 101 | $base_url = MODX_BASE_URL; |
||
| 102 | $site_url = MODX_SITE_URL; |
||
| 103 | $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
||
| 104 | if ($url[0] === '/') { |
||
| 105 | $url = preg_replace('@^' . $base_url . '@', '', $url); |
||
| 106 | } |
||
| 107 | if (substr($url, 0, 4) === 'http') { |
||
| 108 | $url = preg_replace('@^' . $site_url . '@', '', $url); |
||
| 109 | } |
||
| 110 | $idFromAlias = $modx->getIdFromAlias($url); |
||
| 111 | } |
||
| 112 | |||
| 113 | // Handle Input "Search in main fields" |
||
| 114 | if ($searchfields != '') { |
||
| 115 | |||
| 116 | /*start search by TV. Added Rising13*/ |
||
| 117 | $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
||
| 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
||
| 119 | $articul_result = $modx->getDatabase()->query($articul_query); |
||
| 120 | $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
||
| 121 | if(count($articul_id_array)>0){ |
||
| 122 | $articul_id = ''; |
||
| 123 | $i = 1; |
||
| 124 | foreach( $articul_id_array as $articul ) { |
||
| 125 | $articul_id.=$articul['contentid']; |
||
|
0 ignored issues
–
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces
This check looks for improperly formatted assignments. Every assignment must have exactly one space before and one space after the equals operator. To illustrate: $a = "a";
$ab = "ab";
$abc = "abc";
will have no issues, while $a = "a";
$ab = "ab";
$abc = "abc";
will report issues in lines 1 and 2. Loading history...
|
|||
| 126 | if($i !== count($articul_id_array)){ |
||
| 127 | $articul_id.=','; |
||
|
0 ignored issues
–
show
Equals sign not aligned correctly; expected 1 space but found 0 spaces
This check looks for improperly formatted assignments. Every assignment must have exactly one space before and one space after the equals operator. To illustrate: $a = "a";
$ab = "ab";
$abc = "abc";
will have no issues, while $a = "a";
$ab = "ab";
$abc = "abc";
will report issues in lines 1 and 2. Loading history...
|
|||
| 128 | } |
||
| 129 | $i++; |
||
| 130 | } |
||
| 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
||
| 132 | }else{ |
||
| 133 | $articul_id_query = ''; |
||
| 134 | } |
||
| 135 | /*end search by TV*/ |
||
| 136 | |||
| 137 | if (ctype_digit($searchfields)) { |
||
| 138 | $sqladd .= "sc.id='{$searchfields}'"; |
||
| 139 | if (strlen($searchfields) > 3) { |
||
| 140 | $sqladd .= $articul_id_query;//search by TV |
||
| 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
||
| 142 | } |
||
| 143 | } |
||
| 144 | if ($idFromAlias) { |
||
| 145 | $sqladd .= $sqladd != '' ? ' OR ' : ''; |
||
| 146 | $sqladd .= "sc.id='{$idFromAlias}'"; |
||
| 147 | |||
| 148 | } |
||
| 149 | |||
| 150 | $sqladd = $sqladd ? "({$sqladd})" : $sqladd; |
||
| 151 | |||
| 152 | if (!ctype_digit($searchfields)) { |
||
| 153 | $sqladd .= $sqladd != '' ? ' AND' : ''; |
||
| 154 | $sqladd .= " (sc.pagetitle LIKE '%{$searchfields}%'"; |
||
| 155 | $sqladd .= " OR sc.longtitle LIKE '%{$searchlongtitle}%'"; |
||
| 156 | $sqladd .= " OR sc.description LIKE '%{$searchlongtitle}%'"; |
||
| 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
||
| 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
||
| 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
||
| 160 | $sqladd .= $articul_id_query;//search by TV |
||
| 161 | $sqladd .= ")"; |
||
| 162 | } |
||
| 163 | } elseif ($idFromAlias) { |
||
| 164 | $sqladd .= " sc.id='{$idFromAlias}'"; |
||
| 165 | } |
||
| 166 | |||
| 167 | // Handle Input "Search by template ID" |
||
| 168 | if ($templateid !== '') { |
||
| 169 | $sqladd .= $sqladd != '' ? ' AND' : ''; |
||
| 170 | $sqladd .= " sc.template='{$templateid}'"; |
||
| 171 | } |
||
| 172 | |||
| 173 | // Handle Input "Search by content" |
||
| 174 | if ($searchcontent !== '') { |
||
| 175 | $sqladd .= $sqladd != '' ? ' AND' : ''; |
||
| 176 | $sqladd .= $searchcontent != '' ? " sc.content LIKE '%{$searchcontent}%'" : ''; |
||
| 177 | } |
||
| 178 | |||
| 179 | // get document groups for current user |
||
| 180 | if (!empty($modx->config['use_udperms']) && $sqladd) { |
||
| 181 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
||
| 182 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
||
| 183 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
||
| 184 | $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
||
| 185 | $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
||
| 186 | } |
||
| 187 | |||
| 188 | if ($sqladd) { |
||
| 189 | $sqladd .= ' GROUP BY sc.id'; |
||
| 190 | } |
||
| 191 | |||
| 192 | $where = $sqladd; |
||
| 193 | |||
| 194 | if ($where) { |
||
| 195 | $rs = $modx->getDatabase()->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
||
| 196 | $limit = $modx->getDatabase()->getRecordCount($rs); |
||
| 197 | } else { |
||
| 198 | $limit = 0; |
||
| 199 | } |
||
| 200 | |||
| 201 | ?> |
||
| 202 | <div class="container navbar"> |
||
| 203 | <?= $_lang['search_results'] ?> |
||
| 204 | </div> |
||
| 205 | |||
| 206 | <div class="tab-page"> |
||
| 207 | <div class="container container-body"> |
||
| 208 | <?php |
||
| 209 | if ($_GET['ajax'] != 1) { |
||
| 210 | |||
| 211 | if ($limit < 1) { |
||
| 212 | echo $_lang['search_empty']; |
||
| 213 | } else { |
||
| 214 | printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
||
| 215 | ?> |
||
| 216 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
||
| 217 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
||
| 218 | <thead> |
||
| 219 | <tr> |
||
| 220 | <th width="40"></th> |
||
| 221 | <th width="40" class="sortable"><b><?= $_lang['search_results_returned_id'] ?></b></th> |
||
| 222 | <th width="40"></th> |
||
| 223 | <th class="sortable"><b><?= $_lang['search_results_returned_title'] ?></b></th> |
||
| 224 | <th class="sortable"><b><?= $_lang['search_results_returned_desc'] ?></b></th> |
||
| 225 | </tr> |
||
| 226 | </thead> |
||
| 227 | <tbody> |
||
| 228 | <?php |
||
| 229 | // icons by content type |
||
| 230 | $icons = array( |
||
| 231 | 'application/rss+xml' => $_style["tree_page_rss"], |
||
| 232 | 'application/pdf' => $_style["tree_page_pdf"], |
||
| 233 | 'application/vnd.ms-word' => $_style["tree_page_word"], |
||
| 234 | 'application/vnd.ms-excel' => $_style["tree_page_excel"], |
||
| 235 | 'text/css' => $_style["tree_page_css"], |
||
| 236 | 'text/html' => $_style["tree_page_html"], |
||
| 237 | 'text/plain' => $_style["tree_page"], |
||
| 238 | 'text/xml' => $_style["tree_page_xml"], |
||
| 239 | 'text/javascript' => $_style["tree_page_js"], |
||
| 240 | 'image/gif' => $_style["tree_page_gif"], |
||
| 241 | 'image/jpg' => $_style["tree_page_jpg"], |
||
| 242 | 'image/png' => $_style["tree_page_png"] |
||
| 243 | ); |
||
| 244 | |||
| 245 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 246 | // figure out the icon for the document... |
||
| 247 | $icon = ""; |
||
| 248 | if ($row['type'] == 'reference') { |
||
| 249 | $icon .= $_style["tree_linkgo"]; |
||
| 250 | } elseif ($row['isfolder'] == 0) { |
||
| 251 | $icon .= isset($icons[$row['contenttype']]) ? $icons[$row['contenttype']] : $_style["tree_page_html"]; |
||
| 252 | } else { |
||
| 253 | $icon .= $_style['tree_folder_new']; |
||
| 254 | } |
||
| 255 | |||
| 256 | $tdClass = ""; |
||
| 257 | if ($row['published'] == 0) { |
||
| 258 | $tdClass .= ' class="unpublishedNode"'; |
||
| 259 | } |
||
| 260 | if ($row['deleted'] == 1) { |
||
| 261 | $tdClass .= ' class="deletedNode"'; |
||
| 262 | } |
||
| 263 | ?> |
||
| 264 | <tr> |
||
| 265 | <td class="text-center"> |
||
| 266 | <a href="index.php?a=3&id=<?= $row['id'] ?>" title="<?= $_lang['search_view_docdata'] ?>"><i class="<?= $_style['icons_resource_overview'] ?>" /></i></a> |
||
| 267 | </td> |
||
| 268 | <td class="text-right"><?= $row['id'] ?></td> |
||
| 269 | <td class="text-center"><?= $icon ?></td> |
||
| 270 | <?php |
||
| 271 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
||
| 272 | ?> |
||
| 273 | <td<?= $tdClass ?>> |
||
| 274 | <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['pagetitle'], 0, 70, ManagerTheme::getCharset()) . "..." : $row['pagetitle'] ?></a> |
||
| 275 | </td> |
||
| 276 | <td<?= $tdClass ?>><?= mb_strlen($row['description'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['description'], 0, 70, ManagerTheme::getCharset()) . "..." : $row['description'] ?></td> |
||
| 277 | <?php |
||
| 278 | } else { |
||
| 279 | ?> |
||
| 280 | <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
||
| 281 | <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
||
| 282 | <?php |
||
| 283 | } |
||
| 284 | ?> |
||
| 285 | </tr> |
||
| 286 | <?php |
||
| 287 | } |
||
| 288 | ?> |
||
| 289 | </tbody> |
||
| 290 | </table> |
||
| 291 | <?php |
||
| 292 | |||
| 293 | } |
||
| 294 | } else { |
||
| 295 | $output = ''; |
||
| 296 | |||
| 297 | //docs |
||
| 298 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
||
| 299 | $docscounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 300 | if ($docscounts > 0) { |
||
| 301 | $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
||
| 302 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 303 | $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '> |
||
|
0 ignored issues
–
show
!$row['published'] is of type boolean, but the function expects a string.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 304 | <a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . |
||
| 305 | highlightingCoincidence($row['pagetitle'], $_REQUEST['searchfields']) . ' <small>(' . highlightingCoincidence($row['id'], $_REQUEST['searchfields']) . ')</small>' . '<i class="fa fa-external-link"></i> |
||
| 306 | </a> |
||
| 307 | </li>'; |
||
| 308 | } |
||
| 309 | } |
||
| 310 | } |
||
| 311 | |||
| 312 | //templates |
||
| 313 | View Code Duplication | if ($modx->hasPermission('edit_template')) { |
|
| 314 | $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
||
| 315 | OR `templatename` like '%" . $searchfields . "%' |
||
| 316 | OR `description` like '%" . $searchfields . "%' |
||
| 317 | OR `content` like '%" . $searchfields . "%'"); |
||
| 318 | $templatecounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 319 | if ($templatecounts > 0) { |
||
| 320 | $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
||
| 321 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 322 | $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 323 | } |
||
| 324 | } |
||
| 325 | } |
||
| 326 | |||
| 327 | //tvs |
||
| 328 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
||
| 329 | $rs = $modx->getDatabase()->select( |
||
| 330 | "id,name,locked", |
||
| 331 | $modx->getDatabase()->getFullTableName('site_tmplvars'), |
||
| 332 | "`id` like '%" . $searchfields . "%' |
||
| 333 | OR `name` like '%" . $searchfields . "%' |
||
| 334 | OR `description` like '%" . $searchfields . "%' |
||
| 335 | OR `type` like '%" . $searchfields . "%' |
||
| 336 | OR `elements` like '%" . $searchfields . "%' |
||
| 337 | OR `display` like '%" . $searchfields . "%' |
||
| 338 | OR `display_params` like '%" . $searchfields . "%' |
||
| 339 | OR `default_text` like '%" . $searchfields . "%'"); |
||
| 340 | $tvscounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 341 | if ($tvscounts > 0) { |
||
| 342 | $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
||
| 343 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 344 | $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 345 | } |
||
| 346 | } |
||
| 347 | } |
||
| 348 | |||
| 349 | //Chunks |
||
| 350 | View Code Duplication | if ($modx->hasPermission('edit_chunk')) { |
|
| 351 | $rs = $modx->getDatabase()->select( |
||
| 352 | "id,name,locked,disabled", |
||
| 353 | $modx->getDatabase()->getFullTableName('site_htmlsnippets'), |
||
| 354 | "`id` like '%" . $searchfields . "%' |
||
| 355 | OR `name` like '%" . $searchfields . "%' |
||
| 356 | OR `description` like '%" . $searchfields . "%' |
||
| 357 | OR `snippet` like '%" . $searchfields . "%'"); |
||
| 358 | $chunkscounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 359 | if ($chunkscounts > 0) { |
||
| 360 | $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
||
| 361 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 362 | $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 363 | } |
||
| 364 | } |
||
| 365 | } |
||
| 366 | |||
| 367 | //Snippets |
||
| 368 | View Code Duplication | if ($modx->hasPermission('edit_snippet')) { |
|
| 369 | $rs = $modx->getDatabase()->select( |
||
| 370 | "id,name,locked,disabled", |
||
| 371 | $modx->getDatabase()->getFullTableName('site_snippets'), |
||
| 372 | "`id` like '%" . $searchfields . "%' |
||
| 373 | OR `name` like '%" . $searchfields . "%' |
||
| 374 | OR `description` like '%" . $searchfields . "%' |
||
| 375 | OR `snippet` like '%" . $searchfields . "%' |
||
| 376 | OR `properties` like '%" . $searchfields . "%' |
||
| 377 | OR `moduleguid` like '%" . $searchfields . "%'"); |
||
| 378 | $snippetscounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 379 | if ($snippetscounts > 0) { |
||
| 380 | $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
||
| 381 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 382 | $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 383 | } |
||
| 384 | } |
||
| 385 | } |
||
| 386 | |||
| 387 | //plugins |
||
| 388 | View Code Duplication | if ($modx->hasPermission('edit_plugin')) { |
|
| 389 | $rs = $modx->getDatabase()->select( |
||
| 390 | "id,name,locked,disabled", |
||
| 391 | $modx->getDatabase()->getFullTableName('site_plugins'), |
||
| 392 | "`id` like '%" . $searchfields . "%' |
||
| 393 | OR `name` like '%" . $searchfields . "%' |
||
| 394 | OR `description` like '%" . $searchfields . "%' |
||
| 395 | OR `plugincode` like '%" . $searchfields . "%' |
||
| 396 | OR `properties` like '%" . $searchfields . "%' |
||
| 397 | OR `moduleguid` like '%" . $searchfields . "%'"); |
||
| 398 | $pluginscounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 399 | if ($pluginscounts > 0) { |
||
| 400 | $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
||
| 401 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 402 | $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 403 | } |
||
| 404 | } |
||
| 405 | } |
||
| 406 | |||
| 407 | //modules |
||
| 408 | View Code Duplication | if ($modx->hasPermission('edit_module')) { |
|
| 409 | $rs = $modx->getDatabase()->select( |
||
| 410 | "id,name,locked,disabled", |
||
| 411 | $modx->getDatabase()->getFullTableName('site_modules'), |
||
| 412 | "`id` like '%" . $searchfields . "%' |
||
| 413 | OR `name` like '%" . $searchfields . "%' |
||
| 414 | OR `description` like '%" . $searchfields . "%' |
||
| 415 | OR `modulecode` like '%" . $searchfields . "%' |
||
| 416 | OR `properties` like '%" . $searchfields . "%' |
||
| 417 | OR `guid` like '%" . $searchfields . "%' |
||
| 418 | OR `resourcefile` like '%" . $searchfields . "%'"); |
||
| 419 | $modulescounts = $modx->getDatabase()->getRecordCount($rs); |
||
| 420 | if ($modulescounts > 0) { |
||
| 421 | $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
||
| 422 | while ($row = $modx->getDatabase()->getRow($rs)) { |
||
| 423 | $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
||
| 424 | } |
||
| 425 | } |
||
| 426 | } |
||
| 427 | |||
| 428 | echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
||
| 429 | } |
||
| 430 | |||
| 431 | ?> |
||
| 432 | </div> |
||
| 433 | </div> |
||
| 434 | <?php |
||
| 435 | } |
||
| 436 |