sql->query($query); $artistes = array(); $i = 0; while($v_rst = $this->sql->fetch_assoc($rst)) { $ARTISTES[$i] = Array(); $ARTISTES[$i]["id"] = $v_rst["id"]; $ARTISTES[$i]["nom"] = $v_rst["nom"]; $ARTISTES[$i]["style"] = $v_rst["style"]; $width = $IMG_WIDTH; $height = $IMG_HEIGHT; $EXISTS = true; if($get_size) { list($width, $height, $type, $attr) = @getimagesize($v_rst["image"]); $EXISTS = false; if($width) $EXISTS = true; if($EXISTS) { $div = 1; if(($width / $div) > $IMG_WIDTH) $div = $width / $IMG_WIDTH; if(($height / $div) > $IMG_HEIGHT) $div = $height / $IMG_HEIGHT; $width = floor($width / $div); $height = floor($height / $div); } else { $width = $IMG_WIDTH; $height = $IMG_HEIGHT; } } $ARTISTES[$i]["image"] = Array(); $ARTISTES[$i]["image"]["src"] = $EXISTS ? $v_rst["image"] : ""; $ARTISTES[$i]["image"]["width"] = $width; $ARTISTES[$i]["image"]["height"] = $height; $i++; } $this->sql->free_result($rst); } catch(Exception $_e) { $artistes = false; } return $ARTISTES; } function artistes($pun_user = null) { $artistes = array(); try { $query = "SELECT * FROM #--artistes" .(isset($pun_user) ? " WHERE pun_user=".$pun_user : "") ." ORDER BY nom"; $rst = $this->sql->query($query); $artistes = array(); while($v_rst = $this->sql->fetch_assoc($rst)) { $artistes[$v_rst["id"]] = $v_rst; } $this->sql->free_result($rst); } catch(Exception $_e) { $artistes = false; } return $artistes; } function artiste($id) { $artiste = array(); try { $query = "SELECT *" ." FROM #--artistes" ." WHERE ".$this->env->bdd["prefix"]."artistes.id=".$id; $rst = $this->sql->query($query); if($v_rst = $this->sql->fetch_assoc($rst)) $artiste = $v_rst; $this->sql->free_result($rst); } catch(Exception $_e) { $artiste = false; } return $artiste; } function artiste_presentation($id) { $presentation = ""; try { $query = "SELECT presentation" ." FROM #--artistes" ." WHERE id=".$id; $rst = $this->sql->query($query); if($v_rst = $this->sql->fetch_assoc($rst)) $presentation = $v_rst["presentation"]; $this->sql->free_result($rst); } catch(Exception $_e) { $presentation = false; } return $presentation; } function set_artiste_presentation($id, $presentation) { try { $query = "UPDATE #--artistes" ." SET presentation=".$this->eq($presentation) ." WHERE id=".$id; $this->sql->query($query); } catch(Exception $_e) { return false; } return true; } function add_artiste($pun_user, $nom, $forum = null, $dossier_personnel = null) { try { $sql = "INSERT INTO #--artistes(nom, pun_user, pun_forum, dossier_personnel) VALUES" ."( ".$this->eq($nom) .", ".$pun_user .", ".$this->eq($forum) .", ".$this->eq($dossier_personnel) .")"; $this->sql->query($sql); } catch(Exception $_e) { return false; } return true; } function admin_set_artiste($id, $nom, $forum = null, $dossier_personnel = null) { try { $query = "UPDATE #--artistes SET" ." nom=".$this->eq($nom) .", pun_forum=".$this->eq($forum) .", dossier_personnel=".$this->eq($dossier_personnel) ." WHERE id=".$id; $this->sql->query($query); } catch(Exception $_e) { return false; } return true; } function set_artiste ( $id, $nom, $image, $style, $pays, $site, $email_contact, $hide_email, $contact_form, $identifiant_paypal, $lien_boutique, $lien_facebook, $lien_flickr, $lien_twitter, $lien_youtube, $dossier_personnel = null ) { try { $query = "UPDATE #--artistes SET" ." nom=".$this->eq($nom) .", image=".$this->eq($image) .", style=".$this->eq($style) .", pays=".$this->eq($pays) .", site=".$this->eq($site) .", email_contact=".$this->eq($email_contact) .", hide_email=".$hide_email .", contact_form=".$contact_form .", identifiant_paypal=".$this->eq($identifiant_paypal) .", lien_boutique=".$this->eq($lien_boutique) .", lien_facebook=".$this->eq($lien_facebook) .", lien_flickr=".$this->eq($lien_flickr) .", lien_twitter=".$this->eq($lien_twitter) .", lien_youtube=".$this->eq($lien_youtube) .", dossier_personnel=".$this->eq($dossier_personnel) ." WHERE id=".$id; $this->sql->query($query); } catch(Exception $_e) { return false; } return true; } function del_artiste($id_artiste) { try { if(($id_artiste_news_categorie = $this->id_categorie(array("root", "artistes", "news", $id_artiste))) !== false) { if($id_artiste_news_categorie) { $sql = "DELETE FROM #--contenus" ." WHERE categorie=".$id_artiste_news_categorie; $this->sql->query($sql); $sql = "DELETE FROM #--categories WHERE id=".$id_artiste_news_categorie; $this->sql->query($sql); $sql = "DELETE FROM #--categories_tree WHERE child=".$id_artiste_news_categorie; $this->sql->query($sql); } } else return false; $sql = "DELETE FROM #--albums WHERE id_artiste=".$this->eq($id_artiste); $this->sql->query($sql); $sql = "DELETE FROM #--concerts WHERE id_artiste=".$this->eq($id_artiste); $this->sql->query($sql); $sql = "DELETE FROM #--videos WHERE id_artiste=".$this->eq($id_artiste); $this->sql->query($sql); $downloads = array(); $sql = "SELECT id FROM #--downloads WHERE id_artiste=".$this->eq($id_artiste); $rst = $this->sql->query($sql); while($v_rst = $this->sql->fetch_assoc($rst)) $downloads[] = $v_rst["id"]; $this->sql->free_result($rst); foreach($downloads as $id_download) { $sql = "DELETE FROM #--download_urls WHERE id_download=".$id_download; $this->sql->query($sql); $sql = "DELETE FROM #--downloads WHERE id=".$id_download; $this->sql->query($sql); } $sql = "DELETE FROM #--artistes WHERE id=".$this->eq($id_artiste); $this->sql->query($sql); } catch(Exception $_e) { return false; } return true; } } ?>