示例#1
0
 /**
  * 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});
         }
     }
 }
示例#2
0
 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;
 }
示例#3
0
 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));
 }
示例#4
0
 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;
 }
示例#5
0
 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;
     }
 }
示例#6
0
文件: Steg.php 项目: krillo/motiomera
 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);
 }
示例#7
0
 public static function rowById($id)
 {
     global $db;
     return $db->row("SELECT * FROM mm_fotoalbumbild WHERE id = '" . Security::secure_data($id) . "'");
 }