function getgrouplist($data, $printjson = true) { $ec = 1; $odata = 0; if ($printjson) { echo json_encode(array('ec' => $ec, 'data' => $odata)) . "\n"; } $mymsggroup = Sqle::getA(gtable("mymsggroupdispordered", false), array("uid" => User::loginId())); load_view("template/msggroup.php", array("msggroup" => $mymsggroup)); }
public static function autoscroll($query, $param, $key, $sort = '', $isloadold = true, $minl = null, $maxl = null) { setifnn($minl, $param["minl"]); setifnn($maxl, $param["maxl"]); if ($key != null) { if ($isloadold) { $querylimit = "select * from (" . gtable($query, false) . ") outpquery where ({$key}<{min} OR {min}=-1) " . ($param["minl"] == -1 ? '' : "limit {minl} "); } else { $querylimit = "select * from (" . gtable($query, false) . ") outpquery where {$key}>{max} " . ($param["maxl"] == -1 ? '' : "limit {maxl} "); } } else { //max,maxl must be +ve int $querylimit = "select * from (" . $query . ") outpquery limit {maxl} offset {max} "; } if ($key != null) { $querysort = "select * from (" . $querylimit . ") sortquery " . $sort; } else { $querysort = $querylimit; } $qresult = Sqle::getA($querysort, $param); $outp["qresult"] = $qresult; $outp["maxl"] = $maxl; $outp["minl"] = $minl; $outp["qresultlen"] = count($qresult); if ($key == null) { $outp["max"] = $param["max"] + $param["maxl"]; } else { if (count($qresult) == 0) { $outp["min"] = $param["min"]; $outp["max"] = $param["max"]; } else { $e1 = $qresult[0][$key]; $e2 = $qresult[count($qresult) - 1][$key]; $s = new Special(); $outp["min"] = $s->min($e1, $e2, $param["min"]); $outp["max"] = $s->max($e1, $e2, $param["max"]); } } return $outp; }
function f_disp_action($req) { if ($req["dispquery"] !== null) { $funcdata = map(Sqle::getA(gtable($req["dispquery"], false), $req["data"]), function ($inp) use($req) { return f_convertinp($inp, gget("convert", "todisp"), $req["dispconv"]); }); } else { $funcdata = $req["data"]; } if ($req["dispfuncs"] !== null) { $req["dispfuncs"] = giget("funcs", $req["dispfuncs"]); $funcdata = $req["dispfuncs"]($funcdata, $req["data"]); } load_view($req["view"], $funcdata); }
<?php $_ginfo["query"]["allmsg"] = "select id, msgid, isseen, aid, sid, (msg.aid=msg.sid OR isseen!='u') as selfseen, (isseen!='u' AND msg.aid=msg.sid) as otherseen, (case when msg.aid=msg.sid then msg.rid else msg.sid end) as personid from msg where true"; $_ginfo["query"]["mymsg"] = "select msgdata.time, msgdata.msg as content, allmsg.* from " . gtable("allmsg") . " left join msgdata on msgdata.id=msgid where aid={uid} "; $_ginfo["query"]["mymsggroupdisp"] = "select users.name, users.profilepic, sum(1-mymsg.selfseen) as num_unread, mymsg.* from (" . gtable("mymsg", false) . " order by time desc ) mymsg left join users on users.id=mymsg.personid group by personid"; $_ginfo["query"]["mymsggroupdispordered"] = "select * from " . gtable("mymsggroupdisp") . " order by time desc"; $_ginfo["query"]["mymsgperson"] = "select users.name, users.profilepic, mymsg.* from " . gtable("mymsg") . " left join users on users.id=mymsg.sid where personid={pid} order by id desc"; if (isset($config["needprofile"])) { $myf = User::myprofile(); }