Example #1
0
File: boot.php Project: philum/cms
function cache_arts()
{
    $nod = $_SESSION['qb'] . '_cache';
    $main = msql_read_b('', $nod, '', 1);
    if ($main) {
        $last = current($main);
    }
    $lastart = last_art($last[0]);
    if (!is_array($main[$lastart]) && $lastart or get('refresh')) {
        $ret['_menus_'] = array('date', 'cat', 'title', 'img', 'hub', 'tag', 'lu', 'author', 'length', 'url', 'ib', 're');
        //if(!ses('dayb'))ses('dayb',calc_date(ses('nbj')));
        $slct = 'id,day,frm,suj,img,nod,thm,lu,name,host,mail,ib,re';
        if (ses('dayb')) {
            $wh = ' and day>"' . ses('dayb') . '"';
        }
        $r = sq($slct, 'qda', 'where nod="' . ses('qb') . '"' . $wh . ' and substring(frm,1,1)!="_" and re>"0" order by ' . prmb(9));
        if ($r) {
            while ($rb = mysql_fetch_row($r)) {
                $k = array_shift($rb);
                $rb[3] = first_img($rb[3]);
                $rtb[$k] = $rb;
                if ($rtb) {
                    $ret += $rtb;
                }
            }
        }
        $ok = 'cache reloaded';
        msql_save('', $nod, $ret);
        $_SESSION['rqt'] = $rtb;
    } else {
        $_SESSION['rqt'] = $main;
    }
    return lka('/reload/' . ses('qb'), 'reload');
}
Example #2
0
File: boot.php Project: philum/cms
function cache_arts()
{
    $nod = $_SESSION['qb'] . '_cache';
    $main = msql_read_b('', $nod);
    if ($main["_menus_"]) {
        unset($main["_menus_"]);
    }
    if ($main) {
        $last = current($main);
    }
    $lastart = last_art($last[0]);
    if (!is_array($main[$lastart]) && $lastart or get('refresh') or $_GET['nbj']) {
        list($slct, $in, $wh, $ord) = play_req(' and re>0');
        $sq = sqlmk($slct, 'qda', $in, $wh, $ord);
        $rq = $req = mysql_query($sq);
        $ret["_menus_"] = array('date', 'cat', 'title', 'img', 'hub', 'tag', 'lu', 'author', 'lenght', 'url', 'ib', 're');
        $rtb = tri_cache($rq);
        if ($rtb) {
            $ret += $rtb;
        }
        if ($rq) {
            mysql_free_result($rq);
        }
        if (!$_GET["lang"] && count($ret) < 500) {
            //!$_GET["timetravel"] && !$_GET["nbj"] &&
            $ok = 'cache reloaded';
            msql_save('', $nod, $ret);
            maj_nbarts($last[0]);
        }
    } else {
        $_SESSION['rqt'] = $main;
    }
    //if($ok && $rtb)alert($ok);
    return lka('/reload/' . ses('qb'), 'reload');
}