= 1 && $i < 3 ) { //echo $i . $array[$i]; $reg = CountryBD::selectNom(urlencode($array[1])); $regio = $reg; $numArtistas = ObraBD::contaObresRegio($reg['id']); if ( $i == 1 ) $vecObr = ObraBD::selectObresRegio($reg['id'], 20, $pag); $vecZon = CountryBD::selectRegionsArbre($reg['id'], 999999999999, 0); if ( $i == 1 ) $numPag = ceil($numArtistas/20); $pai = CountryBD::selectNom(urldecode($array[0])); } if ( $i == 0 || $i < 3 ) { $pai = CountryBD::selectNom(urldecode($array[0])); $vecReg = CountryBD::selectRegionsArbre($pai['id'], 999999999999, 0); if ( $i == 0 ) $vecObr = ObraBD::selectObresPais($pai['id'], 20, $pag); $numArtistas = ObraBD::contaObresPais($pai['id']); if ( $i == 0 ) $numPag = ceil($numArtistas/20); } } else { $vecPais = CountryBD::selectPaisos($con['id'], 999999999999, 0); $vecObr = ObraBD::selectObresContinent($con['id'],20,$pag); $numArtistas = ObraBD::contaObresContinent($con['id']); $numPag = ceil($numArtistas/50); } include(PLANTILLES . "pla.llistat_pais.php"); } public static function llistatcomentarios() { $vecPais = new Vector(); $css = "artistas"; $pag = 0; $titol = comentarios_recientes; if ( !empty($_POST['del']) ) { ComentariBD::delete($_POST['del']); header("Location: ".URL."/".constant("url_comentarios").".html"); } if ( !empty($_POST['cri']) ) { ComentariBD::critica($_POST['cri'],1); header("Location: ".URL."/".constant("url_comentarios").".html"); } if ( !empty($_POST['idi']) ) { ComentariBD::lang($_POST['idi'],$_POST['enviar']); header("Location: ".URL."/".constant("url_comentarios").".html"); } if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $vecCom = ComentariBD::selectComentarios(25,$pag); $numCom = ComentariBD::contaComentarios(); $numPag = ceil($numCom/25); $url = constant("url_comentarios"); $titol_cap = comentarios_recientes; $map = "".comentarios_recientes.""; include(PLANTILLES . "pla.llistat_comentarios.php"); } public static function llistatcriticas() { $css = "criticos"; $vecPais = new Vector(); if ( !empty($_POST['del']) ) { ComentariBD::delete($_POST['del']); header("Location: ".URL."/".constant("url_criticas").".html"); } if ( !empty($_POST['cri']) ) { ComentariBD::critica($_POST['cri'],0); header("Location: ".URL."/".constant("url_criticas").".html"); } $pag = 0; $titol = criticas_recientes; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $vecCom = ComentariBD::selectCriticas(25,$pag); $numCom = ComentariBD::contaCriticas(); $numPag = ceil($numCom/25); $url = constant("url_criticas"); $titol_cap = criticas_recientes; include(PLANTILLES . "pla.llistat_comentarios.php"); } public static function tema() { $titol_cap = foro; $cap = 3; if ( !empty($_GET['id']) ) { $p = ForoBD::selectPrimerTema($_GET['id']); if ( $p != null ) { if ( !empty($_POST['tema']) && $_SESSION['user']->isAdmin() ) { ForoBD::deleteTema($_POST['tema']); header("Location: ".URL."/".url_foro); } if ( !empty($_POST['post']) && $_SESSION['user']->isAdmin() ) { ForoBD::deletePost($_POST['post']); header("Location: ".URL."/".url_tema."/".$_GET['id']."-tema.html"); } if ( !empty($_POST['desc']) && $_SESSION['user']->isIdentificat() ) { $com = htmlentities($_POST['desc'], ENT_QUOTES); ForoBD::insertPost($_SESSION['user']->get('id'), $_GET['id'], $com, $p['titol'], $p['id_cat']); if ( !empty($_POST['respon']) ) { $uresp = UsuariBD::select($_POST['respon']); Control::mailForo($uresp,$p); } $uresp = UsuariBD::select($p['id_usuari']); Control::mailForo($uresp,$p); header("Location: ".URL. "/".url_tema."/".$_GET['id']."-tema.html"); exit(0); } $vecTem = ForoBD::selectPostTema($_GET['id']); include(PLANTILLES ."pla.forum_post.php"); } } } public static function foro() { $titol_cap = foro; $cap = 3; if ( !empty($_GET['id']) ) { $cat = ForoBD::selectCat($_GET['id']); $vecTem = ForoBD::selectTemasCat($_GET['id']); include(PLANTILLES ."pla.forum_temas.php"); } else { $vecCat = ForoBD::selectCategories(); $vecTem = ForoBD::selectTemas(5,0); //$vecPost = ForoBD::selectPost(3,0); include(PLANTILLES ."pla.forum.php"); } } public static function editartema() { $cap = 3; if ( $_SESSION['user']->isIdentificat() ) { if ( !empty($_POST['titol']) && !empty($_POST['desc']) ) { $com = Dades::bo($_POST['desc']); $tit = Dades::bo($_POST['titol']); ForoBD::insertTema($_SESSION['user']->get('id'), $com, $tit, $_POST['cat']); header("Location: ".URL."/".url_foro."/".$_POST['cat']."-cat.html"); exit(0); } if ( !empty($_POST['cat']) ) { $cat = ForoBD::selectCat($_POST['cat']); $idcat = $_POST['cat']; include(PLANTILLES . "pla.forum_editartema.php"); } } else { header("Location: ".URL."/".url_foro.".html"); } } public static function noartista() { include(PLANTILLES . "pla.noartista.php"); } /************************************** PAGINA ARTISTA ****************************************************************************************/ public static function artistas() { $cap = 10; $vecPais = new Vector(); $usr = UsuariBD::selectUsuari($_GET['id']); if ( $usr != null && $usr->get('actiu') == 0 ) { header("Location: ".URL."/noartista.html"); exit(0); } if ( !empty($_GET['sub']) ) { $sec = $_GET['sub']; if ( defined("func_". $_GET['sub']) ) { $sec = constant("func_".$_GET['sub']); } Web::$sec(); } else { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); exit(0); } /* if ( $usr->get('ga_act') ) { $galeriaId= 0; $vecGal = ObraBD::selectGalerias($usr->get('id')); } if ( $usr->get('ob_act') ) { $vecObres = ObraBD::selectUsuari($usr->get('id'), 15, 0); $numPag = ceil(ObraBD::contaUsuari($usr->get('id'))/15); } */ $vecComR = new Vector(); if ( $usr->get('critico') && !$usr->get('artista') && !$usr->get('coleccionista') && !$usr->get('entidad') ) { $vecComR = ComentariBD::selectRealizados($usr->get('id'),5,0); } $vecCom = new Vector(); if ( $usr->get('co_act') ) { $vecCom = ComentariBD::selectRecibidos($usr->get('id'),5,0); } $vecFla = new Vector(); if ( $usr->get('pr_act') ) { if ( $usr->get('fl_n') ) { $vecFla = ObraBD::selectObresGaleria($usr->get('fl_n'),100,0); } else { $vecFla = ObraBD::selectUsuari($usr->get('id'), 100, 0); } } else { $vecFla = ObraBD::selectRandomArtista($usr->get('id'), 20); } $blog = null; if ( $usr->get('blog_act') ) { $blog = BlogBD::selectBlog($usr->get('blog_act')); } $portada = true; $titol_cap = constant("titol_".$usr->getCSS()) ." ".$usr->get('nom') . " ". $usr->get('cognom'); include(PLANTILLES . "pla.artista.php"); } } public static function contactar() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); exit(0); } else { if ( !$_SESSION['user']->isIdentificat() ) { if ( !empty($_POST['msg']) ) { if ( $_POST['g-recaptcha-response'] ) { $t = $_POST; $_SESSION['alert'] =""; if ( $t['nom'] != "" && $t['cognom'] != "" && $t['direccion'] != "" && $t['telefono'] != "" && $t['pais'] != "" && $t['poblacion'] != "" ) { if ( Dades::email($t['email']) ) { if ( UsuariBD::comprovarMail($t['email']) ) { $t['artista'] = 0; $t['entidad'] = 0; $t['coleccionista'] = 0; $t['critico'] = 0; $t['usuari'] = UsuariBD::crearUsuari(Dades::traduccio($t['nom'])); $t['pwd1'] = "a" . Dades::aleatori(5) . "w"; $t['random'] = Dades::aleatori(7); $mis = $t['nom'] ."
". $t['cognom']."
". $t['poblacion'] ." (".$t['pais'].")
". $t['direccion']."
telf:". $t['telefono']."
"; $mis .= Dades::bo($t['msg']); $i = UsuariBD::insert($t); $t['id'] = $i; Control::mailAlta($t); //header("Location: ".URL); $_SESSION['alert'] = alta_completa_revisar_mail_contactar; $guardat = false; $usr_send = UsuariBD::select($i); MensajeBD::insertDel($t['random'], $usr->get('id'), $usr_send->get('id'), $mis); } else { $_SESSION['alert'] = mail_repetit; } } else $_SESSION['alert'] = mail_incorrecte; } else $_SESSION['alert'] = falten_dades; } else $_SESSION['alert'] = error; } } else { if ( !empty($_POST['msg']) ) { // salvar el missatge $mis = Dades::bo($_POST['msg']); if ( $_SESSION['user']->isAdmin() && $usr->isAdmin() && $_SESSION['user']->get('id') == $usr->get('id') ) { MensajeBD::insertTots($_SESSION['user']->get('id'), $mis, $_SESSION['user']->get('permis_mis')); } else { if ( MensajeBD::contaAvui($_SESSION['user']->get('id')) < 3 ) { MensajeBD::insert($usr->get('id'), $_SESSION['user']->get('id'), $mis, $_SESSION['user']->get('permis_mis')); if ( $_SESSION['user']->get('permis_mis') ) { Control::mailMensaje($usr); } $_SESSION['alert'] = '
'.mensaje_enviado.'
'; } else { $_SESSION['alert'] = '
'.demasiados_mesajes_hoy.'
'; } } } if (!empty($_POST['baixa'])) { $o = $_POST; if ( !isset($o['entidad']) ) $o['entidad']=0; if ( !isset($o['artista']) ) $o['artista']=0; if ( !isset($o['coleccionista']) ) $o['coleccionista']=0; if ( !isset($o['critico']) ) $o['critico']=0; UsuariBD::updateTipus($usr,$o); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } if (!empty($_POST['topart'])) { UsuariBD::updateTop($usr->get('id'), $_POST['mesos']); Control::mailTopART($usr); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } if (!empty($_POST['baixa'])) { ObraBD::banUsuari($usr->get('id'),1); UsuariBD::baixa($usr->get('id'),1); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } } $vecMis = new Vector(); if ( $_SESSION['user']->isIdentificat() ) { $vecMis = MensajeBD::selectConversa($_SESSION['user']->get('id'), $usr->get('id')); } $titol_cap = contactar ." ". $usr->get('nom') . " ". $usr->get('cognom'); $sec = 1; include(PLANTILLES . "pla.artista_contactar.php"); } } public static function galeria() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); if ( $usr == null ) { header("Location: ".URL); } //$vecRec = UsuariBD::selectRecomienda($usr->get('id')); //$vecLeRec = UsuariBD::selectLeRecomiendan($usr->get('id')); $vecGal = ObraBD::selectGalerias($usr->get('id')); $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $galeriaId= 0; if ( !empty($_GET['gal']) ) { $galeriaId = $_GET['gal']; $vecObres = ObraBD::selectObresGaleria($_GET['gal'], 15, $pag); $galeria = ObraBD::selectGaleria($_GET['gal']); $numPag = ceil(ObraBD::contaObresGaleria($_GET['gal'])/15); $titol_cap = galeria ." ". $galeria->get('titol') ." ". $usr->get('nom') . " ". $usr->get('cognom'); } else { $vecObres = ObraBD::selectUsuari($usr->get('id'), 15, $pag); $numPag = ceil(ObraBD::contaUsuari($usr->get('id'))/15); $titol_cap = galeria ." ".$usr->get('nom') . " ". $usr->get('cognom'); } } else { header("Location: ".URL); } $sec = 2; include(PLANTILLES . "pla.artista_galeria.php"); } public static function pont() { if ( $_SESSION['user']->isIdentificat() ) { $desti = "editar.html"; if ( $_SESSION['user']->faltenDades() ) { $desti = "validar.html"; } $usr = UsuariBD::select($_SESSION['user']->get('id')); include(PLANTILLES."form.pont.php"); } } public static function ponthosting() { if ( $_SESSION['user']->isIdentificat() ) { $desti = "editar.html"; $usr = UsuariBD::select($_SESSION['user']->get('id')); include(PLANTILLES."pla.pont_hosting.php"); } } public static function pontobra() { if ( $_SESSION['user']->isIdentificat() ) { $desti = "editarobra.html"; if ( !empty($_GET['id']) ) { $obr = ObraBD::select($_GET['id']); if ( $obr->get('id_usuari') == $_SESSION['user']->get('id') ) { $desti = "editarobra/".$_GET['id']."-obra.html"; } } if ( $_SESSION['user']->faltenDades() ) { $desti = "validar.html"; } $usr = UsuariBD::select($_SESSION['user']->get('id')); include(PLANTILLES."form.pont.php"); } } public static function calendar() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $titol = Comentarios_Recibidos; $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $url = "calendar"; $titol_cap = agenda ." ".$usr->get('nom') . " ". $usr->get('cognom'); //$vecAgenda = AgendaBD::selectUser($usr); $sec = 3; include(PLANTILLES . "pla.artista_agenda.php"); } public static function debate() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $titol = Comentarios_Recibidos; $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $url = "calendar"; $titol_cap = agenda ." ".$usr->get('nom') . " ". $usr->get('cognom'); $vecTem = ForoBD::selectTemasUser($usr->get('id'), 99, 0); $sec = 7; include(PLANTILLES . "pla.artista_forum.php"); } public static function critica() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $titol = Comentarios_Recibidos; $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = "critica"; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $vecCom = ComentariBD::selectRecibidos($usr->get('id'),15,$pag); $numPag = ceil($numComRec/15); $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 1; include(PLANTILLES . "pla.artista_critica.php"); } public static function criticarealizada() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $titol = Comentarios_Realizados; $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } if ( !empty($_POST['del']) && $_SESSION['user']->isIdentificat() ) { ComentariBD::deleteComentari($_SESSION['user']->get('id'), $_POST['del']); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); exit(0); } $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = "criticarealizada"; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $vecCom = ComentariBD::selectRealizados($usr->get('id'),15,$pag); $numPag = ceil($numComRea/15); $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 2; include(PLANTILLES . "pla.artista_critica.php"); } public static function criticaarte() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $titol = Comentarios_Realizados; $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); exit(0); } $coment = ComentariBD::select($_GET['gal']); if ( $usr->get('id') == $coment->get('id_usuari_send') ) { $user_send = $coment->getUsuariSend(); $user_rep = $coment->getUsuariRep(); $obr = ObraBD::select($coment->get('id_foto')); $sec = 3; $subsec = 2; $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); include(PLANTILLES . "pla.critica.php"); } else { header("Location: ".URL); } } public static function recomendaciones() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); exit(0); } if ( $_SESSION['user']->permis($usr) ) { $permis = true; } if ( !empty($_POST['del']) && $_SESSION['user']->isIdentificat() ) { $u = UsuariBD::select($_POST['del']); if ( $u != null ) { if ( $_SESSION['user']->get('id') != $_POST['del'] && UsuariBD::recomienda($_SESSION['user']->get('id'), $_POST['del']) > 0 ) { UsuariBD::delRecomana($_SESSION['user']->get('id'), $_POST['del']); } } $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); exit(0); } $titol = recomienda; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = url_recomendaciones; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $numPag = ceil($numArtRec/14); $vecR = UsuariBD::selectRecomienda($usr->get('id'),14,$pag); $vecReco = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = UsuariBD::select($idu); $vecReco->add($u); } $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 3; include(PLANTILLES . "pla.artista_recomendaciones.php"); } public static function lerecomiendan() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $titol = le_recomienda; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = url_lerecomiendan; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $numPag = ceil($numArtLeRec/14); $vecR = UsuariBD::selectLeRecomiendan($usr->get('id'),14,$pag); $vecReco = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = UsuariBD::select($idu); $vecReco->add($u); } $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 4; include(PLANTILLES . "pla.artista_recomendaciones.php"); } public static function obrasrecomendadas() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } if ( $_SESSION['user']->permis($usr) ) { $permis = true; } if ( !empty($_POST['del']) && $_SESSION['user']->isIdentificat() ) { $o = ObraBD::select($_POST['del']); if ( $o != null ) { ObraBD::delRecomendada($_SESSION['user']->get('id'), $_POST['del']); } $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); exit(0); } $titol = obras_recomendadas; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = url_obrasrecomendadas; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $numPag = ceil($numObrRec/15); $vecR = ObraBD::selectRecomienda($usr->get('id'),15,$pag); $vecObres = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = ObraBD::select($idu); if ( $u != null ) $vecObres->add($u); } $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 5; include(PLANTILLES . "pla.artista_obrasrecomienda.php"); } public static function obraslerecomiendan() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $titol = le_recomienda; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $url = url_lerecomiendan; $numComRec = ComentariBD::contaRecibidos($usr->get('id')); $numComRea = ComentariBD::contaRealizados($usr->get('id')); $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $numPag = ceil($numObrLeRec/15); $vecR = ObraBD::selectLeRecomiendan($usr->get('id'),15,$pag); $vecObres = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = ObraBD::select($idu); $vecObres->add($u); } $titol_cap = critica ." ".$usr->get('nom') . " ". $usr->get('cognom'); $sec = 3; $subsec = 6; include(PLANTILLES . "pla.artista_obrasrecomienda.php"); } public static function entrevista() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $entrevista = null; $entrevista = UsuariBD::selectEntrevista($usr->get('id')); $sec = 5; $subsec = 2; $titol_cap = entrevista ." ".$usr->get('nom') . " ". $usr->get('cognom'); include(PLANTILLES . "pla.artista_entrevista.php"); } public static function editar() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $ima = "icons_inici.gif"; $numArtRec = UsuariBD::contaRecomienda($usr->get('id')); $numObrRec = ObraBD::contaRecomienda($usr->get('id')); $numArtLeRec = UsuariBD::contaLeRecomiendan($usr->get('id')); $numObrLeRec = ObraBD::contaLeRecomiendan($usr->get('id')); $vecObres = ObraBD::selectVistasUser($usr->get('id'), 4); include(PLANTILLES. "form.inici.php"); } else header("Location:". URL); } public static function validar() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $vecPais = CountryBD::selectAllPaisos(); $vecRegio = new Vector(); $vecLo = new Vector(); if ( !empty($_POST['enviar']) ) { if ( !empty($_POST['sexe']) && !empty($_POST['nom']) && !empty($_POST['email']) && !empty($_POST['cognom']) && !empty($_POST['id_pa']) && !empty($_POST['id_re']) && (!empty($_POST['id_lo']) || !empty($_POST['localitat'])) ) { if ( !empty($_POST['localitat']) ) { $id_lo = CountryBD::insertLocalitat(Dades::bo($_POST['localitat']), $_POST['id_re']); $_POST['id_lo'] = $id_lo; } if ( !empty($_POST['id_lo']) ) { $t = $_POST; $t['nom']= Dades::bo($_POST['nom']); $t['cognom']=Dades::bo($_POST['cognom']); $t['email']=Dades::bo($_POST['email']); $t['sexe'] = Dades::bo($_POST['sexe']); $t['edat'] = $_POST['any'] ."-". $_POST['mes']. "-".$_POST['dia']; UsuariBD::updateValidar($usr, $t); $_SESSION['user'] = UsuariBD::select($_SESSION['user']->get('id')); header("Location: ".URL."/editar.html"); } else { $_SESSION['alert'] = localitat_existeix; } } else { $_SESSION['alert'] = falten_dades; } } if ( !empty($_POST['id_pa']) ) { $vecRegio = CountryBD::selectRegions($_POST['id_pa'],9999,0); } else { $_POST['id_pa'] = $usr->get('id_pa'); $vecRegio = CountryBD::selectRegions($_POST['id_pa'],9999,0); } if ( !empty($_POST['id_re']) ) { $vecLo = CountryBD::selectLocalitatRe($_POST['id_re'],9999,0); } else { $_POST['id_re'] = $usr->get('id_re'); $vecLo = CountryBD::selectLocalitatRe($_POST['id_re'],9999,0); } if ( empty($_POST['id_lo']) ) $_POST['id_lo'] = $usr->get('id_lo'); include(PLANTILLES. "form.valida.php"); } } public static function editaragenda() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $agenda = null; $ima = "icons-agenda.gif"; $menu = "agen"; if ( !empty($_GET['id']) ) { $agenda = AgendaBD::select($_GET['id']); if ( $agenda->get('id_us') != $usr->get('id') ) { $agenda = null; } } if ( !empty($_POST['mapa']) ){ AgendaBD::updateMapa($_POST['lat'], $_POST['lng'], $_POST['id']); $guardat = false; $_SESSION['alert'] = ""; } if ( !empty($_POST['del']) ) { AgendaBD::delete($_POST['del'],$usr->get('id')); $guardat = false; $_SESSION['alert'] = ""; } if ( !empty($_POST['enviar']) ) { $t = $_POST; if ( $t['localidad'] != "" && $t['titulo'] != "" && $t['desc'] != "" && $t['data_inici'] != "" && $t['data_fi'] != "" && $t['pais'] != "" ) { if ( $agenda == null ) { $id = AgendaBD::insert($usr->get('id'), $_POST); $agenda = AgendaBD::selectUltimUsuari($usr->get('id')); $id = $agenda->get('id'); //$agenda = AgendaBD::select($id); } else { AgendaBD::update($agenda->get('id'), $_POST); $id = $agenda->get('id'); } //include(PLANTILLES."form.mapa.php"); header("Location: ".URL."/editaragenda.html"); exit(0); } else { $_SESSION['alert'] = falten_dades; } } if ( $agenda != null ) { $_POST = $agenda->vec; } $idus = $usr->get('id'); $vecGal = ObraBD::selectGalerias($idus); $vecBlog = BlogBD::selectUser($idus, 9999, 0); $vecAgenda = AgendaBD::selectUsuari($idus); $vecPais = CountryBD::selectAllPaisos(); $menu = "age"; include(PLANTILLES. "form.agenda.php"); } } public static function editarentrevista() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $entrevista = UsuariBD::selectEntrevista($usr->get('id')); if ( !empty($_POST['enviar']) ) { if ( $entrevista == null ) { UsuariBD::insertEntrevista($usr->get('id'), $_POST); } else { UsuariBD::updateEntrevista($usr->get('id'), $_POST); } $_SESSION['alert'] = ""; //$guardat = t; header('Location:' .URL."/editarentrevista.html"); exit(0); } $titulo = edit_entrevista; $ima = "icons-entre.gif"; $menu = "ent"; include(PLANTILLES. "form.artista_entrevista.php"); } } public static function biografia() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); } if ( $usr == null ) { header("Location: ".URL); } $sec = 5; $subsec = 1; if ( $usr->getCSS() != "entidades" ) { $titol_cap = biografia; } else { $titol_cap = informacion; } $titol_cap .= " ".$usr->get('nom') . " ". $usr->get('cognom'); $entrevista = null; $entrevista = UsuariBD::selectEntrevista($usr->get('id')); include(PLANTILLES . "pla.artista_biografia.php"); } public static function mail() { $vecPais = new Vector(); if ( $_SESSION['user']->isIdentificat() ) { $mail = true; $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; if ( !empty($_POST['del']) ) { $mis = MensajeBD::select($_POST['del']); if ( $_SESSION['user']->get('id') == $mis->get('id_usuari') || $_SESSION['user']->get('id') == $mis->get('id_usuari_send') ) { if ( $mis->get('del_usr') == 0 ) { MensajeBD::deleteUser($mis->get('id'), $usr->get('id')); } else { MensajeBD::delete($mis->get('id')); } header("Location: ".URL."/mail.html"); } } $sec = 0; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $vecMis = MensajeBD::selectRebuts($usr->get('id'),50,0); $titol_cap = webmail ." ".$usr->get('nom') . " ". $usr->get('cognom'); MensajeBD::marcaLlegits($_SESSION['user']->get('id')); include(PLANTILLES. "pla.webmail.php"); } else { header("Location: ".URL); } } public static function mailsend() { $vecPais = new Vector(); if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $mail = true; if ( !empty($_POST['del']) ) { $mis = MensajeBD::select($_POST['del']); if ( $_SESSION['user']->get('id') == $mis->get('id_usuari') || $_SESSION['user']->get('id') == $mis->get('id_usuari_send') ) { if ( $mis->get('del_usr') == 0 ) { MensajeBD::deleteUser($mis->get('id'), $usr->get('id')); } else { MensajeBD::delete($mis->get('id')); } header("Location: ".URL."/mailsend.html"); } } $sec = 1; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $vecMis = MensajeBD::selectEnviats($usr->get('id'),50,0); include(PLANTILLES. "pla.webmail.php"); } else { header("Location: ".URL); } } public static function llegirmail() { if ( $_SESSION['user']->isIdentificat() ) { if ( !empty($_GET['id']) ) { $mis = MensajeBD::select($_GET['id']); if ( $_SESSION['user']->get('id') == $mis->get('id_usuari') || $_SESSION['user']->get('id') == $mis->get('id_usuari_send') ) { header('Content-Type: text/html; charset=UTF-8'); include(PLANTILLES. "pla.mail.php"); } } } else { header("Location: ".URL); } } /************************************************************************************** EDITAR ********************************************************/ public static function editarblog() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; if ( !empty($_GET['id']) ) { $blog = BlogBD::selectBlog($_GET['id']); if ( $blog->get('id_us') != $usr->get('id') ) { $blog = null; } } if ( !empty($_POST['del']) ) { BlogBD::delete($_POST['del'],$usr->get('id')); Control::deleteFotoBlog($_POST['del']."-1"); Control::deleteFotoBlog($_POST['del']."-2"); Control::deleteFotoBlog($_POST['del']."-3"); // $guardat = te; $_SESSION['alert'] = ""; } if ( !empty($_POST['delima']) && !empty($_POST['delfoto']) ) { Control::deleteFotoBlog($blog->get('id')."-".$_POST['delfoto']); } $titulo = editar_blog; $menu = "blog"; $ima = "icons-pblog.gif"; if ( !empty($_POST['enviar']) ) { $t = $_POST; if ( $t['tit'] != "" && $t['text'] != "" ) { $ima1 = false; if ( $_FILES['fname1']['name'] != "" ) $ima1 = true; $ima2 = false; if ( $_FILES['fname2']['name'] != "" ) $ima2 = true; $ima3 = false; if ( $_FILES['fname3']['name'] != "" ) $ima3 = true; $t['video'] = str_replace("http://www.youtube.com/watch?v=", "http://www.youtube.com/v/", $t['video']); if ( $blog != null ) { BlogBD::update($blog->get('id'), $t); $id = $blog->get('id'); } else { $id = BlogBD::insert($usr->get('id'), $t); $bl = BlogBD::selectBlog($id); Control::mailPujaArticle($usr, $bl); } if ( $ima1 ) Control::pujarBlog($_FILES['fname1'], $id."-1"); if ( $ima2 ) Control::pujarBlog($_FILES['fname2'], $id."-2"); if ( $ima3 ) Control::pujarBlog($_FILES['fname3'], $id."-3"); if ( $_SESSION['alert'] == "" ) { //$guardat = te; $_SESSION['alert'] = ""; } } else { $_SESSION['alert'] = falten_dades; } } if ( !$guardat ) { if ( $blog != null ) { $_POST = $blog->vec; $_POST['text'] = Dades::pla($_POST['text']); } $idus = $usr->get('id'); $vecBlog = BlogBD::selectUsuari($idus,50, 0); } include(PLANTILLES. "form.blog.php"); } else header("Location:". URL); } public static function editarpassword() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; $menu = "pas"; $titulo = edit_password; $ima = "icons-pw.gif"; if ( !empty($_POST['enviar']) ) { $t = $_POST; if ( $t['pass1'] == $t['pass2'] ) { if ( Dades::comprovarPass($t['pass1']) ) { UsuariBD::updatePassword($usr->get('id'), $t); //$guardat = tr; $_SESSION['alert'] = ""; } } else { $_SESSION['alert'] = no_coincideixen_password; } } include(PLANTILLES. "form.password.php"); } else header("Location:". URL); } public static function editaravisos() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; $menu = "avis"; $titulo = edit_avisos; $ima = "icons-pw.gif"; if ( !empty($_POST['enviar']) ) { $t = $_POST; UsuariBD::updateAvisos($usr->get('id'), $t); //$guardat = t; $_SESSION['alert'] = ""; } include(PLANTILLES. "form.avisos.php"); } else header("Location:". URL); } public static function editarbiografia() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; $titulo = editar_biografia; $ima = "icons-bio.gif"; $menu = "bio"; if ( !empty($_POST['enviar']) ) { $t = $_POST['bio']; UsuariBD::updateBio($usr, Dades::bo($t)); if ( LANG == "es" ) { UsuariBD::updateBioLang($usr, Dades::bo($_POST['bio_en']), "en"); } //$guardat = tre; $_SESSION['alert'] = ""; } else { $_POST['bio'] = Dades::pla($usr->get('presentacion_'.LANG)); } include(PLANTILLES. "form.artista_biografia.php"); } else header("Location:". URL); } public static function editarportada() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $titulo = editar_portada; $menu = "port"; $ima = "icons-portada.gif"; if ( !empty($_POST['enviar']) ) { //$t = $_POST['bio_'.LANG]; //nom=%s, cognom=%s, direccion=%s, poblacion=%s, pais=%s, telefono=%s, email=%s, movil=%s, web=%s UsuariBD::updatePortada($usr->get('id'), $_POST); //$guardat = te; $_SESSION['alert'] = ""; } $portada = $usr->vec; $idus = $usr->get('id'); $vecGal = ObraBD::selectGalerias($idus); $vecBlog = BlogBD::selectUser($idus,200, 0); include(PLANTILLES. "form.portada.php"); } else header("Location:". URL); } public static function editarperfil() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $guardat = false; $editor = null; $titulo = editar_perfil; $menu = "per"; $ima = "icons-usuari.gif"; if ( !empty($_POST['enviar']) ) { $t = $_POST; //$t = $_POST['bio_'.LANG]; if ( $t['nom'] != "" && $t['cognom'] != "" && $t['email'] != "" ) { $t['nom']= Dades::bo($_POST['nom']); $t['cognom']=Dades::bo($_POST['cognom']); $t['direccion'] = Dades::bo($_POST['direccion']); $t['poblacion'] = Dades::bo($_POST['poblacion']); $t['pais'] = Dades::bo($_POST['pais']); $t['telefono'] = Dades::bo($_POST['telefono']); $t['email'] = Dades::bo($_POST['email']); $t['movil'] = Dades::bo($_POST['movil']); $t['web'] = Dades::bo($_POST['web']); $t['edat'] = $_POST['any'] ."-". $_POST['mes']. "-".$_POST['dia']; UsuariBD::updateUser($usr, $t); if ( $_FILES['fname']['name'] != "" ) { Control::pujarAvatar($_FILES['fname'], $usr->get('id')); $usr->set('foto', 2); UsuariBD::updateFoto($usr); } //$guardat = te; $_SESSION['alert'] = ""; } else $_SESSION['alert'] = falten_dades; } if ( !empty($_POST['baixa']) ) { $mis = Dades::bo("[BAJA] Solicitud de baja"); $usrAd = UsuariBD::select(1135); MensajeBD::insert(1135, $_SESSION['user']->get('id'), $mis, $_SESSION['user']->get('permis_mis')); Control::mailMensaje($usrAd); $_SESSION['alert'] = '
'.mensaje_enviado.'
'; } include(PLANTILLES. "form.artista_perfil.php"); } else header("Location:". URL); } public static function editargaleria() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); if ( !empty($_GET['id']) ) { $gal = ObraBD::selectGaleria($_GET['id']); if ( $gal->get('id_usuari') != $usr->get('id') ) { $gal = null; } if ( !empty($_POST['ordre']) ) { ObraBD::updateOrdreGaleria($_POST['id'], $_POST['ordre'], $_POST['ordre_v'], $usr->get('id')); } if ( !empty($_POST['canvigal']) ) { ObraBD::updateGaleria($_POST['id'], $_POST['gal']); } } if ( !empty($_POST['enviar']) ) { $o = &$_POST; $o['idus'] = $usr->get('id'); if ( $o['titol'] != "" && $o['text'] != "" ) { if ( $gal != null ) { ObraBD::updateGal($gal->get('id'), $o); } else { $id = ObraBD::insertGaleria($o); } // $guardat = ; $_SESSION['alert'] = ""; header("Location: ".URL."/editargaleria.html"); } } if ( !empty($_POST['del']) ) { ObraBD::deleteGaleria($_POST['del'],$usr->get('id')); // $guardat = ; $_SESSION['alert'] = ""; header("Location: ".URL."/editargaleria.html"); } $vecObres = new Vector(); if ( $gal != null ) { $_POST = $gal->vec; $_POST['text'] = $gal->getDescripcio(); //$_POST['datafeta'] = $obr->get('data'); $numObres = ObraBD::contaObresGaleria($gal->get('id')); if ( !empty($_GET['pag']) ) { $vecObres = ObraBD::selectUsuari($usr->get('id'), 500, 0); } else { $vecObres = ObraBD::selectObresGaleria($gal->get('id'), 500, 0); } } $idus = $usr->get('id'); $vecGal = ObraBD::selectGalerias($idus); $titulo = edit_galeria; $ima = "icons-galeria.gif"; $menu = "gal"; if ( $gal != null ) include(PLANTILLES."form.galeria_edit.php"); else include(PLANTILLES. "form.galeria.php"); } else header("Location:". URL); } public static function editarobres() { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); if ( !empty($_POST['ordre']) ) { ObraBD::updateOrdre($_POST['id'], $_POST['ordre'], $_POST['ordre_v'], $usr->get('id')); } $pag = 1; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $num = $pag * 30; $vecObres = ObraBD::selectUsuari($usr->get('id'), $num, 0); $numObres = ObraBD::contaUsuari($usr->get('id')); $numPag = $numObres - $num; $menu = "obres"; $titulo = edit_obres; $ima = "icons-editar.gif"; include(PLANTILLES. "form.obres.php"); } else header("Location:". URL); } public static function editarobra() { if ( $_SESSION['user']->isIdentificat() ) { $menu = "obr"; $usr = UsuariBD::select($_SESSION['user']->get('id')); $obr = null; if ( !empty($_GET['id']) ) { $obr = ObraBD::select($_GET['id']); if ( $obr->get('id_usuari') != $usr->get('id') ) { $obr = null; } else $menu = "obres"; } $guardat = false; $editor = null; $titulo = editar_perfil; $ima = "icons-subir.gif"; if ( !empty($_POST['enviar']) ) { //$t = $_POST['bio_'.LANG]; //nom=%s, cognom=%s, direccion=%s, poblacion=%s, pais=%s, telefono=%s, email=%s, movil=%s, web=%s $o = &$_POST; $ima = false; if ( $_FILES['fname']['name'] != "" ) $ima = true; if ( $o['nom'] != "" && $o['text'] != "" && $o['categoria'] != "" && ( $ima || $obr != null ) ) { $o['art'] = $usr->get('artista'); $o['ancho'] = Dades::bo($o['ancho']); $o['alto'] = Dades::bo($o['alto']); $o['profundidad'] = Dades::bo($o['profundidad']); $o['id_usuari'] = $usr->get('id'); $o['euros'] = Dades::bo($o['euros']); $o['dolares'] = Dades::bo($o['dolares']); if ( $obr != null ) { $id = $obr->get('id'); } else $id = ObraBD::ultimId(); if ( $ima ) { Control::pujarFoto($_FILES['fname'], $id); } if ( $_SESSION['alert'] == "" ) { if ( $obr != null ) { ObraBD::update($obr, $o); } else { $id1 = ObraBD::insert($o); if ( LANG == "es" ) { $o['nom_en'] = Dades::bo($o['nom_en']); $o['descripcion_en'] = Dades::bo($o['descripcion_en']); ObraBD::updateIdioma("en", $id1, $o); } $obra = ObraBD::select($id1); Control::mailPujaObra($usr, $obra); } //$guardat = tue; $_SESSION['alert'] = ""; header("Location: ".URL."/editarobres.html"); exit(0); } } else { $_SESSION['alert'] = faltan_dades; } } if ( $_POST['delete'] ) { $n = ComentariBD::contaCriticaObra($obr->get('id')); if ( $n > 0 ) { $_SESSION['alert'] = no_eliminar_te_critica; } else { ObraBD::delete($obr->get('id')); ComentariBD::deleteAllObra($obr->get('id')); Control::deleteFoto($obr->get('id')); //$guardat = te; $_SESSION['alert'] = ""; header("Location: ".URL."/editarobres.html"); exit(0); } // } if ( $obr != null ) { $_POST = $obr->vec; $_POST['nom'] = $obr->get('nom_'.LANG); $_POST['text'] = Dades::pla($obr->getDescripcio()); $_POST['datafeta'] = $obr->get('data'); } $idus = $usr->get('id'); $vecGal = ObraBD::selectGalerias($idus); $vecCat = MenuBD::selectCategoria(); $vecEst = MenuBD::selectEstilo(); $vecTec = MenuBD::selectTecnica(); $vecSop = MenuBD::selectSoporte(); $vecMat = MenuBD::selectMaterial(); $vecTam = MenuBD::selectTamano(); $ima = "icons-subir.gif"; include(PLANTILLES. "form.obra.php"); } else header("Location:". URL); } public static function blog() { $vecPais = new Vector(); $vecBlog = new Vector(); if ( !empty($_GET['id']) ) { $usr = UsuariBD::selectUsuari($_GET['id']); $sec = 6; if ( !empty($_GET['gal']) ) { // Inserir un comentari if ( !empty($_POST['eliminar']) && ($_SESSION['user']->get('id') == $usr->get('id') || $_SESSION['user']->isAdmin() ) ) { // Eliminar un comentari ComentariBD::deleteAllBlog($_GET['gal']); BlogBD::delete($_GET['gal'], $usr->get('id')); header("Location: ". $usr->getUrl() ."/blog.html"); exit(0); } if ( !$_SESSION['user']->isIdentificat() ) { $_SESSION['alert'] = "
".debes_registrar."
"; } $blog = BlogBD::selectBlog($_GET['gal']); if ( !empty($_POST['comentario']) && $_SESSION['user']->isIdentificat() ) { $com = htmlentities($_POST['comentario'], ENT_QUOTES); ComentariBD::insertBlog($usr->get('id'), $_SESSION['user']->get('id'),$blog->get('id'), $com); $_SESSION['alert'] = "
".comentario_realizado_correcto."
"; //actualitzar numero comentaris $n = BlogBD::contaComentaris($blog->get('id')); $blog->set('comentarios', $n); BlogBD::updateComentaris($blog); header("Location: ". $usr->getUrl() . "/" . url_blog ."-". $blog->get('id') . ".html"); } else { if ( !empty($_POST['delete']) && ( $_SESSION['user']->isAdmin() || $_SESSION['user']->get('id') == $usr->get('id') ) ) { // Eliminar un comentari ComentariBD::deleteBlog($_POST['del']); //actualitzar numero comentaris $n = BlogBD::contaComentaris($blog->get('id')); $blog->set('comentarios', $n); BlogBD::updateComentaris($blog); header("Location: ". $usr->getUrl() . "/" . url_blog ."-". $blog->get('id') . ".html"); exit(0); } else { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecCom = BlogBD::selectComentaris($_GET['gal'],9999,0); if ( !IpBD::existeixBlog($_SERVER['REMOTE_ADDR'], $blog->get('id')) ) { IpBD::insert($_SERVER['REMOTE_ADDR'],0,$blog->get('id'),0); BlogBD::updatePunto($blog); IpBD::neteja(); } $titol_cap = blog ." ".$blog->titulo() . " - ". $usr->get('nom') ." ". $usr->get('cognom'); include(PLANTILLES . "pla.artista_blog_article.php"); } } } else { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecBlog = BlogBD::selectUser($usr->get('id'),20,$pag); $numPag = ceil(BlogBD::contaUser($usr->get('id'))/20); $titol_cap = blog ." ". $usr->get('nom') ." ". $usr->get('cognom'); include(PLANTILLES . "pla.artista_blog.php"); } } else { header("Location: ".URL); } } /******************************************************************************* LLISTAT ************************************************************/ public static function search() { $url_basic = constant("url_artistas"); $css = "artistas"; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_artistasde"); if ( !empty($_POST['nom']) ) { header("Location: ".URL."/search/cerca-".$_POST['nom']); exit(0); } $vecUsr = new Vector(); $numPag = 0; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $_SESSION['ordre'] = "RAND()"; $_SESSION['actiu'] = false; $numPag = 0; $url = "search/cerca-".$_GET['id']; $vecUsr = UsuariBD::cerca($_GET['id'], 50, $pag); $numArtistas = UsuariBD::contaCerca($_GET['id']); $numPag = ceil($numArtistas/50); } $titol = $numArtistas . " " . " Artistas de la tierra"; $_SESSION['actiu'] = false; $titol_cap = ""; include(PLANTILLES . "pla.llistat_artistes.php"); } /******************************************************************************* LLISTAT ************************************************************/ public static function listaartistas() { $tipus = constant("es_".url_actual); $_SESSION['tipus'] = $tipus; $url_basic = constant("url_".$tipus); $css = $tipus; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_".$tipus."de"); $conta = "conta".$tipus; $numArtistas = UsuariBD::$conta(); $titol = $numArtistas . " " . constant($tipus."_de") . " Artistas de la tierra"; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $_SESSION['ordre'] = "RAND()"; $_SESSION['actiu'] = false; $numPag = 0; $url = url_artistas ."-let-".$_GET['id']; $selectL = "select".$tipus."Letra"; $contaL = "conta".$tipus."Letra"; $vecUsr = UsuariBD::$selectL($_GET['id'], 50, $pag); $numPag = ceil(UsuariBD::$contaL($_GET['id'])/50); } else { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } else { if ( !$_SESSION['actiu'] ) { $_SESSION['ordre'] = "RAND()"; $_SESSION['actiu'] = false; } } $numPag = 0; $select = "select".$tipus; $vecUsr = UsuariBD::$select(50, $pag); $numPag = ceil($numArtistas/50); $url = constant("url_".$tipus); } $_SESSION['actiu'] = false; $titol_cap = constant($tipus."_de"); include(PLANTILLES . "pla.llistat_artistes.php"); } public static function artistasde() { $tipus = constant("es_".url_actual); $url_basic = constant("url_".$tipus); $css = $tipus; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_".$tipus."en"); if ( !empty($_GET['id']) ) { $zona = CountryBD::selectContinent($_GET['id']); $selectContinent = "select".$tipus."continent"; $contaContinent = "conta".$tipus."continent"; $numArtistas = UsuariBD::$contaContinent($_GET['id']); $titol = $numArtistas . " ".constant($tipus."_de") ." " .urldecode($zona['nom_es']); $titol_cap = $titol; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; if ( $zona != null ) { $url = constant("url_".$tipus."de") ."/". $_GET['id'] ."-" . $zona['nom_es']; $vecUsr = UsuariBD::$selectContinent($_GET['id'],50,$pag); $select = "selectPaisosContinent".$tipus; $vecZon = CountryBD::$select($_GET['id']); $vecPais = CountryBD::selectPaisos($_GET['id'],10,0); $continent = $_GET['id']+0; $numPag = ceil($numArtistas/50); } } else { $select = "select".$tipus; $vecUsr = UsuariBD::$select(); $numPag = 0; $url = constant("url_".$tipus."de"); } $_SESSION['actiu'] = false; include(PLANTILLES . "pla.llistat_artistes.php"); } public static function artistasen() { $tipus = constant("es_".url_actual); $url_basic = constant("url_".$tipus); $css = $tipus; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_mas". $tipus); if ( !empty($_GET['id']) ) { $zona = CountryBD::selectPais($_GET['id']); $contaPais = "conta".$tipus."pais"; $numArtistas = UsuariBD::$contaPais($_GET['id']); $titol = $numArtistas . " ".constant($tipus."_de")." " . urldecode($zona['nom']); $titol_cap = $titol; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; if ( $zona != null ) { $url = constant("url_".$tipus."en") ."/". $_GET['id'] ."-" . $zona['nom']; $selectPais = "select".$tipus."Pais"; $vecUsr = UsuariBD::$selectPais($_GET['id'],50,$pag); //$continent = $zona['sub']+0; $vecReg = CountryBD::selectRegions($_GET['id'],10,0); $select = "selectRegionsPais".$tipus; $vecZon = CountryBD::$select($_GET['id']); $pais = $zona; $numPag = ceil($numArtistas/50); } } else { header("Location: ".URL."/".url_artistas); } $_SESSION['actiu'] = false; include(PLANTILLES . "pla.llistat_artistes.php"); } public static function masartistas() { $tipus = constant("es_".url_actual); $url_basic = constant("url_".$tipus); $css = $tipus; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_".$tipus."locales"); if ( !empty($_GET['id']) ) { $zona = CountryBD::selectRegio($_GET['id']); $contaRegio = "conta".$tipus."Regio"; $numArtistas = UsuariBD::$contaRegio($_GET['id']); $titol = $numArtistas . " ".artistas_de." " .urldecode($zona['nom']); if ( $_SESSION['user']->isIdentificat() && $_SESSION['user']->isAdmin() ) { $titol = $titol. " numreg ".$zona['id']; } $titol_cap = $titol; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; if ( $zona != null ) { $url = constant("url_mas".$tipus) ."/". $_GET['id'] ."-" . $zona['nom']; $selectRegio = "select". $tipus. "Regio"; $vecUsr = UsuariBD::$selectRegio($_GET['id'],50,$pag); $pais = CountryBD::selectPais($zona['sub']); $vecReg = CountryBD::selectRegions($pais['id'],10,0); $numPag = ceil($numArtistas/50); $vecZon = CountryBD::selectLocalitatRe($_GET['id']); } } else { header("Location: ".URL."/".url_artistas); } $_SESSION['actiu'] = false; include(PLANTILLES . "pla.llistat_artistes.php"); } public static function active() { if ( !empty($_GET['id']) && !empty($_GET['pag']) ) { $_SESSION['user'] = UsuariBD::selectUsuariValidar($_GET['pag'], $_GET['id']); UsuariBD::updateEstat($_GET['pag'],$_GET['id']); if ( $_SESSION['user'] == null ) { header("Location: ".URL."/login.html"); } else { MensajeBD::nodelUser($_GET['id'], $_GET['pag']); Control::mailActivacio($_SESSION['user']); header("Location: ".$_SESSION['user']->getUrl()); } } } public static function artistaslocales() { $tipus = constant("es_".url_actual); $url_basic = constant("url_".$tipus); $css = $tipus; $vecZon = new Vector(); $vecPais = new Vector(); $url_sub = constant("url_".$tipus."locales"); if ( !empty($_GET['id']) ) { $zona = CountryBD::selectLocalitat($_GET['id']); $contaCiutat = "conta".$tipus."Ciutat"; $numArtistas = UsuariBD::$contaCiutat($_GET['id']); $titol = $numArtistas . " ".constant($tipus."_de")." " .str_replace("_", " ", urldecode($zona['nom'])); $titol_cap = $titol; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; if ( $zona != null ) { $url = constant($tipus."locales") ."/". $_GET['id'] ."-" . $zona['nom']; $selectCiutat = "select".$tipus."Ciutat"; $vecUsr = UsuariBD::$selectCiutat($_GET['id'],50,$pag); $pais = CountryBD::selectPais($zona['sub']); $vecReg = CountryBD::selectRegions($pais['id'],10,0); $numPag = ceil($numArtistas/50); $vecZon = CountryBD::selectRegions($zona['sub'],1000,0); } } else { header("Location: ".URL."/".url_artistas); } $_SESSION['actiu'] = false; include(PLANTILLES . "pla.llistat_artistes.php"); } // -------------------------------------------------- llistat de criticas public static function edita() { $_SESSION['edita'] = true; $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } public static function redirect() { if ( !empty($_POST['web']) ) { if ( $_SESSION['user']->isIdentificat() ) { $usr = UsuariBD::select($_SESSION['user']->get('id')); $url = "http://".$_POST['web']; include(PLANTILLES."pla.pont.php"); } else { header("Location: http://".$_POST['web']); } } else { header("Location: ".URL); } } public static function orden() { if ( !empty($_GET['id']) ) { $ordre = $_GET['id']+0; if ( $ordre == 1 ) { $_SESSION['ordre'] = "comentarios"; $_SESSION['actiu'] = true; } if ( $ordre == 2 ) { $_SESSION['ordre'] = "puntos"; $_SESSION['actiu'] = true; } if ( $ordre == 3 ) { $_SESSION['ordre'] = "obras"; $_SESSION['actiu'] = true; } if ( $ordre == 4 ) { $_SESSION['ordre'] = "blogs"; $_SESSION['actiu'] = true; } if ( $ordre == 5 ) { $_SESSION['ordre'] = "data"; $_SESSION['actiu'] = true; } $urls = explode("-pag", $_SERVER['HTTP_REFERER']); $urls = explode(".html", $urls[0]); header("Location: ". $urls[0]. ".html"); } } public static function recomendar() { if ( !empty($_GET['id']) && $_SESSION['user']->isIdentificat() ) { $u = UsuariBD::select($_GET['id']); if ( $u != null ) { if ( $_SESSION['user']->get('id') != $_GET['id'] && UsuariBD::recomienda($_SESSION['user']->get('id'), $_GET['id']) == 0 ) { UsuariBD::addRecomana($_SESSION['user']->get('id'), $_GET['id']); Control::mailRecomendado($u, $_SESSION['user']); } } $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } } public static function delrecomendar() { if ( !empty($_GET['id']) && $_SESSION['user']->isIdentificat() ) { $u = UsuariBD::select($_GET['id']); if ( $u != null ) { if ( $_SESSION['user']->get('id') != $_GET['id'] && UsuariBD::recomienda($_SESSION['user']->get('id'), $_GET['id']) > 0 ) { UsuariBD::delRecomana($_SESSION['user']->get('id'), $_GET['id']); } } $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } } public static function paisos() { $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $zona = CountryBD::selectContinent($_GET['id']); if ( $zona != null ) { $vecPais = CountryBD::selectPaisos($_GET['id'],10,$pag); $continent = $_GET['id']+0; } $pagPais = $pag; } else { header("Location: ".URL."/".url_artistas); } header('Content-Type: text/html; charset=ISO-8859-1'); include(PLANTILLES . "pla.llistat_paisos.php"); } // paginació de les regions public static function regions() { $tipus = constant("es_".url_actual); $vecPais = new Vector(); if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $zona = CountryBD::selectPais($_GET['id']); if ( $zona != null ) { $vecReg = CountryBD::selectRegions($_GET['id'],10,$pag); $pais = $zona; } $pagReg = $pag; } else { header("Location: ".URL."/".url_artistas); } include(PLANTILLES . "pla.llistat_regions.php"); } /******************************************************************************************* OBRAS **********************************************************/ public static function obrasdia() { $vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $pag = 0; $titol = exposicion_dia; $txt = ""; $men = 3; $url = url_obresdia; if ( !empty($_POST['nom']) ) { header("Location: ".URL."/".url_obres."/cerca-".$_POST['nom']); exit(0); } if ( !empty($_GET['id']) ) { $txt = $_GET['id']; $url = url_obres ."/cerca-".$txt; $men = 0; } if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecPar = ObraBD::selectParaules(40); $vecObres = ObraBD::selectDia(20, $pag); $vecTopART = $vecObres; $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } $numObres = ObraBD::contaDia(); $numPag = ceil($numObres/20); $titol_cap = obras_recientes; $setAct = ObraBD::selectSetUltima(); include(PLANTILLES . "pla.llistat_dia.php"); } public static function obrassemana() { /*$vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $pag = 0; $setant = 0; $setpos = 0; $titol = exposicion_semana; $txt = ""; $men = 1; $url = url_obresdia; if ( !empty($_POST['nom']) ) { header("Location: ".URL."/".url_obres."/cerca-".$_POST['nom']); exit(0); } if ( !empty($_GET['id']) ) { $txt = $_GET['id']; $url = url_obres ."/cerca-".$txt; $men = 0; } if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $vecPar = ObraBD::selectParaules(40); $vecObres = ObraBD::selectSet($pag); $setAnt = ObraBD::selectSetAnt($pag); $setPos = ObraBD::selectSetPos($pag); $numObres = ObraBD::contaDia(); $numPag = 0; $setAct = ObraBD::selectSetUltima(); $titol_cap = obras_recientes; include(PLANTILLES . "pla.llistat_dia.php"); */ if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".URL."/exposemana.html"); exit(0); } else { $_SESSION['alert'] = no_login; } } $pag = 0; $setant = 0; $setpos = 0; $titol = exposicion_semana; $txt = ""; $men = 1; $url = url_obresdia; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } if ( !empty($_GET['id']) ) { UsuariBD::updateVisita($_GET['id']); } if ( !empty($_POST['descripcio']) && $_SESSION['user']->isAdmin() ) { $var1= Dades::getValue($_POST["descripcio"],"text"); ObraBD::updateExpo($pag, $var1); header("Location: ".URL."/".url_obresset."-pag-".$setAct.".html"); } // Evitem warnings: només comparem si totes les variables existeixen if (isset($mes, $ano, $mes_act, $ano_act) && $mes == $mes_act && $ano == $ano_act) { $diaa = 0; if (date("w") == 1) { $diaa = 1; } ObraBD::updateGaleriaStat($diaa, 1, $pag); } else { ObraBD::updateGaleriaStat(0, 0, $pag); } if ( !empty($_POST['comentario']) && $_SESSION['user']->isIdentificat() ) { $com = htmlentities($_POST['comentario'], ENT_QUOTES); ComentariBD::insertGaleria($_SESSION['user']->get('id'),$pag, $com); $_SESSION['alert'] = "
".comentario_realizado_correcto."
"; } $vecObres = ObraBD::selectSet($pag); $vecTopART = $vecObres; $gal_mes = ObraBD::selectGaleriaStat($pag); $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } $setAnt = ObraBD::selectSetAnt($pag); $setPos = ObraBD::selectSetPos($pag); $numObres = ObraBD::contaDia(); $numPag = 0; $setAct = ObraBD::selectSetUltima(); $titol_cap = obras_recientes; $vecCom = ComentariBD::selectGaleria($pag); include(PLANTILLES . "pla.exposemana.php"); } public static function obras() { $vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $pag = 0; $titol = obras_recientes; $txt = ""; $men = 1; $url = url_obres; if ( !empty($_POST['nom']) ) { header("Location: ".URL."/".url_obres."/cerca-".$_POST['nom']); exit(0); } if ( !empty($_GET['id']) ) { $txt = $_GET['id']; $url = url_obres ."/cerca-".$txt; $men = 0; } if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecPar = ObraBD::selectParaules(40); $vecObres = ObraBD::selectCerca($txt, 20, $pag); $numObres = ObraBD::contaCerca($txt); $numPag = ceil($numObres/20); $titol_cap = obras_recientes; include(PLANTILLES . "pla.llistat_gran_obres.php"); } public static function obrascomentadas() { $men = 2; $vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $pag = 0; $titol = obras_mas_comentadas; $titol_cap = $titol; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecPar = ObraBD::selectParaules(40); $vecObres = ObraBD::selectObres("comentarios", 20, $pag); $numObres = ObraBD::contaObres(); $numPag = ceil($numObres/20); $url = url_obrascomentadas; include(PLANTILLES . "pla.llistat_gran_obres.php"); } public static function obrasvistas() { $men = 3; $vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $pag = 0; $titol = obras_mas_vistas; $titol_cap = $titol; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } $numPag = 0; $vecPar = ObraBD::selectParaules(40); $vecObres = ObraBD::selectObres("puntos", 20, $pag); $numObres = ObraBD::contaObres(); $numPag = ceil($numObres/20); $url = url_obrasvistas; include(PLANTILLES . "pla.llistat_gran_obres.php"); } public static function categoria() { $vecPais = new Vector(); $vecMenu = MenuBD::selectCategoria(); $categoria = true; $url_sub = url_categoria; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $nomcat = urlencode($_GET['id']); $cat = TecnicaBD::selectCategoria($nomcat); if ( !empty($_POST['definicio']) ) { TecnicaBD::updateCategoria($_GET['id'], $_POST['definicio']); header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } if ( $cat != null ) { $numObres = ObraBD::contaCategoria($cat['id']); $vecObres = ObraBD::selectCategoria($cat['id'],15,$pag); $numPag = ceil($numObres/15); $url = $url_sub . "/" . $cat['id'] . "-" . $cat['nom_'.LANG]; $titol = urldecode($cat['nom_'.LANG]) . " " . $numObres . " " . obras; $titol_cap = art_i_artistes . " " . urldecode($cat['nom_'.LANG]); } else { // header("Location: ".URL); exit(0); } } else { $n = rand(1, $vecMenu->total()); $cat = $vecMenu->is($n-1); $_SESSION['ordre'] = "RAND()"; header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } include(PLANTILLES . "pla.listobres.php"); } public static function estilo() { $vecPais = new Vector(); $vecMenu = MenuBD::selectEstilo(); $estilo = true; $url_sub = url_estilo; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $cat = TecnicaBD::selectEstilo($_GET['id']); if ( !empty($_POST['definicio']) ) { TecnicaBD::updateEstilo($_GET['id'], $_POST['definicio']); header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } $titol_cap = $cat['nom_'.LANG] . " ". art_i_artistes; $numObres = ObraBD::contaEstilo($_GET['id']); $vecObres = ObraBD::selectEstilo($_GET['id'],15,$pag); $numPag = ceil($numObres/15); $url = $url_sub . "/" . $cat['id'] . "-" . $cat['nom_'.LANG]; $titol = $cat['nom_'.LANG] . " " . $numObres . " " . obras; } else { $n = rand(1, $vecMenu->total()); $cat = $vecMenu->is($n-1); $_SESSION['ordre'] = "RAND()"; header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } include(PLANTILLES . "pla.listobres.php"); } public static function tecnica() { $vecPais = new Vector(); $vecMenu = MenuBD::selectTecnica(); $tecnica = true; $url_sub = url_tecnica; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $cat = TecnicaBD::selectTecnica($_GET['id']); if ( !empty($_POST['definicio']) ) { TecnicaBD::updateTecnica($_GET['id'], $_POST['definicio']); header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } $numObres = ObraBD::contaTecnica($_GET['id']); $vecObres = ObraBD::selectTecnica($_GET['id'],15,$pag); $numPag = ceil($numObres/15); $url = $url_sub . "/" . $cat['id'] . "-" . $cat['nom_'.LANG]; $titol_cap = art_i_artistes . " " . $cat['nom_'.LANG]; $titol = $cat['nom_'.LANG] . " " . $numObres . " " . obras; } else { $n = rand(1, $vecMenu->total()); $cat = $vecMenu->is($n-1); $_SESSION['ordre'] = "RAND()"; header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } include(PLANTILLES . "pla.listobres.php"); } public static function material() { $vecPais = new Vector(); $vecMenu = MenuBD::selectMaterial(); $material = true; $url_sub = url_material; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $cat = TecnicaBD::selectMaterial($_GET['id']); if ( !empty($_POST['definicio']) ) { TecnicaBD::updateMaterial($_GET['id'], $_POST['definicio']); header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } $numObres = ObraBD::contaMaterial($_GET['id']); $vecObres = ObraBD::selectMaterial($_GET['id'],15,$pag); $numPag = ceil($numObres/15); $url = $url_sub . "/" . $cat['id'] . "-" . $cat['nom_'.LANG]; $titol_cap = art_i_artistes . " " . $cat['nom_'.LANG]; $titol = $cat['nom_'.LANG] . " " . $numObres . " " . obras; } else { $n = rand(1, $vecMenu->total()); $cat = $vecMenu->is($n-1); $_SESSION['ordre'] = "RAND()"; header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } include(PLANTILLES . "pla.listobres.php"); } public static function soporte() { $vecPais = new Vector(); $vecMenu = MenuBD::selectSoporte(); $soporte = true; $url_sub = url_suport; if ( !empty($_GET['id']) ) { $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']+0; } $cat = TecnicaBD::selectSoporte($_GET['id']); if ( !empty($_POST['definicio']) ) { TecnicaBD::updateSoporte($_GET['id'], $_POST['definicio']); header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } $numObres = ObraBD::contaSoporte($_GET['id']); $vecObres = ObraBD::selectSoporte($_GET['id'],15,$pag); $numPag = ceil($numObres/15); $url = $url_sub . "/" . $cat['id'] . "-" . $cat['nom_'.LANG]; $titol_cap = art_i_artistes . " " . $cat['nom_'.LANG]; $titol = $cat['nom'] . " " . $numObres . " " . obras; } else { $n = rand(1, $vecMenu->total()); $cat = $vecMenu->is($n-1); $_SESSION['ordre'] = "RAND()"; header("Location: ".URL."/".$url_sub."/".$cat['id']."-".$cat['nom_'.LANG] .".html"); } include(PLANTILLES . "pla.listobres.php"); } public static function obra() { $vecPais = new Vector(); if ( !($_SESSION['user']->isIdentificat()) ) { $_SESSION['alert'] = "
".debes_registrar." ".registrado.", ".identificado."
"; } if ( !empty($_GET['id']) ) { $class = "degradatpetit"; $critica = 0; $obra = ObraBD::select($_GET['id']); $usr = $obra->getArtista(); if ( $_SESSION['user']->permis($usr) ) { $_SESSION['alert'] = "
".no_comentar_tu_mateix."
"; } if ( ComentariBD::contaObraUsuari($_GET['id'], $_SESSION['user']->get('id')) > 0 ) { $_SESSION['alert'] = "
".ja_comentat."
"; } if ( $obra->get('pub') == 0 ) { $_SESSION['alert'] = "
".pendent_aprovacio."
"; } // Sistema de recomenacions if ( $_SESSION['user']->isIdentificat() ) $recomendada = ObraBD::isRecomendada( $_SESSION['user']->get('id'), $obra->get('id')); if ( !empty($_POST['fav']) && $_SESSION['user']->isIdentificat() && !$recomendada ) { if ( $usr->get('id') != $_SESSION['user']->get('id') ) { ObraBD::addRecomendada($_SESSION['user']->get('id'), $obra->get('id'), 0); //$_SESSION['alert'] = "
".obra_recomendada."
"; Control::mailObraRecomendada($usr, $obra, $_SESSION['user']); header("Location: ".$obra->getUrl()); } exit(0); } if ( $_SESSION['user']->isIdentificat() ) { if ( !empty($_POST['delete']) && $_SESSION['user']->get('id') == $usr->get('id') ) { // Eliminar un comentari $com = ComentariBD::select($_POST['del']); $com->giraPub(); $com = ComentariBD::updatePub($com); header("Location: ". $obra->getUrl()); exit(0); } } // Enviament de comentaris o critiques if ( !empty($_POST['enviar']) && $_SESSION['user']->isIdentificat() ) { if ( $_POST['critica'] == 0 || ($_POST['critica'] == 1 && strlen($_POST['comentario']) > 400) ) { $com = htmlentities($_POST['comentario'], ENT_QUOTES); $pub = 1; if ( $obra->get('ban') ) $pub = 0; if ( $obra->isVermell() ) $pub = 0; ComentariBD::insertObra($usr->get('id'), $_SESSION['user']->get('id'), $obra->get('id'), $com, $_POST['critica']+0, $pub); Control::mailComentario($usr, $obra); $_SESSION['alert'] = "
".comentario_realizado_correcto."
"; header("Location: ".$obra->getUrl()); exit(0); } else $avis = avis_caracters ."
"; if ( $_POST['critica'] == 1 ) { $class = "degradatpetitcriticos"; $critica = 1; } } $usr_dreta = $usr; $vecRec = UsuariBD::selectRecomienda($usr->get('id'),4,0); $vecLeRec = UsuariBD::selectLeRecomiendan($usr->get('id'),4,0); $vecCom = ComentariBD::selectObraMax($_GET['id'],6); if ( $vecCom->total() == 0 ) { $vecR = ObraBD::selectRecomendaciones($obra->get('id')); $vecReco = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = UsuariBD::select($idu); $vecReco->add($u); } } ObraBD::updateComentarios($obra, $vecCom->total()); $vecAleatori = ObraBD::selectRandomArtista($usr->get("id"), 3); if ( !IpBD::existeixObra($_SERVER['REMOTE_ADDR'], $obra->get('id')) ) { IpBD::insert($_SERVER['REMOTE_ADDR'],$obra->get('id'),0,0); ObraBD::updatePunto($obra); IpBD::neteja(); } $titol_cap = obra_art . " " . $obra->get('nom_'.LANG); $obra_ant = ObraBD::selectAntUsuari($usr->get("id"), $obra->get('dat_ins')); $obra_seg = ObraBD::selectSegUsuari($usr->get("id"), $obra->get('dat_ins')); if ( $obra->get('xxx') ) $noanunci = true; include(PLANTILLES . "pla.obra.php"); } else { header("Location: ".URL); } } public static function obracontact() { $vecPais = new Vector(); if ( !($_SESSION['user']->isIdentificat()) ) { //$_SESSION['alert'] = "
".debes_registrar." ".registrado.", ".identificado."
"; } if ( !empty($_GET['id']) ) { $class = "degradatpetit"; $critica = 0; $obra = ObraBD::select($_GET['id']); $usr = $obra->getArtista(); if ( !$_SESSION['user']->isIdentificat() ) { if ( !empty($_POST['msg']) ) { if ( ( md5($_POST['code']) == $_SESSION['key'] ) && (!empty($_POST['code'])) ) { $t = $_POST; if ( $t['nom'] != "" && $t['cognom'] != "" && $t['direccion'] != "" && $t['telefono'] != "" && $t['pais'] != "" && $t['poblacion'] != "" ) { if ( Dades::email($t['email']) ) { if ( UsuariBD::comprovarMail($t['email']) ) { $t['artista'] = 0; $t['entidad'] = 0; $t['coleccionista'] = 0; $t['critico'] = 0; $t['usuari'] = UsuariBD::crearUsuari(Dades::traduccio($t['nom'])); $t['pwd1'] = "a" . Dades::aleatori(5) . "w"; $t['random'] = Dades::aleatori(7); $mis = $t['nom'] ."
". $t['cognom']."
". $t['poblacion'] ." (".$t['pais'].")
". $t['direccion']."
telf:". $t['telefono']."
"; $mis .= Dades::bo($t['msg']); $i = UsuariBD::insert($t); $t['id'] = $i; Control::mailAlta($t); //header("Location: ".URL); $_SESSION['alert'] = alta_completa_revisar_mail_contactar; //$guardat = tue; $usr_send = UsuariBD::select($i); MensajeBD::insertDel($t['random'], $usr->get('id'), $usr_send->get('id'), $mis); } else { $_SESSION['alert'] = mail_repetit; } } else $_SESSION['alert'] = mail_incorrecte; } else $_SESSION['alert'] = falten_dades; } else { $_SESSION['alert'] = error; } } } else { if ( !empty($_POST['msg']) ) { // salvar el missatge $mis = Dades::bo($_POST['msg']); if ( MensajeBD::contaAvui($_SESSION['user']->get('id')) < 3 ) { MensajeBD::insert($usr->get('id'), $_SESSION['user']->get('id'), $mis, $_SESSION['user']->get('permis_mis')); if ( $_SESSION['user']->get('permis_mis') ) { Control::mailMensaje($usr); } $_SESSION['alert'] = '
'.mensaje_enviado.'
'; } else { $_SESSION['alert'] = '
'.demasiados_mesajes_hoy.'
'; } } } $titol_cap = obra_art . " " . $obra->get('nom_'.LANG); include(PLANTILLES . "pla.obracontact.php"); } else { header("Location: ".URL); } } public static function recomana() { $com = 0; if ( !empty($_GET['id']) ) { $obra = ObraBD::select($_GET['id']); $usr = $obra->getArtista(); $vecR = ObraBD::selectRecomendaciones($obra->get('id')); $vecReco = new Vector(); for ( $i=0; $i<$vecR->total(); $i++) { $idu = $vecR->is($i); $u = UsuariBD::select($idu); $vecReco->add($u); } } else { header("Location: ".URL."/".url_artistas); } header('Content-Type: text/html; charset=ISO-8859-1'); include(PLANTILLES . "pla.llistat_recomana.php"); } public static function comentaris() { $com = 1; if ( !empty($_GET['id']) ) { $obra = ObraBD::select($_GET['id']); $usr = $obra->getArtista(); $vecCom = ComentariBD::selectObra($_GET['id']); header('Content-Type: text/html; charset=ISO-8859-1'); include(PLANTILLES . "pla.llistat_recomana.php"); } else { header("Location: ".URL."/".url_artistas); exit(0); } } public static function mapa() { if ( !empty($_GET['id']) ) { $agenda = AgendaBD::select($_GET['id']); include(PLANTILLES . "pla.mapa.php"); } } public static function agenda() { $cap = 4; $vecPais = new Vector(); // SOLUCIÓ → Inicialització segura $numArtistas = 0; $titol = $numArtistas . " " . agenda_en; $titol_cap = $titol; $titol .= " ". nom_web; $pag = 0; $data = ""; if (!empty($_GET['id'])) { $any = substr($_GET['id'],0,4); $mes = substr($_GET['id'],4,2); $dia = substr($_GET['id'],6,2); $data = $any . "-" . $mes . "-" . $dia; $vecAgenda = AgendaBD::selectData($data); } else { $vecAgenda = AgendaBD::selectUltims(); } include(PLANTILLES . "pla.llistat_agenda.php"); $_SESSION['actiu'] = false; } public static function blogsdeartistas() { $cap = 5; $vecPais = new Vector(); // SOLUCIÓ: evitar warning Undefined variable if (!isset($numArtistas)) $numArtistas = 0; $titol = $numArtistas . " " . articulos_en; $titol_cap = $titol; $titol .= " ". nom_web; $pag = 0; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } else { if ( !$_SESSION['actiu'] ) { $_SESSION['ordre'] = "RAND()"; $_SESSION['actiu'] = false; } } $numArticles = BlogBD::contaTotBlogs(); $numPag = 0; $numBlogs = BlogBD::contaBlogs(); $vecBlog = BlogBD::selectBlogs(10, $pag); $numPag = ceil($numBlogs/10); $url = url_blogsdeartistas; if ( $_SESSION['ordre'] != "RAND()" ) include(PLANTILLES . "pla.llistat_articles_blogs.php"); else include(PLANTILLES . "pla.llistat_blogs.php"); $_SESSION['actiu'] = false; } public static function register() { $cap = 8; $recordar = false; $vecPais = CountryBD::selectAllPaisos(); $vecRegio = new Vector(); $guardat = false; $regio = $_POST['regio'] ?? 0; $pais = $_POST['pais'] ?? 0; if ($regio == 0 && $pais != 0) { $vecRegio = CountryBD::selectRegions($_POST['pais'],9999,0); } else { if ( !empty($_POST['usuari']) ) { $guardat=false; if ( true ) { $t = $_POST; $_SESSION['alert'] =""; if ( $t['acord'] ) { if ( $t['nom'] != "" && $t['cognom'] != "" && $t['pais'] != "" && $t['regio'] != "" && $t['pwd1'] != "" && $t['tipus'] != "" ) { if ( Dades::usuari($t['usuari']) ) { if ( Dades::email($t['email']) ) { if ( UsuariBD::comprovarMail($t['email']) ) { if ( $t['pwd1'] == $t['pwd2'] && Dades::comprovarPass($t['pwd1']) ) { if ( UsuariBD::comprovarUsuari($t['usuari']) ) { $t['artista'] = 0; $t['entidad'] = 0; $t['coleccionista'] = 0; $t['critico'] = 0; if ( $t['tipus'] == 1 ) $t['artista'] = 1; if ( $t['tipus'] == 3 ) $t['entidad'] = 1; if ( $t['tipus'] == 2 ) $t['critico'] = 1; if ( $t['tipus'] == 4 ) $t['coleccionista'] = 1; $t['random'] = Dades::aleatori(14); $i = UsuariBD::insert($t); $t['id'] = $i; Control::mailAlta($t); //header("Location: ".URL); $_SESSION['alert'] = alta_completa_revisar_mail; //$guardat = tue; } else { $_SESSION['alert'] = usuari_existeix; $_POST['pas'] = "usuari"; } } else { $_SESSION['alert'] .= no_coincideixen_password; $_POST['pas'] = "pwd"; } } else { $_SESSION['alert'] = mail_repetit; $_POST['pas'] = "mail"; } } else { $_SESSION['alert'] = mail_incorrecte; $_POST['pas'] = "mail"; } } else { $_SESSION['alert'] = usuari_incorrecte; $_POST['pas'] = "usuari"; } } else { $_SESSION['alert'] = falten_dades; $_POST['pas'] = "datos"; } } else { $_SESSION['alert'] = falten_condicions; $_POST['pas'] = "acord"; } } else { $_POST['pas'] = "code"; $_SESSION['alert'] = error . " " .falten_dades; } } $pais = $_POST['pais'] ?? 0; $vecRegio = CountryBD::selectRegions($pais, 9999, 0); } $titol_cap = registrate; include(PLANTILLES . "pla.register.php"); } public static function selectregio() { if ( !empty($_GET['id']) ) { $vecRegio = CountryBD::selectRegions($_GET['id'],9999,0); header('Content-Type: text/html; charset=ISO-8859-1'); include(PLANTILLES . "pla.selectregions.php"); } } public static function login() { $cap = 9; $recordar = false; if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".$_SESSION['user']->getUrl()."/".url_galeria.".html"); } else { $_SESSION['alert'] = no_login; include(PLANTILLES . "pla.login.php"); } } else { if (!empty($_POST['email'])) { $u = UsuariBD::selectMail($_POST['email']); // enviar mail al usuari if ( $u != null ) { Control::recordar($u); $_SESSION['alert'] = comprovar_mail; } else $_SESSION['alert'] = mail_incorrecte; } if ( !empty($_GET['pag']) ) { if ( $_GET['pag'] == 1 ) $recordar = true; else { session_destroy(); header("Location: ".URL."/login.html"); } } include(PLANTILLES . "pla.login.php"); } } public static function loginpanel() { $cap = 9; $recordar = false; if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; $desti = $_POST['desti']; $_SESSION['lang'] = $_POST['lang']; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".URL."/".$desti); } else { //include(PLANTILLES . "form.pont.php"); } } else { // // } } public static function llistatonline() { $vec = new Vector(); if ( $_SESSION['user']->isIdentificat() ) { $vec = UsuariBD::selectOnline(); } header('Content-Type: text/html; charset=UTF-8'); include(PLANTILLES . "xat.llistat_online.php"); } public static function llistatxat() { $vec = new Vector(); if ( $_SESSION['user']->isIdentificat() ) { XatBD::netejaXat(); $vec = XatBD::select($_SESSION['user']->get('data_log'),20); } header('Content-Type: text/html; charset=ISO-8859-1'); include(PLANTILLES . "xat.llistat_xat.php"); } public static function addcomentari() { if ( $_SESSION['user']->isIdentificat() ) { header('Content-Type: text/html; charset=ISO-8859-1'); if ( strip_tags($_POST['minixat']) != "" ) { $text = Dades::bo($_POST['minixat']); XatBD::insert($_SESSION['user']->get('id'), $text); echo "OK"; } } } public static function adminobra() { if ( $_SESSION['user']->isAdmin() ) { if ( !empty($_POST['obra']) ) { $obra = ObraBD::select($_POST['obra']); $usr = $obra->getArtista(); if ( !empty($_POST['galeriacol']) ) { ObraBD::updateGaleriaCol($obra->get('id'),$_POST['galeriacol']); } else { if( !empty($_POST["verd"]) ) { //$sql = "UPDATE obras SET pub='1', exposicio='1' ".$exp.", pub3=1 WHERE id='$id'"; ObraBD::updatePublic($obra->get('id'), 1); //echo $sql; //$res = mysql_query($sql, $delatierra) or die(mysql_error()); } elseif(!empty($_POST["vermell"])) { //$sql = "UPDATE obras SET pub='1', exposicio='0', pub3=1 ".$exp."WHERE id='$id'"; // echo $sql; //$res = mysql_query($sql, $delatierra) or die(mysql_error()); ObraBD::updatePublic($obra->get('id'),0); } elseif(!empty($_POST["ban"])) { //$sql = "UPDATE obras SET pub='1', exposicio='0', pub3=1 ".$exp."WHERE id='$id'"; // echo $sql; //$res = mysql_query($sql, $delatierra) or die(mysql_error()); $p = $obra->get('ban'); if ( $p ) $p = 0; else $p = 1; ObraBD::updateBan($obra->get('id'),$p); } elseif(!empty($_POST["setmana"])) { //$sql = "UPDATE obras SET pub='1', exposicio='0', pub3=1 ".$exp."WHERE id='$id'"; // echo $sql; //$res = mysql_query($sql, $delatierra) or die(mysql_error()); $p = $obra->get('setmana'); if ( $p>0 ) $p = 0; else $p = 1; ObraBD::updateSet($obra->get('id'),$p); } elseif(!empty($_POST["eliminar"])) { $n = ComentariBD::contaCriticaObra($obra->get('id')); if ( $n > 0 ) { $_SESSION['alert'] = no_eliminar_te_critica; } else { ObraBD::delete($obra->get('id')); ComentariBD::deleteAllObra($obra->get('id')); Control::deleteFoto($obra->get('id')); //$guardat = tre; $_SESSION['alert'] = ""; header("Location: ". $usr->getUrl()); exit(0); } } elseif(!empty($_POST['esX'])) { ObraBD::updateX($obra->get('id'),1); } elseif(!empty($_POST['noX'])) { ObraBD::updateX($obra->get('id'),0); } elseif(!empty($_POST['refer'])) { Control::refer("foto".$obra->get('id')); } } } // fi del while $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } else { header("Location: ".URL); } } public static function activacomen() { if ( $_SESSION['user']->isAdmin() ) { ObraBD::updateComen(); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } else { header("Location: ".URL); } } public static function updatedia() { if ( $_SESSION['user']->isAdmin() ) { ObraBD::updateDia($_POST['dia']); $urls = $_SERVER['HTTP_REFERER']; header("Location: ". $urls); } else { header("Location: ".URL); } } public static function politica() { $text = LANG."_politica.php"; include(PLANTILLES."pla.info.php"); } public static function error() { include(PLANTILLES."pla.error404.php"); } public static function condicions() { $text = LANG."_condicions.php"; include(PLANTILLES."pla.info.php"); } public static function hostingart() { //if ( $_SESSION['user']->isIdentificat() ) { include(PLANTILLES."pla.hostingart.php"); //} //else { // header("Location: ".URL); //} } public static function donate() { if ( !empty($_POST['opcio']) && $_POST['g-recaptcha-response'] ) { $url_tpvv='https://sis.redsys.es/sis/realizarPago'; $descServei = $_POST['descripcio']; $amount="0"; // el camp $order està més amunt. if ( $_POST['opcio'] == 1 ) { if ( !empty($_POST['preuTotal']) && is_numeric($_POST['preuTotal']) && ($_POST['preuTotal']+0 > 0) ) { $amount=$_POST['preuTotal']."00"; } else { $_SESSION['alert'] = preu_incorrecte; include(PLANTILLES."pla.donate.php"); exit(0); } } else { $amount=$_POST['opcio']."00"; } if ( Dades::email($_POST['mail']) ) $mail = $_POST['mail']; else $mail = ""; $nom = $_POST['nombre']; $cognoms = $_POST['apellidos']; $titular = $nom." ".$cognoms; $miObj = new RedsysAPI; // Valores de entrada $fuc="334693819"; $terminal="1"; $moneda="978"; $trans="0"; $url=URL."/rebredades.html"; $urlOK=URL."/correcte.html"; $urlKO=URL."/donate.html"; $id=time(); //$amount="145"; // Se Rellenan los campos $miObj->setParameter("DS_MERCHANT_AMOUNT",$amount); $miObj->setParameter("DS_MERCHANT_ORDER",strval($id)); $miObj->setParameter("DS_MERCHANT_MERCHANTCODE",$fuc); $miObj->setParameter("DS_MERCHANT_CURRENCY",$moneda); $miObj->setParameter("DS_MERCHANT_TRANSACTIONTYPE",$trans); $miObj->setParameter("DS_MERCHANT_TERMINAL",$terminal); $miObj->setParameter("DS_MERCHANT_MERCHANTURL",$url); $miObj->setParameter("DS_MERCHANT_URLOK",$urlOK); $miObj->setParameter("DS_MERCHANT_URLKO",$urlKO); $miObj->setParameter("DS_MERCHANT_PAYMETHODS","T"); //Datos de configuración $version="HMAC_SHA256_V1"; $kc = 'NCRi7SW3fRkTzfuZJ8lAS5I2rRA3WafT';//Clave recuperada de CANALES // Se generan los parámetros de la petición $request = ""; $params = $miObj->createMerchantParameters(); $signature = $miObj->createMerchantSignature($kc); $a['signatura'] = $id; $a['preu'] = $amount; $a['mail'] = $mail; $a['titular'] = $titular; $a['usuari'] = 0; $a['tipus'] = 0; PagamentBD::insert($a); include(PLANTILLES."pla.send2.php"); } else { include(PLANTILLES."pla.donate.php"); } } public static function topart() { if ( $_SESSION['user']->isIdentificat() ) { if ( !empty($_POST['opcio']) ) { require_once('config.php'); $amount = "0"; if ( $_POST['opcio'] == 1 ) $amount = "1000"; if ( $_POST['opcio'] == 2 ) $amount = "2000"; if ( $_POST['opcio'] == 3 ) $amount = "3000"; $a['tipus'] = $_POST['opcio']; $a['signatura'] = time(); $_SESSION['signatura'] = $a['signatura']; $a['preu'] = $amount; $_SESSION['amount'] = $amount; $a['mail'] = $_SESSION['user']->get('email'); $a['titular'] = $_SESSION['user']->get('nom') ." ".$_SESSION['user']->get('cognom'); $a['usuari'] = $_SESSION['user']->get('id'); PagamentBD::insert($a); include(PLANTILLES."pla.send2.php"); } else { include(PLANTILLES."pla.topart.php"); } } else { if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".URL."/topart.html"); exit(0); } else { $_SESSION['alert'] = no_login; } } include(PLANTILLES . "pla.topart.php"); } } public static function galeriatopart() { include(PLANTILLES . "pla.galeria-topart.php"); } public static function exposemana() { if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".URL."/exposemana.html"); exit(0); } else { $_SESSION['alert'] = no_login; } } $pag = 0; $setant = 0; $setpos = 0; $titol = exposicion_semana; $txt = ""; $men = 1; $url = url_obresdia; if ( !empty($_GET['pag']) ) { $pag = $_GET['pag']; } if ( !empty($_POST['descripcio']) && $_SESSION['user']->isAdmin() ) { $var1= Dades::getValue($_POST["descripcio"],"text"); ObraBD::updateExpo($pag, $var1); header("Location: ".URL."/".url_obresset."-pag-".$setAct.".html"); } if ( $mes == $mes_act && $ano == $ano_act ) { $diaa = 0; if ( date("w") == 1 ) $diaa = 1; ObraBD::updateGaleriaStat($diaa, 1, $pag); } else { ObraBD::updateGaleriaStat(0,0, $pag); } if ( !empty($_POST['comentario']) && $_SESSION['user']->isIdentificat() ) { $com = htmlentities($_POST['comentario'], ENT_QUOTES); ComentariBD::insertGaleria($_SESSION['user']->get('id'),$pag, $com); $_SESSION['alert'] = "
".comentario_realizado_correcto."
"; } $vecObres = ObraBD::selectSet($pag); $vecTopART = $vecObres; $gal_mes = ObraBD::selectGaleriaStat($pag); $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } $setAnt = ObraBD::selectSetAnt($pag); $setPos = ObraBD::selectSetPos($pag); $numObres = ObraBD::contaDia(); $numPag = 0; $setAct = ObraBD::selectSetUltima(); $titol_cap = obras_recientes; $vecCom = ComentariBD::selectGaleria($pag); include(PLANTILLES . "pla.exposemana.php"); } public static function coffeechatart() { if ( !empty($_POST['usuari']) && !empty($_POST['pwd']) ) { $nom = str_replace("'", " ", $_POST['usuari']); $pwd = str_replace("'", " ", $_POST['pwd']); if ( UsuariBD::comprovarLogin($nom, $pwd) ) { $_SESSION['user'] = UsuariBD::selectUsuari($nom); $_SESSION['alert'] = ""; //UsuariBD::salvarSessio($_SESSION['user']); header("Location: ".URL."/coffeechatart.html"); exit(0); } else { $_SESSION['alert'] = no_login; } } $ano = date("Y"); // Año actual $mes = date("m")+0; $mes_act = $mes; $ano_act = $ano; $actual = $mes . $ano; $noanunci = true; $dia = date("j"); if ( !empty($_GET['id']) ) { $ano = substr($_GET['id'], -4); $mes = substr($_GET['id'], 0, -4); } if ( !empty($_GET['pag']) ) { UsuariBD::updateVisita($_GET['pag']); } if ( $ano > $ano_act || ( $ano == $ano_act && $mes > $mes_act ) || $mes > 12 || $mes < 1 || $ano < 2000 ) { if ( !$_SESSION['user']->isAdmin() ) { header("Location: ".URL."/coffeechatart.html"); exit(0); } } $id = $mes.$ano; if ( !empty($_POST['descripcio']) && $_SESSION['user']->isAdmin() ) { $var1= Dades::getValue($_POST["descripcio"],"text"); ObraBD::updateExpo($id, $var1); header("Location: ".URL."/coffeechatart/$id-colectiva.html"); } if ( $mes == $mes_act && $ano == $ano_act ) { $diaa = 0; if ( date("j") == 1 || date("j") == 2 || date("j") == 3 ) $diaa = 1; ObraBD::updateGaleriaStat($diaa, 1, $id); if ( !empty($_POST['comentario']) && $_SESSION['user']->isIdentificat() ) { $com = htmlentities($_POST['comentario'], ENT_QUOTES); ComentariBD::insertGaleria($_SESSION['user']->get('id'),$id, $com); $_SESSION['alert'] = "
".comentario_realizado_correcto."
"; } } else { ObraBD::updateGaleriaStat(0,0, $id); } if ( $mes == 1 ) { $mesa = 12; $anoa = $ano-1; } else { $mesa = $mes-1; $anoa = $ano; } $anterior = $mesa . $anoa; if ( $mes == 12 ) { $mesa = 1; $anoa = $ano+1; } else { $mesa = $mes+1; $anoa = $ano; } $seguent = $mesa . $anoa; $n = $mes . $ano; $gal_mes = ObraBD::selectGaleriaStat($n); $vecTopART = ObraBD::selectGaleriaCol($n); if ( $vecTopART->total() == 0 ) { header("Location: ".URL."/coffeechatart.html"); exit(0); } else { $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } $vecCom = ComentariBD::selectGaleria($id); $rweb = ObraBD::getExpo($id); $setAct = ObraBD::selectSetUltima(); include(PLANTILLES . "pla.expodelmes.php"); } } public static function setmanapdf() { $ano = date("Y"); // Año actual $mes = date("n"); $setAct = ObraBD::selectSetUltima(); $setExpo = ObraBD::getExpo($setAct); $vecTopART = ObraBD::selectSet($setAct); $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); Control::cuadrat("foto".$obra->get('id')); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } include(PLANTILLES . "pla.setpdf.php"); } public static function versiopdf() { $ano = date("Y"); // Año actual $mes = date("n"); $dia = date("j"); if ( !empty($_GET['id']) ) { $ano_act = $ano; $mes_act = $mes; $ano = substr($_GET['id'], -4); $mes = substr($_GET['id'], 0, -4); if ( $ano > $ano_act || ( $ano == $ano_act && $mes > $mes_act ) || $mes > 12 || $mes < 1 || $ano < 2000 ) { if ( !$_SESSION['user']->isAdmin() ) { header("Location: ".URL."/versiopdf.html"); exit(0); } } } else { if ( $mes == 12 && $dia >= 20) $ano = $ano+1; if ( $dia >= 20 ) $mes = $mes+1; if ( $mes > 12 ) $mes = 1; } $mes = $mes+0; $n = $mes . $ano; $setExpo = ObraBD::getExpo($n); $vecTopART = ObraBD::selectGaleriaCol($n); $n = 0; $or = ""; for ( $i=0; $i<$vecTopART->total(); $i++) { $obra = $vecTopART->is($i); if ( $n == 0 ) { $or = "id=". $obra->get('id_usuari'); $n++; } else $or = $or. " OR id=". $obra->get('id_usuari'); Control::cuadrat("foto".$obra->get('id')); } $vecUsr = new Vector(); if ( $n > 0 ) { $vecUsr = UsuariBD::selectOr($or); } include(PLANTILLES . "pla.pdf.php"); } public static function chargetop() { require_once('config.php'); $token = $_POST['stripeToken']; $email = $_POST['stripeEmail']; $customer = \Stripe\Customer::create([ 'email' => $email, 'source' => $token, ]); $charge = \Stripe\Charge::create([ 'customer' => $customer->id, 'amount' => $_SESSION['amount'], 'currency' => 'eur', ]); $p = PagamentBD::selectFirma($_SESSION['signatura']); if ( $p != null ) { if ( $p->get('tipus') >= 1 ) { UsuariBD::updateTop($p->get('usuari'), $p->get('tipus')); $us = UsuariBD::select($p->get('usuari')); Control::mailTopART($us); } else { $preu = $p->get('preu')/100; Control::mailDonacio($preu); } PagamentBD::update($order); } } public static function rebredades() { $miObj = new RedsysAPI; $version = $_POST["Ds_SignatureVersion"]; $datos = $_POST["Ds_MerchantParameters"]; $firma_seva = $_POST["Ds_Signature"]; $decodec = $miObj->decodeMerchantParameters($datos); //$kc = 'sq7HjrUOBfKmC576ILgskD5srU870gJ7'; //Clave recuperada de CANALES $kc = 'NCRi7SW3fRkTzfuZJ8lAS5I2rRA3WafT';//Clave recuperada de CANALES $firma_meva = $miObj->createMerchantSignatureNotif($kc,$datos); $codi_resposta= $miObj->getParameter("Ds_Response"); $order= $miObj->getParameter("Ds_Order"); if($firma_meva == $firma_seva ) { if($codi_resposta >= '0000' && $codi_resposta <= '0099') { $p = PagamentBD::selectFirma($order); if ( $p != null ) { if ( $p->get('tipus') >= 1 ) { UsuariBD::updateTop($p->get('usuari'), $p->get('tipus')); $us = UsuariBD::select($p->get('usuari')); Control::mailTopART($us); } else { $preu = $p->get('preu')/100; Control::mailDonacio($preu); } PagamentBD::update($order); } } } } public static function correcte() { include(PLANTILLES . "pla.pagamentok.php"); } public static function mali889823vamlsdijlgirt578476jdfkgha032jhsdfbvsdf() { if ( $_SESSION['user']->isIdentificat() ) { UsuariBD::updateTop($_SESSION['user']->get('id'), 1); header("Location: ".URL."/correcte.html"); } } } ?>