Exemple #1
0
function plug_search($d, $n, $opt = '', $res = '')
{
    list($b, $o, $t, $ph) = split('-', $opt);
    chrono();
    $rech = good_rech($d);
    $_GET['search'] = $rech;
    list($cat, $tag) = ajxr($res);
    $rech = str_replace(array("’", '«', '»', " "), array("'", '"', '"', ' '), trim($rech));
    if (!$n) {
        $n = $_SESSION['nbj'];
    }
    $_GET['dig'] = $n;
    $_GET['cat'] = $cat;
    $_GET['tag'] = $tag;
    $_GET['bool'] = $b;
    $_GET['titles'] = $t;
    //$_GET['pho']=$ph;
    $vrf = normalize($rech . $n . $b . $o . $t . $ph . $res);
    if ($rech == 'last') {
        $id = lastid('qda');
        $load[$id] = 1;
    } elseif (isset($_SESSION['recache'][$vrf])) {
        $load = $_SESSION['recache'][$vrf];
        $cac = $vrf;
    } elseif ($d && is_numeric($d) && $d < lastid('qda')) {
        $load[$d] = 1;
    } elseif (strpos($rech, ';') && strpos($rech, ':')) {
        list($rch, $cat, $tag, $utg) = rech_script($rech);
    } elseif (strpos($rech, '=')) {
        $load = make_list_arts($rech);
    } else {
        $load = rech($rech, $n);
    }
    if ($load && !is_array($load)) {
        $load = '';
    }
    if (!$load && ($cat or $tag or $utg)) {
        $load = rech_catag($cat, $tag, $utg, $n);
    }
    $_SESSION['load'] = $load;
    $_SESSION['recache'][$vrf] = $load;
    $ret = rech_titles($rech, $n, $opt, $cac, $cat, $tag, $tag2);
    $_SESSION['page'] = 1;
    $_SESSION['popm'] = chrono('search');
    if ($load[0]) {
        unset($load[0]);
    }
    if ($load[1]) {
        unset($load[1]);
    }
    if ($load) {
        $ret .= scroll($load, divd($vrf, output_pages($load, '', '')), 2, '', 400);
    }
    return $ret;
}
Exemple #2
0
function prepare_msg_rech($id, $msg, $r = '')
{
    $rech = good_rech();
    if ($_GET['bool']) {
        $parts = explode(' ', trim($rech));
    }
    $nbp = count($parts);
    $msg = strip_tags($msg);
    $msg = clean_internaltag($msg);
    $r = explode('.', $msg);
    if (!$_GET['titles'] && $r) {
        foreach ($r as $k => $v) {
            if ($nbp > 1) {
                foreach ($parts as $kb => $vb) {
                    if ($v && $vb) {
                        $na = substr_count(strtolower($v), strtolower($vb));
                        $panout['count'] += $na;
                        $va = str_detect($v, $vb, $id, $na);
                    } else {
                        $va = '';
                    }
                }
                if ($va) {
                    $ret .= divc('track', $va . '.');
                }
            } else {
                $na = substr_count(strtolower($v), strtolower($rech));
                $panout['count'] += $na;
                $res = str_detect($v, $rech, $id, $na);
                if ($res) {
                    $ret .= divc('trkmsg', $res . '.');
                }
            }
        }
    }
    if ($_GET['titles']) {
        $panout['msg'] = '';
    } else {
        $panout['msg'] = clean_br_lite($ret);
    }
    $_GET['nboc'] += $panout['count'];
    return $panout;
}
Exemple #3
0
function art_read_mecanics($id, $r, $msg, $n, $prw, $tp)
{
    if (!$id) {
        return;
    }
    $n = $_SESSION['nl'] ? $_SESSION['nl'] : $n;
    //no_edit
    $rear = nb_ib_arts($id) + 1;
    $otp = read_idy($id, 'DESC');
    $r['opts'] = $_SESSION['opts'] ? $_SESSION['opts'] : art_opts($id);
    $panout['id'] = $id;
    $panout['suj'] = $r['suj'];
    //$prw=slct_media($prw);
    if ($r['re'] == 0) {
        $panout['css'] = "hide";
    } else {
        $panout['css'] = "";
    }
    //if($_GET['module']=="agenda")$panout['suj']=strftime("%A %d %B %Y",$r['day']).' :: ';
    $panout += prepare_tits($id, $r, $rear, $otp, $n, $prw);
    //count($otp)
    if ($prw < 3) {
        $panout['thumb'] = prepare_thumb($r['img']);
    }
    if (good_rech() && $n) {
        $panout += prepare_msg_rech($id, $msg, $r, $n);
    } elseif ($msg) {
        $panout += prepare_msg($id, $msg, $r, $prw);
        //corps && $prw!=1
        if (!$_SESSION['nl']) {
            $trk = prepare_tracks($id, $otp);
        }
    }
    return balb('section', atd($id) . atn($id), template($panout, $tp)) . $trk;
}
Exemple #4
0
function page_titles($o = '', $rid = '')
{
    $load = ses('load');
    //$o=parent
    $days = getorpost('dig', ses('nbj'));
    $daybb = calc_date($days);
    $rech = good_rech();
    $nms = ses('nms');
    $frm = ses('frm');
    $read = ses('read');
    list($utg, $utv) = detect_uget();
    if ($rech) {
        $ico = btn("txtcadr", pictxt('search', $rech));
        if (get('targ')) {
            return;
        }
        if (is_array($load)) {
            $p['nbarts'] = nbof(count($load), 1) . ' (' . nbof(array_sum($load), 16) . ') / ' . nbof($days, 3);
        }
        $p['opt'] = lj('', 'popup_search___' . $rech, picto('popup'));
        if ($pg = $_SESSION['page'] > 1) {
            $p['opt'] = btn('txtsmall', 'page ' . $pg);
        }
        $p['suj'] = $rech;
        $p['url'] = 'search/' . $rech . '/' . $days;
    } elseif (get('rub_tag')) {
        $rub_t = get('rub_tag');
    } elseif (get('rssurl')) {
        $p['suj'] = $nms[15];
    } elseif ($par = get('parent')) {
        $read = 1;
        $p['suj'] = suj_of_id($par);
        $p['url'] = urlread($par);
    } elseif ($utg) {
        $p['suj'] = $utv;
        $_SESSION['frm'] = '';
        $p['date'] = dig_it($days, $utg, $rid) . ' ';
        $p['url'] = htac($utg) . $utv;
    } elseif ($tag = get('source')) {
        $p['suj'] = $tag;
        $_SESSION['frm'] = '';
        $p['date'] = dig_it($days, 'source', $rid) . ' ';
        $p['url'] = 'source/' . $tag . '/' . $days;
    } elseif ($tag = get('tag')) {
        $p['suj'] = $tag;
        $p['url'] = 'tag/' . $tag . '/' . $days;
        $p['date'] = dig_it($days, 'tag', $rid) . ' ' . lkc('txtx', htac('tag') . $tag, picto('url')) . ' ';
        $p['date'] .= lj('txtx', 'popup_search__3_' . ajx($tag) . '_' . $days, picto('search'));
    } elseif (get('module') == 'All') {
        $p['suj'] = get('module');
        $p['url'] = htac('module') . get('module');
    } elseif ($frm) {
        $p['suj'] = $frm;
        $p['url'] = htac('section') . $frm;
    }
    if (!$read) {
        //nav//nbarts
        if ($utv or $tag or $rub_t or get('source')) {
            if ($load) {
                $nbarts = count($load);
                if (!$rub_t) {
                    $_SESSION['frm'] = '';
                }
            }
        } elseif ($frm != "Home" && get('module') != "All" && $frm) {
            if (get('dig') or $_SESSION['lang']) {
                list($slct, $in, $wh, $ord, $gr) = play_req(' and re>0');
                $nbarts = sql('count(id)', 'qda', 'v', $wh);
            } else {
                $nbarts = $_SESSION['line'][$frm];
            }
        } elseif (ses('line')) {
            foreach ($_SESSION['line'] as $k => $v) {
                $nbarts += $v;
            }
        }
    }
    if ($frm && $frm != 'Home' && $frm != 'All' && !$read && !$p['date']) {
        $p['date'] = dig_it($days, 'section', $rid) . ' ';
    }
    // && !$rech
    if (!$read && !$p['nbarts']) {
        $p['nbarts'] = nbof($nbarts, 1) . (rstr(3) ? ' / ' . nbof($days, 3) : '');
    }
    if ($page = ses('page') && $page > 1) {
        $p['nbarts'] .= ' (page ' . $page . ') ';
    }
    if (!$load && $o) {
        $p['parent'] = find_navigation(ses('read'));
    }
    //rstr(78)
    if ($_GET['rub_tag']) {
        $p['tag'] = rub_tags('');
        $p['opt'] = lkc('txtx', htac('tag') . $rub_t, '&#9658;' . $rub_t);
    }
    if ($p['suj'] == 'All') {
        $p['suj'] = ses('nbj') . ' ' . nms(4);
    }
    if ($p['suj'] == 'Home') {
        $p['suj'] = nms(69);
    }
    //if($_GET['module'])$p['suj']=nms(100)
    return divd('titles', template($p, 'titles'));
}