id = 0; // N'appartient a personne $this->group_id = 0; // Pas de groupe $this->user_id = 0; // Pas d'utilisateur $this->secret_key = time(); // Clef secrete $this->provider_id;// Pas de fournisseur $this->date_in = time(); // Maintenant par defaut $this->title = ""; $this->label = ""; $this->url = ""; $this->email = ""; $this->content = ""; $this->artists = ""; $this->genre = ""; $this->rating = 0; } // Constructeur par ID // Retourne la chronique identifiee par ID si ID est un ID de // la BD, sinon ne fait rien. function fetchById($id) { global $_D; $query_select = "SELECT * FROM reviews where id = " . intval($id); $result = $_D->query($query_select); $fields = $_D->fetch_array($result); if ($fields) { $this->id = $id; $this->group_id = $fields["group_id"]; $this->user_id = $fields["user_id"]; $this->secret_key = $fields["secret_key"]; $this->provider_id = $fields["provider_id"]; $this->date_in = $fields["date_in"]; $this->title = $fields["title"]; $this->label = $fields["label"]; $this->content = $fields["content"]; $this->url = $fields["url"]; $this->email = $fields["email"]; $this->artists = $fields["artists"]; $this->genre = $fields["genre"]; $this->img_ext = $fields["img_ext"]; $this->rating = $fields["rating"]; $this->image = $fields["image"]; $_D->free_result($result); return TRUE; } else return FALSE; } // Insere une chronique dans la BD function insert() { global $_D; $query_insert = "INSERT INTO reviews (group_id,user_id,secret_key,provider_id,date_in,title,content,label,url,email,artists,genre,rating) VALUES (" ; $query_insert .= intval($this->group_id) . "," . intval($this->user_id) . ",'" . addslashes($this->secret_key) . "','" . intval($this->provider_id) . "','" . intval($this->date_in) . "','"; $query_insert .= addslashes($this->title) . "','" . addslashes($this->content) . "','" . addslashes($this->label) . "','" . addslashes($this->url) . "','" . addslashes($this->email) . "','" . addslashes($this->artists) . "','" . addslashes($this->genre) . "'," . intval($this->rating) . ")"; $result = $_D->query($query_insert); if ($result) $this->id = $_D->insert_id(); // On recupere l'ID d'insertion. return $result; } // Supprime une soiree de la BD function delete() { global $_D; $query_delete = "DELETE FROM reviews where id = " . intval($this->id); return $_D->query($query_delete); } // Supprime une news de la BD via son ID function deleteById($id) { global $_D; $query_delete = "DELETE FROM reviews where id = " . intval($id); return $_D->query($query_delete); } // Modifie le contenu d'une chronique function updateContent() { global $_D; $query_update = "UPDATE reviews SET user_id = " . intval($this->user_id) . ", group_id = " . intval($this->group_id) . ",date_in = '" . intval($this->date_in) . "',title = '" . addslashes($this->title) . "',label = '" . addslashes($this->label) . "',url = '" . addslashes($this->url) . "',email = '" . addslashes($this->email) . "',content = '" . addslashes($this->content) . "',artists = '" . addslashes($this->artists) . "',rating= " . intval($this->rating) . ",genre='" . intval($this->genre) . "' WHERE id = " . intval($this->id); return $_D->query($query_update); } // Modifie le ownership de la chronique function updateOwner() { global $_D; $query_update = "UPDATE reviews SET user_id = " . intval($this->user_id) . ", group_id = " . intval($this->group_id) . " WHERE id = " . intval($this->id); return $_D->query($query_update); } // Retourne la clef secrete associee a la soiree function getSecretKey( ) { global $_D; $query_select = "select secret_key from reviews where id = " . intval($this->id); $row = $_D->fetch_array($_D->query($query_select)); if ($row) return $row['secret_key']; else return ""; } function setExtensionImg($value) { $this->img_ext = $value; } } ?> (#) France techno | Bienvenue !
France Techno est hors service. Le service est maintenu en l'état mais n'est plus maintenu.
Accueil            Actu            Soirées            Chroniques Membres            Webmail            Contact