Example #1
0
 public static function FileAppend(PriceApp $app, $filehash, $title)
 {
     $db = $app->db;
     $sql = "\n            INSERT INTO " . $db->prefix . "price_file\n            (userid, filehash, title, dateline) VALUES (\n                " . intval(Abricos::$user->id) . ",\n                '" . bkstr($filehash) . "',\n                '" . bkstr($title) . "',\n                " . TIMENOW . "\n            )\n        ";
     $db->query_write($sql);
     return $db->insert_id();
 }
Example #2
0
 public static function NewsCount(Ab_Database $db, $userid = 0, $retvalue = false)
 {
     $sql = "\n\t\t\tSELECT count( newsid ) AS cnt\n\t\t\tFROM " . $db->prefix . "ns_news\n\t\t\tWHERE ((deldate=0 AND published>0) OR userid=" . bkint($userid) . ") AND language='" . bkstr(Abricos::$LNG) . "' \n\t\t\tLIMIT 1 \n\t\t";
     if ($retvalue) {
         $row = $db->query_first($sql);
         return $row['cnt'];
     } else {
         return $db->query_read($sql);
     }
 }
Example #3
0
 public static function TagsByQuery(Ab_Database $db, $module, $config)
 {
     $tags = Tag::TagsParse(array($config->query));
     if (count($tags) !== 1) {
         return;
     }
     $query = $tags[0];
     $sql = "\n            SELECT t.tag\n            FROM " . $db->prefix . "tag_owner o\n            INNER JOIN " . $db->prefix . "tag t ON o.tagid=t.tagid\n            WHERE t.tag LIKE '" . bkstr($query) . "%'\n                AND modname='" . bkstr($module) . "'\n                AND (\n                " . (isset($config->groupid) ? "o.groupid=" . intval($config->groupid) . " OR " : "") . "\n                    o.userid=" . bkint(Abricos::$user->id) . "\n                )\n            GROUP BY t.tag\n            ORDER BY t.tag\n            LIMIT 10\n\t\t";
     return $db->query_read($sql);
 }
Example #4
0
 public static function TeacherUpdate(Ab_Database $db, $d)
 {
     $sql = "\n\t\t\tUPDATE " . $db->prefix . "rb_teacher\n\t\t\tSET\n\t\t\t\tdepartid=" . bkint($d->departid) . ",\n\t\t\t\tfio='" . bkstr($d->fio) . "'\n\t\t\tWHERE teacherid=" . bkint($d->id) . "\n\t\t\tLIMIT 1\n\t\t";
     $db->query_write($sql);
 }