Exemple #1
0
     $where_and['or'] = '(' . implode(' OR ', $where_or) . ')';
     $where_and = array_diff($where_and, array(''));
     $where = implode(' AND ', $where_and);
     $maxitems = $cfg_maxitems - $items;
     $maxitems = $maxitems < 0 ? 0 : $maxitems;
     if (!$db->fieldExists($db_forum_topics, "ft_{$rs['frmsort']}")) {
         $rs['frmsort'] = 'updated';
     }
     $sql = $db->query("SELECT SQL_CALC_FOUND_ROWS p.*, t.*\n\t\t\t \tFROM {$db_forum_posts} AS p, {$db_forum_topics} AS t\n\t\t\t\tWHERE {$where} AND p.fp_topicid = t.ft_id\n\t\t\t\tGROUP BY t.ft_id ORDER BY ft_" . $rs['frmsort'] . " " . $rs['frmsort2'] . "\n\t\t\t\tLIMIT {$d}, {$maxitems}");
     $items = $sql->rowCount();
     $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
     $jj = 0;
     while ($row = $sql->fetch()) {
         if ($row['ft_updated'] > 0) {
             $post_url = $cfg['plugin']['search']['searchurl'] == 'Single' ? cot_url('forums', 'm=posts&id=' . $row['fp_id'] . '&highlight=' . $hl) : cot_url('forums', 'm=posts&p=' . $row['fp_id'] . '&highlight=' . $hl, '#' . $row['fp_id']);
             $t->assign(array('PLUGIN_FR_CATEGORY' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'PLUGIN_FR_TITLE' => cot_rc_link($post_url, htmlspecialchars($row['ft_title'])), 'PLUGIN_FR_TITLE_URL' => $post_url, 'PLUGIN_FR_TEXT' => cot_clear_mark($row['fp_text'], $words), 'PLUGIN_FR_TIME' => $row['ft_updated'] > 0 ? cot_date('datetime_medium', $row['ft_updated']) : cot_date('datetime_medium', $row['fp_updated']), 'PLUGIN_FR_TIMESTAMP' => $row['ft_updated'] > 0 ? $row['ft_updated'] : $row['fp_updated'], 'PLUGIN_FR_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_FR_NUM' => $jj));
             $t->parse('MAIN.RESULTS.FORUMS.ITEM');
         }
         $jj++;
     }
     $sql->closeCursor();
     if ($jj > 0) {
         $t->parse('MAIN.RESULTS.FORUMS');
     }
 }
 /* === Hook === */
 foreach (cot_getextplugins('search.list') as $pl) {
     include $pl;
 }
 /* ===== */
 if (array_sum($totalitems) < 1) {
    }
    $sqllist = $db->query("SELECT SQL_CALC_FOUND_ROWS p.* {$search_join_columns}\n\t\tFROM {$db_projects} AS p {$search_join_condition}\n\t\tWHERE {$where}\n\t\tORDER BY item_" . $rs['prjsort'] . " " . $rs['prjsort2'] . "\n\t\tLIMIT {$d}, " . $cfg_maxitems . $search_union_query);
    $items = $sql->rowCount();
    $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
    $jj = 0;
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    /* === Hook - Part 1 === */
    $extp = cot_getextplugins('projects.search.loop');
    /* ===== */
    foreach ($sqllist_rowset as $row) {
        $url_cat = cot_url('projects', 'c=' . $row['item_cat']);
        $url_prj = empty($row['item_alias']) ? cot_url('projects', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'] . '&highlight=' . $hl) : cot_url('projects', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'] . '&highlight=' . $hl);
        $t->assign(cot_generate_projecttags($row, 'PLUGIN_PROJECTSRES_'));
        $t->assign(array('PLUGIN_PROJECTSRES_CATEGORY' => cot_rc_link($url_cat, $structure['projects'][$row['item_cat']]['tpath']), 'PLUGIN_PROJECTSRES_CATEGORY_URL' => $url_cat, 'PLUGIN_PROJECTSRES_TITLE' => cot_rc_link($url_prj, htmlspecialchars($row['item_title'])), 'PLUGIN_PROJECTSRES_TEXT' => cot_clear_mark($row['item_text'], $words), 'PLUGIN_PROJECTSRES_TIME' => cot_date('datetime_medium', $row['item_date']), 'PLUGIN_PROJECTSRES_TIMESTAMP' => $row['item_date'], 'PLUGIN_PROJECTSRES_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PROJECTSRES_NUM' => $jj));
        /* === Hook - Part 2 === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.RESULTS.PROJECTS.ITEM');
        $jj++;
    }
    if ($jj > 0) {
        $t->parse('MAIN.RESULTS.PROJECTS');
    }
    unset($where_and, $where_or, $where);
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=search.page.loop
[END_COT_EXT]
==================== */
/**
 * Displays translated pages in search results
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $page_url = empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl);
    $t->assign(array('PLUGIN_PR_CATEGORY' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'PLUGIN_PR_TITLE' => cot_rc_link($page_url, htmlspecialchars($row['ipage_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['ipage_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['ipage_date']), 'PLUGIN_PR_TIMESTAMP' => $row['ipage_date']));
}