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); }
public static function uploadpic($file, $smallkey, $bigkey, $size, $const = array()) { $fd = Fun::uploadfile_post($file, $const); if ($fd["ec"] > 0) { $smallpic = "data/files/" . Fun::getuploadfilename(pathinfo($fd['fn'], PATHINFO_EXTENSION), 'small'); resizeimg($fd["fn"], $smallpic, $size, $size); Sqle::updateVal("users", array($smallkey => $smallpic, $bigkey => $fd["fn"]), array("id" => User::loginId())); } return $fd["ec"]; }
public static function passreset($email) { $uinfo = Sqle::getR("select * from users where email={email} limit 1", array("email" => $email)); if ($uinfo != null) { $uinfo["password"] = Fun::encode2($uinfo["password"]); $reseturl = BASE . "resetpassword?" . http_build_query(Fun::getflds(array("id", "password"), $uinfo)); $uinfo["link"] = $reseturl; msmail("passwordreset.txt", $uinfo, $email); return true; } return null; }
function saveuserdetails($data) { $outp = array("ec" => 1, "data" => 0); if (User::loginType() == 'a' || User::loginId() == $data["uid"]) { $data = applyconv($data, false); $canneed = array("name", "sign", "lang", "news", "address", "fbid", "skypeid", "email", "phone", "dob"); $toupdate = Fun::getflds($canneed, $data); $myf = User::userProfile(null, array("email" => getval("email", $toupdate, ''))); if (isset($toupdate["email"]) && !($myf == null || $myf["id"] == $data["uid"])) { $outp["ec"] = -16; } else { $outp["data"] = Sqle::updateVal("users", $toupdate, array("id" => $data["uid"])); } } else { $outp["ec"] = -2; } return $outp; }