public static function is_network_valid($network_name) { return Dal::query_first("SHOW TABLES LIKE '" . Dal::quote($network_name) . "_comments'") ? TRUE : FALSE; }
function table_exists($tablename) { //$sql = "DESCRIBE $tablename"; $sql = "SHOW TABLES LIKE '" . Dal::quote($tablename) . "'"; $res = Dal::query($sql); while (list($tname) = Dal::row($res)) { if ($tname == $tablename) { return TRUE; } } return FALSE; }
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); }
public static function findByTitle($title) { $enc_title = Dal::quote($title); $groups = array(); $sth = Dal::query("SELECT collection_id,title FROM {contentcollections} WHERE title LIKE '%{$enc_title}%' AND is_active=1"); while ($r = Dal::row($sth)) { list($ccid, $title) = $r; $groups[] = array('ccid' => (int) $ccid, 'title' => $title); } return $groups; }
function table_exists($tablename) { $sql = 'SHOW TABLES LIKE \'' . Dal::quote($tablename) . '\''; $res = Dal::query($sql); while (list($tname) = Dal::row($res)) { if ($tname == $tablename) { return TRUE; } } return FALSE; }
function find_descendants($parent_path) { $ret = array(); if (!preg_match("|/\$|", $parent_path)) { $parent_path .= "/"; } $sth = Dal::query("SELECT path, kind FROM svn_objects WHERE is_active=1 AND path LIKE '" . Dal::quote($parent_path) . "%' ORDER BY path DESC"); while (list($path, $kind) = Dal::row($sth)) { $ret[] = array('path' => $path, 'kind' => $kind); } return $ret; }