コード例 #1
0
ファイル: ajax.search.php プロジェクト: laiello/avecms
<?php

$response = '';
$query_string = isset($_REQUEST['ajq']) ? preg_replace('/[^ A-Za-zА-Яа-яЁёЇЄІїєі0-9]/i', '', $_REQUEST['ajq']) : '';
if (strlen($query_string) > 2) {
    define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));
    require BASE_DIR . '/inc/init.php';
    $where_category_id = '';
    if (!empty($_REQUEST['cid']) && (int) $_REQUEST['cid'] > 0) {
        $where_category_id = "AND b.Id = '" . (int) $_REQUEST['cid'] . "'";
    }
    $sql = $GLOBALS['AVE_DB']->Query("\r\n\t\tSELECT\r\n\t\t\t a.Id,\r\n\t\t\t a.Name,\r\n\t\t\t b.Id as KatId\r\n\t\tFROM\r\n\t\t\t" . PREFIX . "_modul_download_files as a,\r\n\t\t\t" . PREFIX . "_modul_download_kat as b\r\n\r\n\t\tWHERE\r\n\t\t\ta.status = 1 AND\r\n\t\t\ta.KatId = b.Id AND\r\n\t\t\t(\r\n\t\t\t\tb.user_group LIKE '" . UGROUP . "|%' OR\r\n\t\t\t\tb.user_group LIKE '%|" . UGROUP . "' OR\r\n\t\t\t\tb.user_group LIKE '%|" . UGROUP . "|%' OR\r\n\t\t\t\tb.user_group = '" . UGROUP . "'\r\n\t\t\t)\r\n\t\tAND\r\n\t\t\t(\r\n\t\t\t\tName LIKE '%" . $query_string . "%' OR\r\n\t\t\t\tdescription LIKE '%" . $query_string . "%'\r\n\t\t\t)\r\n\t\t" . $where_category_id . "\r\n\t");
    $num = $sql->NumRows();
    if ($num > 0) {
        $response .= '<div id="cp_ajs" class="mod_download_ajaxsearchdiv">';
        while ($row = $sql->FetchRow()) {
            $response .= '<a class="mod_download_ajsearch" href="index.php' . '?module=download&amp;action=showfile&amp;file_id=' . $row->Id . '&amp;categ=' . $row->KatId . '">' . stripslashes($row->Name) . '</a>';
        }
        $response .= '</div>';
        if (REWRITE_MODE) {
            require BASE_DIR . '/modules/download/funcs/func.rewrite.php';
            $response = DownloadRewrite($response);
        }
    }
}
echo 'showDiv||', $response;
コード例 #2
0
ファイル: class.download.php プロジェクト: laiello/avecms
 function DL_Rewrite($print_out)
 {
     if (REWRITE_MODE) {
         $print_out = DownloadRewrite($print_out);
     }
     return $print_out;
 }