/** * Runs through all str fields class to remove possible problems with linebreaks when used with SQL * * @uses Security::secure_data() to do the actual problem fixing * @return void */ private function secureData() { foreach ($this->fields as $field => $type) { if ($type == "str") { $this->{$field} = Security::secure_data($this->{$field}); } } }
public static function ledigEpost($epost) { global $db; $sql = "SELECT count(*) FROM " . self::classToTable(get_class()) . " WHERE epost = '" . Security::secure_data($epost) . "' AND epostBekraftad = 1"; return $db->value($sql) == "0" ? true : false; }
public static function loadByOrderId($id) { global $db; $sql = "SELECT serialize FROM " . self::classToTable(get_class()) . " WHERE orderId = '" . Security::secure_data($id) . "'"; return unserialize($db->value($sql)); }
public function setANamn($aNamn) { if ($this->getId()) { Security::demand(ADMIN); } global $db; $sql = "SELECT count(*) from " . self::classToTable(get_class()) . " WHERE aNamn = '" . Security::secure_data($aNamn) . "'"; if ($this->getId()) { $sql .= " AND id <> " . $this->getId(); } if ($db->value($sql) > 0) { throw new ForetagException("Anv㭤arnamnet 㰠upptaget", -4); } $this->aNamn = $aNamn; }
public static function harGruppTilltrade($grupp_id, $fotoalbum_id) { global $db; $sql = $db->query("SELECT * FROM mm_fotoalbumGruppAcl WHERE grupp_id = " . Security::secure_data($grupp_id) . " AND fotoalbum_id = " . $fotoalbum_id); if (mysql_num_rows($sql) > 0) { return true; } else { return false; } }
public static function listTopMedlemmar($limit = 10) { global $db; $sql = "SELECT medlem_id, sum(steg) FROM " . self::classToTable(get_class()) . " GROUP BY medlem_id LIMIT " . Security::secure_data($limit) . ";"; $ids = $db->valuesAsArray($sql); return Medlem::listByIds($ids); }
public static function rowById($id) { global $db; return $db->row("SELECT * FROM mm_fotoalbumbild WHERE id = '" . Security::secure_data($id) . "'"); }