Exemple #1
0
 static function search($text, $limit = 0)
 {
     $text = Dal::quote($text);
     $limit_sql = $limit ? " LIMIT {$limit}" : "";
     $sth = Dal::query("SELECT content_id, comment_id FROM {comments} WHERE is_active = 1 AND (name LIKE '%{$text}%' OR subject LIKE '%{$text}%' OR homepage LIKE '%{$text}%' OR comment LIKE '%{$text}%') {$limit_sql}");
     return Dal::all_assoc($sth);
 }
Exemple #2
0
 static function get_recent_content_for_user($uid, $content_type, $limit)
 {
     $tables = array(IMAGE => "images", AUDIO => "audios", VIDEO => "videos");
     $other_table = $tables[$content_type];
     $sth = Dal::query("SELECT * FROM contents C\n      LEFT JOIN {$other_table} I ON C.content_id=I.content_id\n      WHERE C.type=? AND C.author_id=? AND C.is_active=1\n      ORDER BY C.created DESC\n      LIMIT {$limit}", array($content_type, $uid));
     return Dal::all_assoc($sth);
 }
 public function find_associated_domains()
 {
     $sth = Dal::query("SELECT sd.domain domain, dic2.domain_id domain_id, COUNT(dic2.domain_id) match_count\n      FROM spam_domains sd, domains_in_comments dic1, domains_in_comments dic2\n      WHERE dic1.domain_id=? AND dic1.comment_id=dic2.comment_id AND sd.id=dic2.domain_id\n      GROUP BY dic2.domain_id ORDER BY match_count DESC", array($this->id));
     return Dal::all_assoc($sth);
 }