/** * @return list of most recent blogs (by publish time) */ public static function getRecent($count) { if (!is_numeric($count)) { return false; } $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE time_published IS NOT NULL' . ' ORDER BY time_published DESC' . ' LIMIT ' . $count; $list = Sql::pSelect($q); return SqlObject::loadObjects($list, __CLASS__); }
public static function getEntries($user_id) { if (!is_numeric($user_id)) { throw new \Exception('ehm'); } $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ?' . ' ORDER BY time_created DESC'; $list = Sql::pSelect($q, 'i', $user_id); return SqlObject::loadObjects($list, __CLASS__); }
public static function getByCategory($type, $cat, $uploader = 0) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ?' . ' AND category = ?' . ($uploader ? ' AND uploader = ?' : '') . ' AND time_deleted IS NULL'; if ($uploader) { $list = Sql::pSelect($q, 'iii', $type, $cat, $uploader); } else { $list = Sql::pSelect($q, 'ii', $type, $cat); } return SqlObject::loadObjects($list, __CLASS__); }
public static function getByOwner($id) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ? OR owner = ?' . ' ORDER BY owner ASC, name ASC'; $res = Sql::pSelect($q, 'ii', 0, $id); return SqlObject::loadObjects($res, __CLASS__); }
/** @return all messages in the Outbox */ public static function getOutbox($user_id) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE `from` = ?' . ' ORDER BY time_sent DESC'; $list = Sql::pSelect($q, 'i', $user_id); return SqlObject::loadObjects($list, __CLASS__); }
public static function getDenied() { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE time_handled IS NOT NULL AND approved = ?'; $list = Sql::pSelect($q, 'i', 0); return SqlObject::loadObjects($list, __CLASS__); }
/** * @return all most recent coordinates for objects not owned by $exclude_owner */ public static function getOtherThan($type, $exclude_owner) { $q = 'SELECT MAX(time_saved) AS time_saved,id,owner,type,country,name,latitude,longitude,accuracy' . ' FROM ' . self::$tbl_name . ' WHERE type = ? AND owner != ?' . ' GROUP BY owner'; $list = Sql::pSelect($q, 'ii', COORD_EXACT, $exclude_owner); return SqlObject::loadObjects($list, __CLASS__); }
public static function getAll() { $q = 'SELECT * FROM ' . self::$tbl_name . ' ORDER BY name ASC'; return SqlObject::loadObjects($q, __CLASS__); }
public static function getRecent($room, $microtime, $limit) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE room = ? AND microtime > ?' . ' ORDER BY microtime DESC' . ' LIMIT ?'; $list = Sql::pSelect($q, 'idi', $room, $microtime, $limit); return SqlObject::loadObjects($list, __CLASS__); }
public static function getAll($type, $owner) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ? AND owner = ?' . ' ORDER BY time_created DESC'; $list = Sql::pSelect($q, 'ii', $type, $owner); return SqlObject::loadObjects($list, __CLASS__); }
public static function getUnanswered() { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE time_answered IS NULL'; return SqlObject::loadObjects($q, __CLASS__); }
public static function getAllByOwner($id) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ?'; $list = Sql::pSelect($q, 'i', $id); return SqlObject::loadObjects($list, __CLASS__); }
static function getActivePolls($type, $owner = 0) { $q = 'SELECT * FROM tblPolls' . ' WHERE type = ? AND owner = ? AND deleted_by = ? AND NOW() BETWEEN time_start AND time_end' . ' ORDER BY time_start ASC,text ASC'; $list = Sql::pSelect($q, 'iii', $type, $owner, 0); return SqlObject::loadObjects($list, __CLASS__); }
public static function getPokes($to) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE `to` = ?'; $list = Sql::pSelect($q, 'i', $to); return SqlObject::loadObjects($list, __CLASS__); }
public static function getAll($type) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ?' . ' ORDER BY value ASC'; $res = Sql::pSelect($q, 'i', $type); return SqlObject::loadObjects($res, __CLASS__); }
public static function getNewUsers($limit = 10) { $q = 'SELECT * FROM ' . self::$tbl_name . ' ORDER BY time_created DESC LIMIT ' . intval($limit); $list = Sql::pSelect($q); return SqlObject::loadObjects($list, 'User'); }
/** * @return all likes of object, except by user_id */ public static function getAllExcept($owner, $type, $user_id) { $q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ? AND type = ? AND user != ?'; $list = Sql::pSelect($q, 'iii', $owner, $type, $user_id); return SqlObject::loadObjects($list, __CLASS__); }