id_etiqueta = intval( $id_etiqueta ); return $this->llegeix(); } } function Etiqueta( $id_etiqueta = false ) { $this->__construct( $id_etiqueta ); } function llegeix( $key = 'id' ) { global $db; switch ( $key ) { case 'id': default: $cond = "id_etiqueta = ". intval( $this->id_etiqueta ); break; case 'uri': $cond = "uri = '". $db->escape( $this->uri ) ."'"; break; } if( $element = $db->get_row( "SELECT id_etiqueta, etiqueta, id_article, UNIX_TIMESTAMP( data ) AS data FROM etiquetes WHERE $cond" ) ) { $this->id_etiqueta = $element->id_etiqueta; $this->id_article = $element->id_article; $this->etiqueta = $element->etiqueta; $this->data = $element->data; $this->llegit = true; return true; } $this->llegit = false; return false; } function desa() { global $db; $etiqueta = $db->escape( $this->etiqueta ); $data = $this->data; //if( empty( $id_categoria ) ) array_push( $this->error, "Categoria incorrecte" ); if( empty( $etiqueta ) ) array_push( $this->error, "Títol incorrecte" ); if( count( $this->error ) > 0 ) return false; if( $this->id_etiqueta == 0 ) { $db->query( "INSERT INTO etiquetes ( etiqueta, data ) VALUES ( '$etiqueta', FROM_UNIXTIME( '$data' ) )" ); $this->id_etiqueta = $db->insert_id; } else { $etiqueta_vella = $db->get_var( "SELECT etiqueta FROM etiquetes WHERE id_etiqueta = $this->id_etiqueta" ); $db->query( "UPDATE etiquetes SET etiqueta = '$etiqueta', data = FROM_UNIXTIME( '$data' ) WHERE etiqueta = '$etiqueta_vella'" ); } return true; } function exporta_dades() { global $globals, $db; $tmp = array(); $tmp['id_etiqueta'] = $this->id_etiqueta; $tmp['etiqueta'] = $this->etiqueta; $tmp['data'] = $this->data; return $tmp; } function esborrar() { global $db; $db->query( "DELETE FROM etiquetes WHERE id_etiqueta = $this->id_etiqueta" ); } } // The source code packaged with this file is Free Software, Copyright (C) 2005 by // Ricardo Galli . // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". function tags_normalize_string($string) { $string = clear_whitespace($string); $string = html_entity_decode(trim($string), ENT_COMPAT, 'UTF-8'); $string = preg_replace('/-+/', '-', $string); // Don't allow a sequence of more than a "-" $string = preg_replace('/ +,/', ',', $string); // Avoid errors like " ," $string = preg_replace('/[\n\t\r]+/s', ' ', $string); $string = preg_replace('/[\.\,] *$/', "", $string); // Clean strange characteres, there are feed reader (including feedburner) that are just too strict and complain loudly $string = preg_replace('/[<>;"\'\]\[&]/', "", $string); return htmlspecialchars(mb_substr($string, 0, 80), ENT_COMPAT, 'UTF-8'); } function tags_insert_string( $id_article, $text, $data= null, $lloc = 'article' ) { global $db; $text = tags_normalize_string( $text ); if( $data == 0 ) $data = time(); $etiquetes = preg_split( '/[,]+/', $text ); if( $etiquetes ) { $db->query( "DELETE FROM etiquetes WHERE id_article = $id_article AND lloc = '$lloc'"); foreach( $etiquetes as $etiqueta ) { $etiqueta = trim( $etiqueta ); if( mb_strlen( $etiqueta ) >= 2 && !isset( $inserted[$etiqueta] ) && !empty( $etiqueta ) ) { $db->query( "INSERT INTO etiquetes ( lloc, id_article, etiqueta, data ) values ( '$lloc', $id_article, '$etiqueta', from_unixtime( $data ) )"); $inserted[$etiqueta] = true; } } return true; } return false; } function tags_get_string( $id_article ) { global $db; $counter = 0; $res = $db->get_col("SELECT etiqueta FROM etiquetes WHERE id_article = $id_article AND lloc = 'article'"); if( !$res ) return false; $text = ''; foreach( $db->get_col( "SELECT etiqueta FROM etiquetes WHERE id_article = $id_article AND lloc = 'article'" ) as $etiqueta ) { if( $counter > 0 ) $text .= ', '; $text .= $etiqueta; $counter++; } return $text; } function clear_whitespace($input){ $input = clear_unicode_spaces(clear_invisible_unicode($input)); return preg_replace('/ +/', ' ', $input); } function clear_unicode_spaces($input){ $spaces = array( "\x9", // 'CHARACTER TABULATION' (U+0009) // "\xa", // 'LINE FEED (LF)' (U+000A) "\xb", // 'LINE TABULATION' (U+000B) "\xc", // 'FORM FEED (FF)' (U+000C) // "\xd", // 'CARRIAGE RETURN (CR)' (U+000D) "\x20", // 'SPACE' (U+0020) "\xc2\xa0", // 'NO-BREAK SPACE' (U+00A0) "\xe1\x9a\x80", // 'OGHAM SPACE MARK' (U+1680) "\xe1\xa0\x8e", // 'MONGOLIAN VOWEL SEPARATOR' (U+180E) "\xe2\x80\x80", // 'EN QUAD' (U+2000) "\xe2\x80\x81", // 'EM QUAD' (U+2001) "\xe2\x80\x82", // 'EN SPACE' (U+2002) "\xe2\x80\x83", // 'EM SPACE' (U+2003) "\xe2\x80\x84", // 'THREE-PER-EM SPACE' (U+2004) "\xe2\x80\x85", // 'FOUR-PER-EM SPACE' (U+2005) "\xe2\x80\x86", // 'SIX-PER-EM SPACE' (U+2006) "\xe2\x80\x87", // 'FIGURE SPACE' (U+2007) "\xe2\x80\x88", // 'PUNCTUATION SPACE' (U+2008) "\xe2\x80\x89", // 'THIN SPACE' (U+2009) "\xe2\x80\x8a", // 'HAIR SPACE' (U+200A) "\xe2\x80\xa8", // 'LINE SEPARATOR' (U+2028) "\xe2\x80\xa9", // 'PARAGRAPH SEPARATOR' (U+2029) "\xe2\x80\xaf", // 'NARROW NO-BREAK SPACE' (U+202F) "\xe2\x81\x9f", // 'MEDIUM MATHEMATICAL SPACE' (U+205F) "\xe3\x80\x80", // 'IDEOGRAPHIC SPACE' (U+3000) ); return str_replace($spaces, ' ', $input); } function clear_invisible_unicode($input){ $invisible = array( "\0", "\xc2\xad", // 'SOFT HYPHEN' (U+00AD) "\xcc\xb7", // 'COMBINING SHORT SOLIDUS OVERLAY' (U+0337) "\xcc\xb8", // 'COMBINING LONG SOLIDUS OVERLAY' (U+0338) "\xcd\x8f", // 'COMBINING GRAPHEME JOINER' (U+034F) "\xe1\x85\x9f", // 'HANGUL CHOSEONG FILLER' (U+115F) "\xe1\x85\xa0", // 'HANGUL JUNGSEONG FILLER' (U+1160) "\xe2\x80\x8b", // 'ZERO WIDTH SPACE' (U+200B) "\xe2\x80\x8c", // 'ZERO WIDTH NON-JOINER' (U+200C) "\xe2\x80\x8d", // 'ZERO WIDTH JOINER' (U+200D) "\xe2\x80\x8e", // 'LEFT-TO-RIGHT MARK' (U+200E) "\xe2\x80\x8f", // 'RIGHT-TO-LEFT MARK' (U+200F) "\xe2\x80\xaa", // 'LEFT-TO-RIGHT EMBEDDING' (U+202A) "\xe2\x80\xab", // 'RIGHT-TO-LEFT EMBEDDING' (U+202B) "\xe2\x80\xac", // 'POP DIRECTIONAL FORMATTING' (U+202C) "\xe2\x80\xad", // 'LEFT-TO-RIGHT OVERRIDE' (U+202D) "\xe2\x80\xae", // 'RIGHT-TO-LEFT OVERRIDE' (U+202E) "\xe3\x85\xa4", // 'HANGUL FILLER' (U+3164) "\xef\xbb\xbf", // 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF) "\xef\xbe\xa0", // 'HALFWIDTH HANGUL FILLER' (U+FFA0) "\xef\xbf\xb9", // 'INTERLINEAR ANNOTATION ANCHOR' (U+FFF9) "\xef\xbf\xba", // 'INTERLINEAR ANNOTATION SEPARATOR' (U+FFFA) "\xef\xbf\xbb", // 'INTERLINEAR ANNOTATION TERMINATOR' (U+FFFB) ); return str_replace($invisible, '', $input); } function totes_etiquetes( &$vars ) { global $db, $s, $globals; $min_pts = 8; $max_pts = 22; $line_height = $max_pts * 0.75; $etiquetes = Array(); $max = max($db->get_var("SELECT COUNT(*) AS etiquetes FROM etiquetes GROUP BY etiqueta ORDER BY etiquetes DESC LIMIT 1"), 2); $coef = ($max_pts - $min_pts)/($max-1); $res = $db->get_results("SELECT etiqueta, COUNT(*) as count FROM etiquetes GROUP BY etiqueta ORDER BY count DESC"); if( $res ) { foreach( $res as $item ) { $words[$item->etiqueta] = $item->count; } ksort($words); $i = 0; foreach( $words as $word => $count ) { $etiquetes[$i]['size'] = round( $min_pts + ( $count - 1 ) * $coef ); $etiquetes[$i]['word'] = $word; $i++; } } return $etiquetes; } Brams - Grup de música

BRAMS

Salta la navegació

Navegació

Vídeos destacats

Propers concerts

Les Borges Blanques

ds / gener 21 / 23:45

TwitterÚltims tweets


Butlletí

avís legal
En compliment de la Llei de Serveis de la Societat de la Informació i de Comerç Electrònic i de la Llei Orgànica de Protecció de Dades us informem que si no desitgeu continuar rebent el nostre butlletí informatiu, us podeu donar de baixa de la nostra base de dades a través d'aquest formulari.