function minimg($amg, $prm) { if ($prm == 'no') { return; } $mg = first_img($amg); if ($mg) { return make_thumb($mg, $prm); } elseif (rstr(87)) { return mini_empty($prm); } }
function output_pages_from_cache($http, $otp) { $npg = $_SESSION['prmb'][6]; $page = $_SESSION['page']; $min = ($page - 1) * $npg; $max = $page * $npg; if (is_array($otp)) { foreach ($otp as $id => $nb) { if (is_numeric($id)) { $i++; if ($i >= $min && $i < $max) { $mg = $http . '/imgc/' . first_img($nb[3]); if (is_link($mg)) { $ret .= btn('imgl', image($mg, '', 50)); } $ret .= bal('h2', lka($http . '/' . $id, $nb[2])); $ret .= btn('txtx', $nb[1]) . ' '; if (rstr(27)) { $ret .= btn('txtsmall', mkday($nb[0], 1)) . ' ' . pub_link($nb[9]) . ' '; } if (rstr(25)) { $ret .= btn('txtsmall', art_length($nb[8])); } $ret .= br() . br(); } } } } $n_pages = nb_page($i, $npg, $page); return $n_pages . $ret . $n_pages; }
function affiche_prod($v, $id) { if (!is_numeric($v)) { $v = id_of_suj($v); } list($day, $frm, $suj, $img, $nod, $thm, $lu, $re) = pecho_arts($v); $p["suj"] = $suj; $p["img"] = first_img($img); $p["thumb"] = make_thumb(first_img($img), "no"); $p["id"] = $v; $p["sty"] = "panel"; $chsup = explode(" ", $_SESSION['prmb'][18]); foreach ($chsup as $cat) { $va = sql('msg', 'qdd', 'v', 'ib="' . $v . '" AND val="' . $cat . '"'); $ct = $cat == 'prix' ? 'price' : $cat; if ($va) { $p[$ct] = $cat . ': ' . trim($va); } } $p["add2cart"] = ljb("txtbox", "SaveJ", 'cart_shop___' . $v, "add"); return template($p, 'products'); }
function mk_bkg($v, $id) { list($d, $p) = good_param($v); if (!$p) { $p = $d; $d = ''; } if ($p) { $mg = $p; } else { $mg = first_img(rse("img", $_SESSION['qda'] . ' WHERE id=' . $id)); } $f = goodroot($mg, 1); if (file_exists($f)) { list($w, $h) = getimagesize($f); } return divs('background-image: url(/img/' . $mg . '); background-repeat:no-repeat; background-position:center center; background-size:cover; background-attachment:fixed; height:90%;', $d); }
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'); }
function art_read_d($id, $n, $prw, $tp) { //4ajax: reload inside if ($id == "last") { $id = last_art_rqt(); } elseif (!is_numeric($id)) { $id = id_of_suj($id); } if ($prw > 2) { $_GET['read'] = $id; $tp = $tp ? $tp : 'read'; } //$prw=slct_media($prw); $r = art_datas($id); if ((rstr(5) or $prw > 2 or $prw == 'vd') && $r['re']) { // or auth(4) $msg = sql('msg', 'qdm', 'v', 'id="' . $id . '"'); } if ($prw == 'vd') { $msg = search_conn_video($id, $msg); } $panout['id'] = $id; $panout['suj'] = $r['suj']; if (!$r['suj']) { return 'not_exists'; } $panout['cat'] = $r['frm']; $panout['img1'] = first_img($r['img']); if ($prw < 3) { $panout['thumb'] = prepare_thumb($r['img']); } $rear = nb_ib_arts($id) + 1; $otp = read_idy($id, "DESC"); //tracks $panout += prepare_tits($id, $r, $rear, $otp, $n, $prw); if ($msg) { $panout += prepare_msg($id, $msg, $r, $prw); } //corps return template($panout, $tp); }
function tri_cache($rq) { if ($rq) { while ($r = mysql_fetch_row($rq)) { if (substr($r[4], 0, 1) != '_') { $ret[$r[0]] = array($r[2], $r[4], $r[5], first_img($r[6]), $r[7], $r[8], $r[10], $r[9], $r[12], $r[3], $r[1], $r[11]); } } } //$ret[1]=error_art(); $_SESSION['rqt'] = $ret; return $ret; }
function pub_art($id, $tpl = '') { $rst = $_SESSION['rstr']; list($day, $frm, $suj, $amg, $nod, $thm, $lu, $re) = pecho_arts($id); $panout['url'] = urlread($id); $panout['suj'] = $suj; $panout['jurl'] = 'content_ajxlnk2__2_read_' . $id; $panout['purl'] = 'popup_popart__3_' . $id . '_3'; if ($rst[32] != 1 && $amg) { $panout['img1'] = first_img($amg); } if ($rst[36] != 1) { $panout['back'] = art_back($id, $ib, $frm); $panout['cat'] = $frm; } if ($rst[7] != 1) { $panout['date'] = mkday($day); } if ($rst[4] != 1) { $r = tag_maker($id, 1); if ($r) { $panout += $r; } } if (!$tpl) { if ($rstr[8]) { $tpl = 'pubart'; } else { $tpl = 'pubart_j'; } } if ($re) { return divc('pubart', template($panout, $tpl)); } }
function api_build_arts($r, $prw, $tp) { if ($prw > 1 or $prw == 'rch') { $msg = sql('msg', 'qdm', 'v', 'id="' . $r['id'] . '"'); } //msg $r['img1'] = first_img($r['img']); return art_read_mecanics($r['id'], $r, $msg, '', $prw, $tp); }