<?php 

//conexion ala base de datos
$config['mysql']   = "mysql:host=localhost;dbname=plusmusi_data";
$config['usuario'] = "plusmusi_owner";
$config['contra']  = "^@#F-NBx3W}+";
$opciones          = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',);

function config(){
	$confg['base']       = "https://wvw.plusmusicas.com/movil/";
	$confg['fb']       = "http://fb.com/fulltonovip";
	$confg['tw']       = "http://twitter.com/fulltonovip";
	$confg['gp']       = "http://plus.google.com/fulltonovip";
	return $confg;
}
function row($artista,$genero){
	global $db;
	$ap                = $db->canciones('artista', $artista)->where('genero',$genero)->count('*');
	return $ap;
}
function cortar($text,$limit) {
	$c                 = strlen($text);
	$text              = $text;
	if ($c             >= $limit) : $text = substr($text, 0, $limit)."...";
	else : $text       = $text; endif;
	return htmlentities($text);
}
function biografia($artista){
	$artist            = str_replace("-", "+", $artista);
	if($artista        !=''):
	$url               = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=".$artist."&api_key=30768d3a38c93e61c10e9d1a8a2bc955&lang=es";
	$data              = @file_get_contents($url);
	$conteo            = strlen($data);
	if($conteo         !='0') :
	$ex                = explode("<bio>", $data);
	$ex                = explode("<a href=\"http://www.last.fm/music/", $ex[1]);
	$ex                = $ex[0];
	$ex                = str_replace(array('<![CDATA[',']]>'),'',$ex);
	$ex                = strip_tags($ex);
	else :
	$ex                = "Aun no tenemos la biografia de <b>".$artista."</b>";
	endif;
	return $ex;
	endif;
}
function listgeneros(){
	global $db;
	$ap                = $db->generos()->order('genero ASC');
	return $ap;
}
function links($data){
	return strtolower(str_replace(array('%20',' ', '_'), "-", $data));
}
function antilinks($data){
	return ucwords(str_replace(array('%20',' ', '_','-'), " ", $data));
}
function validargen($genero){
	global $db;
	$validar           = $db->generos('genero',$genero)->count('*');
	if($validar        !='0') :
	$dso               = true;
	else :
	$dso               = false;
	endif;
	return $dso;
}
function validarart($genero,$data){
	global $db;
	$validar           = $db->artistas('artista',$data)->where('genero',$genero)->count('*');
	if($validar        !='0') :
	$dso               = true;
	else :
	$dso               = false;
	endif;
	return $dso;
}


?>