. return $output; } #######Aggiorna scores databse inserendo ",accompaniment,mp3," come keywords #######Se l' item include MP3 accomapniment files (script 2-12-09)... function str_replace_once($search, $replace, $subject) { $firstChar = strpos($subject, $search); if($firstChar !== false) { $beforeStr = substr($subject,0,$firstChar); $afterStr = substr($subject, $firstChar + strlen($search)); return $beforeStr.$replace.$afterStr; } else { return $subject; } } //NOTE: This function below is used just by media server! function checkaccompaniments($null) { global $basedir, $GLOBscorestable, $scores_dev, $composerarrayindexrev, $GLOBComposertable; $query = "SELECT composer, ID, keywords FROM $GLOBscorestable WHERE 1"; $result = mysql_queryFF($query); $nitems = mysql_num_rowsFF($result); if ($nitems) { while ($row = mysql_fetch_arrayFF($result)) { $accompaniment = 0; $composer = $row["composer"]; $itemid = $row["ID"]; $keywords = $row["keywords"]; #print "ecco: $composer - $itemid - $keywords
"; #Definisce $name_composer da $composer include '/home/webadmin/virtualsheetmusic.com/html/cgi-bin/search/php-includes/composers_exceptions.inc'; $singleoffer = $itemid; $singleoffer = eregi_replaceFF("full$", "", $singleoffer); if ($name_composer and $singleoffer) { #Controlla... $file = $basedir."/Mp3acco/".$name_composer."/".$singleoffer; if (file_exists($file)) { $accompaniment = 1; } } #Se c'e' accompaniment... if ($accompaniment and !eregFF(",accompaniment,mp3,file,", $keywords)) { $keywordsmod = str_replace_once(",",",accompaniment,mp3,file,Mp3 accompaniment files,", $keywords); $query1 = "UPDATE $GLOBscorestable SET keywords = '$keywordsmod' WHERE ID = '$itemid'"; $result1 = mysql_queryFF($query1); $accodone ++; #print "ECCOCILILI: $query1

"; } } } return $accodone; } ##Funzione per ritornare nome composer (finalmente!!! 4-29-09)... function getcomposername($composer) { global $scores_dev, $composerarrayindexrev, $GLOBComposertable; include '/home/webadmin/virtualsheetmusic.com/html/cgi-bin/search/php-includes/composers_exceptions.inc'; if ($name_composer == "Miscellaneous") { $name_composer = "miscellaneous composers"; } elseif ($name_composer == "StraussF") { $name_composer = "Strauss"; } elseif ($name_composer == "Beriot") { $name_composer = "C. De Beriot"; } elseif ($name_composer == "BachCPE") { $name_composer = "Bach"; } return $name_composer; } function getcomposernameFORDIRS($composer, $abbrv = 0) { global $GLOBComposertable; if (strpos($composer, "&#") === false) {//Fix 3/29/24, 7:45 AM for those composers with HTML entities inside!! like: Julius Fuč... $composer = html_entity_decode($composer, ENT_QUOTES | ENT_HTML5); } $composer = escapeMySQL($composer); if ($abbrv) {//If from abbreviated name (i.e. F.J.Haydn)...12-3-2015... $queryHERE = "SELECT ID FROM $GLOBComposertable WHERE abbreviated_name = '$composer'"; } else { $queryHERE = "SELECT ID FROM $GLOBComposertable WHERE name = '$composer'"; } $resultHERE = mysql_queryFF($queryHERE); $nitemsHERE = mysql_num_rowsFF($resultHERE); if ($nitemsHERE) { $name = mysql_resultFF($resultHERE,0, 'ID'); } else { $name = ''; } return $name; } ##Funzione per pulire campo "pages" in scores (usato da score_variables. inc e altri) ##Creata per iPhone implementation on 5-1-09)... function cleanpages($pages) { $pages = str_replace ("\x0B", "
", $pages); $pages = strtolower($pages); $pages = convertinstrumentnames($pages); return $pages; } function convertinstrumentnames($pages) { #converte i: e ii: in I e II per violin I, violin II etc.� $pages = str_replace(" vi:"," VI:",$pages); $pages = str_replace(" v:"," V:",$pages); $pages = str_replace(" iv:"," IV:",$pages); $pages = str_replace(" iii:"," III:",$pages); $pages = str_replace(" ii:"," II:",$pages); $pages = str_replace(" i:"," I:",$pages); $pages = str_replace(" iii in "," III in ",$pages); $pages = str_replace(" ii in "," II in ",$pages); $pages = str_replace(" i in "," I in ",$pages); $pages = str_replace(" vi "," VI ",$pages); $pages = str_replace(" v "," V ",$pages); $pages = str_replace(" iv "," IV ",$pages); $pages = str_replace(" iii "," III ",$pages); $pages = str_replace(" ii "," II ",$pages); $pages = str_replace(" i "," I ",$pages); #Converte in eb con in Eb $pages = str_replace(" in eb:"," in Eb:",$pages); $pages = str_replace(" in eb "," in Eb ",$pages); #Converte in bb con in Bb $pages = str_replace(" in bb:"," in Bb:",$pages); $pages = str_replace(" in bb "," in Bb ",$pages); #Converte in f con in F $pages = str_replace(" in f:"," in F:",$pages); $pages = str_replace(" in f "," in F ",$pages); #Converte in d con in D $pages = str_replace(" in d:"," in D:",$pages); $pages = str_replace(" in d "," in D ",$pages); #Etc... $pages = str_replace(" in c:"," in C:",$pages); $pages = str_replace(" in c "," in C ",$pages); $pages = str_replace(" in a:"," in A:",$pages); $pages = str_replace(" in a "," in A ",$pages); $pages = str_replace(" in g "," in G ",$pages); #Altre conversioni $pages = str_replace("c major","C major",$pages); $pages = str_replace("d major","D major",$pages); $pages = str_replace("version in bb","version in Bb",$pages); $pages = str_replace("version in c","version in C",$pages); return $pages; } function resetaccentate($string) { $string = str_replace("ä","a",$string); $string = str_replace("ë","e",$string); $string = str_replace("é","e",$string); $string = str_replace("ä","a",$string); $string = str_replace("ò","o",$string); return $string; } #Funzione per controllare se si e' su iPhone (7-9-09)... #Torna 1 o 0... function isiphone() { global $HTTP_USER_AGENT; if (eregFF("iPhone", $HTTP_USER_AGENT) or eregFF("iPod", $HTTP_USER_AGENT)) { return 1; } else { return 0; } } #Funzione per forzare download (o no) di qualsiasi file... function downloadauto($finalfile, $name, $force = 1) { #La variabile $finalfile contiene il file (con basedir path completa)... #La variabile $name contiene il nome (opzionale)... #La variabile $force forza download (1) o no (0)... global $GLOBbasedir, $GLOBmedia; //Checks if file exists, otherwise it tries to look on media server... //Check added 9-20-2018... if (!file_exists($finalfile)) { if (file_existsAPI($finalfile)) { //Redirects to downloadauto on media server... $finalfile = str_replace($GLOBbasedir, "", $finalfile); $destino = 'https://'.$GLOBmedia.'/scripts/downloadauto.php?file='.$finalfile; #$destino = "https://www.virtualsheetmusic.com/downloadsstatics/extras/CarolOfTheBells.pdf"; #$destino = "https://media.virtualsheetmusic.com/media/firstpage/First.pdf"; //This block below is a quick fix for old iOS app 4.x 11/11/22, 3:26 PM... if (strpos($_SERVER['HTTP_USER_AGENT'], "Darwin") !== false) { if (preg_match("/\.pdf$/", $destino)) { $fileName = basename($finalfile); $pdfFile = file_get_contents($destino); $dataLength = strlen($pdfFile); #$query2 = "INSERT INTO testing14 (message, message2) VALUES ('$destino', '$dataLength')"; #$result2 = mysql_queryFF($query2); header('Content-Description: File Transfer'); header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="'.$fileName.'"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: '.$dataLength); print $pdfFile; exit; } } else { header("HTTP/1.1 301 Moved Permanently"); header("Location: $destino"); exit; } } else {//If not on media either... 404! header("HTTP/1.1 301 Moved Permanently"); header("Location: /404.html"); exit; } } #Estrae nome file... $pezzi = array(); $pezzi = explode("/", $finalfile); if ($name) { $filename = $name; } else { $filename = $pezzi[sizeof($pezzi)-1]; } #Sostituisce spazi con underscores per file name (rev. 8-25-09)... $filename = str_replace(" ", "_", $filename); #Estrae extension... list($null, $extension) = explode(".", $filename); $lunghezza = "Content-Length: ".filesize($finalfile); #print "ecco: $extension - $filename"; #exit; #Ora definisce il MIME type... if ($extension == "mp3") { #Se mp3... $MIMEtype = 'audio/mpeg'; } elseif ($extension == "mid") { #Se MIDI... $MIMEtype= 'audio/x-midi'; } elseif ($extension == "wav") { #Se wav... $MIMEtype= 'audio/x-wav'; } elseif ($extension == "aiff" or $extension == "aif") { #Se aiff... $MIMEtype= 'audio/x-aiff'; } elseif ($extension == "mov") { #Se aiff... $MIMEtype= 'video/quicktime'; } elseif ($extension == "mov") { #Se wma... $MIMEtype= 'audio/x-ms-wma'; } elseif ($extension == "gif") { #Se gif... $MIMEtype = 'image/gif'; } elseif ($extension == "jpg" or $extension == "jpeg") { #Se jpg... $MIMEtype= 'image/jpeg'; } elseif ($extension == "png") { #Se png... $MIMEtype= 'image/png'; } elseif ($extension == "sib") { #Se Sibelius... $MIMEtype= 'application/x-sibelius-score'; } elseif ($extension == "pdf") { #Se PDF... $MIMEtype= 'application/pdf'; } elseif ($extension == "xml") { #Se XML... $MIMEtype= 'application/xml'; } elseif ($extension == "mus") { #Se Finale... $MIMEtype= 'application/x-finale-score'; } else { #Altro... $MIMEtype= 'application/octet-stream '; } if ($force) { $contentdisposition = 'Content-disposition: attachment; filename='.$filename; } $contenttype = 'Content-type: '.$MIMEtype; header('Accept-Ranges: bytes'); header($lunghezza); header($contenttype); header($contentdisposition); readfile($finalfile); } #Funzione per validare l' indirizzo e-mail (shared) function SHAREDis_email_valid($email) { if (eregiFF ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}$", $email)) { return FALSE; } else { return TRUE; } } #Like above but with DNS checking 7/8/24, 7:37 AM... function SHAREDis_email_valid_DNS($email) { list($userName, $mailDomain) = explode("@", $email); if (eregiFF("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}$", $email) and checkdnsrr($mailDomain, "MX")) { return false; } else { return true; } } #Funzione per ritornare red style per errors in input fields... function fielderror($flag, $extraclass = "") { if ($flag) { $ritorno = ' style="border:2px solid red" class="focus'; if ($extraclass) { $ritorno .= ' '.$extraclass; } $ritorno .= '"'; return $ritorno; } else { return ''; } } #Funzione per accettare solo lettere e numbers (per passwords...) function lnonly($string) { $eregi = eregi_replaceFF("([A-Z0-9]+)","",$string); if(empty($eregi)){ return true; } return false; } #Funzione per simulare getcompressed cookies del Perl... function GetCompressedCookies($inputvar, $inputcookie) { $parts = array(); $parts = explode ("&", $inputcookie); foreach ($parts as $single) { list ($var, $value) = explode ("::", $single); if ($var == $inputvar) { return $value; } } return 0; } #Funzione pser simulare SetCompressedCookies cookies del Perl... #Definisce fino a 10 cookies... function SetCompressedCookies($expiration, $name, $par1, $val1, $par2, $val2, $par3 = '', $val3 = '', $par4 = '', $val4 = '', $par5 = '', $val5 = '', $par6 = '', $val6 = '', $par7 = '', $val7 = '', $par8 = '', $val8 = '', $par9 = '', $val9 = '', $par10 = '', $val10 = '') { for ($i = 1; $i <=10; $i ++) { $varvarpar = "par".$i; $varvarval = "val".$i; if ($$varvarpar) { $cookiehere = $$varvarpar."::".$$varvarval; $totcookie .= $cookiehere."&"; } } #Toglie & finale... $totcookie = ereg_replaceFF("\&$", "", $totcookie); #print "ecco: $name - $totcookie"; setcookie ($name,$totcookie, $expiration, "/"); } ////// FUNZIONI IPHONE (spostate qui da functions.inc dentro iPhone folder on 10-15-09)... function aggiustaurl($url, $relativeurl = 0) { global $SSLprot; if ($relativeurl) { $url = "/".$url; } else { $url = $SSLprot."://www.virtualsheetmusic.com/".$url; } return $url; } function cleanffstring($title) { #This below removed on 9-13-2012 becaused caused problems with iPhoneiPad feeds! //$title = HTMLcardecode($title);#Added 8-17-2012... $title = str_replace("|","",$title); $title = str_replace("124;","",$title); $title = str_replace(""","'",$title); $title = str_replace("&","and",$title); $title = str_replace(""","'",$title); $title = str_replace("'","'",$title); $title = str_replace("ä","a",$title); $title = str_replace("ò","o",$title); $title = str_replace("ë","e",$title); $title = str_replace("é","e",$title); $title = str_replace("è","e",$title); $title = str_replace("ê","e",$title); $title = str_replace("Ò","'",$title); $title = str_replace("Ó","'",$title); $title = str_replace("&","and",$title); return $title; } function cleanmembername($nome) { $nome = str_replace("|", "", $nome); $nome = str_replace("\"", "", $nome); $nome = str_replace("'", "", $nome); $nome = str_replace("&", "", $nome); $nome = str_replace(chr(43), " ", $nome); return $nome; } function cleanforrss($text) { $text = philsXMLClean($text); return $text; } function addlimit($query) { global $limit; if ($limit) { $query .= " LIMIT $limit"; } return $query; } #Funzione per pulire inputs in maniera definitiva (6-18-08)... function sanitizeSHARED($input, $nopar = 0) { $input = HTMLcardecode($input); $input = cleaninputs($input, 0, $nopar); $input = HTMLcar($input); return $input; } function sanitizeSHAREDURL($input, $rmquotes = 0) { $input = urldecode($input); $input = cleaninputs($input, $rmquotes); $input = htmlspecialchars($input); //Now re-converts & into &... $input = str_replace("&", "&", $input); return $input; } function HTMLcardecode($string) { #Fa anche conversione HTML special characters reverse... $string = html_entity_decode($string, ENT_QUOTES); $string = stripslashes($string); return $string; } function cleaninputsbasic($input) { $input = preg_replace("/<\?(PHP)?.+\?\>/i", "", $input); $input = preg_replace("/<(\/)?SCRIPT( .)*>/i", "", $input); $input = preg_replace("/<(\/)?IFRAME( .)*>/i", "", $input); #Extra security from Trustkeeper test 1-27-2012... $input = preg_replace("/<( *|\/)SCRIPT( *)>/i", "", $input); $input = str_replace("alert(", "", $input); return $input; } #Funzione per pulire campi di inputs utente (sicurezza)... function cleaninputs($input, $rmquotes = 0, $nopar = 0) { $input = cleaninputsbasic($input); #Removes ;... #Remove parenthesis... if (!$nopar) {//Used by commenting system to keep emjoys... $input = str_replace(";", "", $input); $input = str_replace("(", "", $input); $input = str_replace(")", "", $input); } #Removes quotes if requested... if ($rmquotes) { $input = preg_replace("/\"/i", "", $input); } #Remove strange quotes associations... $input = str_replace("\"'", "", $input); $input = str_replace("'\"", "", $input); #MySQL injection cleaning... /* $input = preg_replace("/ISNULL/i", "", $input); $input = preg_replace("/SUBSTRING/i", "", $input); $input = preg_replace("/CONCAT/i", "", $input); $input = preg_replace("/SELECT\ /i", "", $input); $input = preg_replace("/CHAR\(/i", "", $input); $input = preg_replace("/NSFTW/i", "", $input); $input = preg_replace("/DELETE\ /i", "", $input); $input = preg_replace("/union all/i", "", $input); $input = preg_replace("/javascript:/i", "", $input); */ // $input = str_ireplace("ISNULL", "", $input); // $input = str_ireplace("DECLARE", "", $input); // $input = str_ireplace("SUBSTRING", "", $input); // $input = str_ireplace("CONCAT", "", $input); // $input = str_ireplace("SELECT ", "", $input); // $input = str_ireplace(" CHAR ", "", $input); // $input = str_ireplace("NSFTW", "", $input); // $input = str_ireplace("DELETE ", "", $input); // $input = str_ireplace("union all", "", $input); // // // $input = str_ireplace(" elt ", "", $input); // $input = str_ireplace("pg_sleep", "", $input); // $input = str_ireplace("waitfor delay", "", $input); // $input = str_ireplace("from count ", "", $input); $input = cleanSQLonly($input); $input = str_ireplace("javascript:", "", $input); /* //This below removed 9-24-2014 because caused problems with ajax comments and //other stuff! Find a different way to tackle this, more focused on the problem! #For header attacks... $crhere = chr(13); $lnhere = chr(10); $patternhere = $crhere.$lnhere; $input = preg_replace("/".$patternhere."/i", "", $input); */ #This below removed because some users have the word "script" in their email!! //$input = preg_replace("/SCRIPT/i", "", $input); $input = preg_replace("/IFRAME/i", "", $input); $input = stripslashes($input); $input = trim($input); return $input; } function cleanSQLonly($input) { $input = str_ireplace("ISNULL", "", $input); $input = str_ireplace("DECLARE", "", $input); $input = str_ireplace("SUBSTRING", "", $input); $input = str_ireplace("CONCAT", "", $input); $input = str_ireplace("SELECT ", "", $input); $input = str_ireplace(" CHAR ", "", $input); $input = str_ireplace("NSFTW", "", $input); $input = str_ireplace("DELETE ", "", $input); $input = str_ireplace("union all", "", $input); $input = str_ireplace(" elt ", "", $input); $input = str_ireplace("pg_sleep", "", $input); $input = str_ireplace("waitfor delay", "", $input); $input = str_ireplace("from count ", "", $input); return $input; } #Function to prevent SQLinjection 3-25-2016... function nosqlinj($input, $rmallquotes = 0, $nospaces = 0) { if ($rmsquotes) { $input = str_replace("'", "", $input); $input = str_replace('"', "", $input); } if ($nospaces) { $input = str_replace(" ", "", $input); } $input = cleaninputs($input); return $input; } #Function to sanitize vars that should accept just numeric variables... function sanitizeNUMERIC($input) { if (is_numeric($input)) { return $input; } else { return ''; } } function HTMLcar($string) { $string = str_replace("\\","",$string); #Fa anche conversione HTML special characters... $string = htmlentities($string, ENT_QUOTES); return $string; } function pulisceaudiofile($audiofilehere) { $audiofilehere = str_replace("%25", "%", $audiofilehere); #Converte & (@) e % (@@)... $audiofilehere = str_replace("&", "@", $audiofilehere); $audiofilehere = str_replace("%", "@@", $audiofilehere); return $audiofilehere; } #Funzione per pulire audio file names... function cleanaudiofilename($name, $rmext = 0) { #$name e' il nome del file (es. 01Adagio_sostenuto.mid) #Toglie l' estensione ".mid" o altre... if ($rmext) { list ($name, $null) = explode (".", $name); } $name = fileconversions($name); #Toglie numero iniziale... $name = substr($name,2,strlen($name)-2); return $name; } function fileconversions($name) { $name = ereg_replaceFF ("_", " ", $name); # Converte "=" in ":" $name = ereg_replaceFF ("=", ":", $name); # Converte "!" in "." $name = ereg_replaceFF ("!", ".", $name); # Converte ">u" in "ù" $name = ereg_replaceFF ("ù", "ù", $name); $name = ereg_replaceFF (">u", "ù", $name); #Converte &23 in # $name = ereg_replaceFF ('&23', '#', $name); #Converte &27 in ' $name = ereg_replaceFF ('&27', '\'', $name); $name = str_replace('--27', "'",$name); $name = str_replace('--3F', "?",$name); #Converte &22 in " $name = ereg_replaceFF ('&22', '"', $name); #Converte &35 in # $name = ereg_replaceFF ('&35', '#', $name); #Converte ´ in a' $name = ereg_replaceFF ('´', '´', $name); #Converte é in � $name = ereg_replaceFF ('é', 'é', $name); #Converte &grave in � $name = ereg_replaceFF ('&grave', '`', $name); #Converte è in � $name = ereg_replaceFF ('è', 'è', $name); #Converte à in � $name = ereg_replaceFF ('à', 'à', $name); if (!(eregFF("à",$name)) and !(eregFF("´",$name))) { # Converte "&a" in "ä" (a con dieresi) $name = ereg_replaceFF ("&a", "ä", $name); } return $name; } #Funzione per tagliare frasi piu' lunghe di un certo numero (non tronca le parole!!) function cutText($string, $length) { if($length'.$text.''; } //Function for correct return panel for team members (such as customer service)... function writemenureturn() { global $teamlogged; if ($teamlogged) { $url = '/team/'; } else { $url = '/cgi-bin/topo.pl'; } print '**RETURN TO MAIN MENU**'; } function useragent() { global $_SERVER; $useragent = $_SERVER['HTTP_USER_AGENT']; //print $useragent; if(strchr($useragent,"Edge")) return 'Edge'; if(strchr($useragent,"MSIE 10.0")) return 'IE 10'; if(strchr($useragent,"MSIE 9.0")) return 'IE 9'; if(strchr($useragent,"MSIE 8.0")) return 'IE 8'; if(strchr($useragent,"MSIE 7.")) return 'IE 7'; if(strchr($useragent,"Firefox/3.0")) return 'FIREFOX 3'; if(strchr($useragent,"Firefox/2.0")) return 'FIREFOX 2'; if(strchr($useragent,"Firefox/1.0")) return 'FIREFOX 1'; if(strchr($useragent,"MSIE 6.")) return 'IE 6'; if(strchr($useragent,"MSIE 5")) return 'IE 5'; if(strchr($useragent,"MSIE 4")) return 'IE 4'; if(strchr($useragent,"MSIE 3")) return 'IE 3'; if(strchr($useragent,"Opera")) return 'Opera'; if(strchr($useragent,"iPad")) return 'iPad'; if(strchr($useragent,"iPhone")) return 'iPhone'; if(strchr($useragent,"iPod")) return 'iPhone'; if(strchr($useragent,"Android")) return 'Android'; if(strchr($useragent,"Chrome")) return 'Chrome'; if(strchr($useragent,"Safari")) return 'Safari'; if(strchr($useragent,"CometBird")) return 'CometBird'; if(strchr($useragent,"Firefox")) return 'Firefox'; if(strchr($useragent,"Trident")) return 'IE'; } function ismobile() { global $_SERVER; $useragent = $_SERVER['HTTP_USER_AGENT']; if(strchr($useragent,"iPad")) return '1'; if(strchr($useragent,"iPhone")) return '1'; if(strchr($useragent,"iPod")) return '1'; if(strchr($useragent,"Android")) return '1'; if(strchr($useragent,"mobile")) return '1'; return 0; } function ison_iOS() { if (useragent() == "iPhone" or useragent() == "iPad" or useragent() == "iPod") { return 1; } else { return 0; } } function useragentname() { global $_SERVER; $useragent = $_SERVER['HTTP_USER_AGENT']; //print $useragent; if(strchr($useragent,"MSIE")) return 'Internet Explorer'; if(strchr($useragent,"Opera")) return 'Opera'; if(strchr($useragent,"iPad")) return 'iPad'; if(strchr($useragent,"iPhone")) return 'iPhone'; if (preg_match("/Win/i", $useragent)) { if(strchr($useragent,"Chrome")) return 'this browser';//Now includes Opera also! } else { if(strchr($useragent,"Chrome")) return 'your browser';//Now includes Opera also! } if(strchr($useragent,"Safari")) return 'Safari'; if(strchr($useragent,"CometBird")) return 'CometBird'; if(strchr($useragent,"Firefox")) return 'Firefox'; return "this browser"; } function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; } #Function to clean a name for files (used by new product page system)... function cleanfilename($title) { $title = str_replace('"',"",$title); $title = str_replace(',',"",$title); $title = str_replace('"',"",$title); $title = ereg_replaceFF("\|","",$title); $title = ereg_replaceFF("\ ","_",$title); $title = ereg_replaceFF("\.","",$title); $title = ereg_replaceFF("\(","",$title); $title = ereg_replaceFF("\)","",$title); $title = ereg_replaceFF("\:","",$title); $title = ereg_replaceFF("\'","",$title); $title = ereg_replaceFF("\/","",$title); $title = ereg_replaceFF("\ ","",$title); $title = ereg_replaceFF(""","",$title); $title = ereg_replaceFF("ä","",$title); $title = ereg_replaceFF("è","",$title); $title = ereg_replaceFF("ò","",$title); $title = ereg_replaceFF("é","",$title); $title = ereg_replaceFF("ì","",$title); $title = ereg_replaceFF("ù","",$title); $title = ereg_replaceFF("à","",$title); $title = ereg_replaceFF("ê","",$title); $title = ereg_replaceFF("'","",$title); return $title; } #Function to grab Mp3accos files for a specific ID and composerID... function grabMp3accos($idMp3, $name_composer, $subdirs) { global $GLOBbasedir; //NOTE: variable $name_composer is no longer used here sinde we don't read //from file systme since 9-12-2018... //Defines vars... $Mp3Mp3acco = array(); $Mp3Mp3accoTMP = array(); $queryACCO = "SELECT subdir, acco FROM scores_accos WHERE itemid = '".$idMp3."'"; $resultACCO = mysql_queryFF($queryACCO); $nitemsACCO = mysql_num_rowsFF($resultACCO); $chksbdARR = array(); $lastsubdir = ''; if ($nitemsACCO) { //Emulates file system first 2 empty files... $Mp3Mp3acco[0]['sortname'] = ''; $Mp3Mp3acco[0]['file'] = ''; $Mp3Mp3acco[1]['sortname'] = ''; $Mp3Mp3acco[1]['file'] = ''; if ($subdirs == 1) { $ccac = 0; $ccacsd = 0;//Emulates file system first 2 empty files... } else { $ccac = 2;//Emulates file system first 2 empty files... $ccacsd = 2;//Emulates file system first 2 empty files... } while ($rowACCO = mysql_fetch_arrayFF($resultACCO)) { #Since PHP 'sort' has problems with strings of different length #We must use this awkward system... if ($rowACCO["subdir"]) {//If subdirs... if (!$chksbdARR[$rowACCO["subdir"]]) { $chksbdARR[$rowACCO["subdir"]] = 1; if ($ccacsd) { sort($Mp3Mp3accoTMP[$lastsubdir]); } $Mp3Mp3acco[$ccacsd+2]['sortname'] = strtolower(preg_replace("/_/", "", $rowACCO["subdir"])); $Mp3Mp3acco[$ccacsd+2]['file'] = $rowACCO["subdir"]; $ccacsd ++; } $Mp3Mp3accoTMP[$rowACCO["subdir"]][$ccac]['sortname'] = strtolower(preg_replace("/_/", "", $rowACCO["acco"])); $Mp3Mp3accoTMP[$rowACCO["subdir"]][$ccac]['file'] = $rowACCO["acco"]; $Mp3Mp3accoIDs[$ccac] = $idMp3; #Takes ID of this file... $lastsubdir = $rowACCO["subdir"]; } else { $Mp3Mp3acco[$ccac]['sortname'] = strtolower(preg_replace("/_/", "", $rowACCO["acco"])); $Mp3Mp3acco[$ccac]['file'] = $rowACCO["acco"]; } //print "ecco: ".$rowACCO["acco"]."\n"; $ccac ++; } } /* $dir_Mp3acco = "/home/webadmin/virtualsheetmusic.com/html/Mp3acco/".$name_composer."/".$idMp3."/"; $dh = opendir("$dir_Mp3acco"); #print "Eccoci!"; $ccac = 0; while ($file = readdir($dh)) { $file_array = explode(".",$file); #Since PHP 'sort' has problems with strings of different length #We must use this awkward system... $Mp3Mp3acco[$ccac]['sortname'] = strtolower(preg_replace("/_/", "", $file_array[0])); $Mp3Mp3acco[$ccac]['file'] = $file_array[0]; //print "ecco: ".$file_array[0]."\n"; $ccac ++; } closedir($dh); */ if (sizeof($Mp3Mp3acco)) { sort($Mp3Mp3acco); //print_r($Mp3Mp3acco); if ($subdirs == 1) { #Subdirs... sort($Mp3Mp3accoTMP[$lastsubdir]); /* $ccmp3accos = 0; foreach ($Mp3Mp3acco as $single) { $swt = 0; foreach ($single as $subdiracco) { if (strlen($subdiracco) > 2 and $swt) { #print "dentro: $subdiracco
"; $ccac = 0; #Process subdirs... $dir_Mp3ACCOsub = $GLOBbasedir."/Mp3acco/$name_composer/$idMp3/$subdiracco/"; #print "sooo2: $dir_Mp3ACCOsub"; $dh = opendir("$dir_Mp3ACCOsub"); while ($file = readdir($dh)) { if (strlen($file) > 2) { $file_array = explode(".",$file); #print "eccoci: $subdiracco - $file
"; $Mp3Mp3accoTMP[$subdiracco][$ccac]['sortname'] = strtolower(preg_replace("/_/", "", $file_array[0])); $Mp3Mp3accoTMP[$subdiracco][$ccac]['file'] = $file_array[0]; $Mp3Mp3accoIDs[$ccmp3accos] = $idMp3; #Takes ID of this file... $ccac ++; $ccmp3accos ++; } } closedir($dh); if (sizeof($Mp3Mp3accoTMP)) { sort($Mp3Mp3accoTMP[$subdiracco]); } } $swt ++; } } */ } elseif ($subdirs == 2) { #Regular offers... $ccmp3accos = 0; foreach ($Mp3Mp3acco as $single) { $swt = 0; $ccac = 0; foreach ($single as $file) { if (strlen($file) > 2 and $swt) { #print "dentro: $file
"; $Mp3Mp3accoTMP[$subdiracco][$ccac]['sortname'] = strtolower(preg_replace("/_/", "", $file)); $Mp3Mp3accoTMP[$subdiracco][$ccac]['file'] = $file; $Mp3Mp3accoIDs[$ccmp3accos] = $idMp3; #Takes ID of this file... $ccac ++; $ccmp3accos ++; } $swt ++; } if (sizeof($Mp3Mp3accoTMP)) { sort($Mp3Mp3accoTMP[$subdiracco]); } } } } return array($Mp3Mp3acco, $Mp3Mp3accoTMP, $Mp3Mp3accoIDs); } #Functions to convert URL in order to pass them inside URL vars... function encodeurl($url) { $url = str_replace("=", "@@@", $url); $url = str_replace("&", "___", $url); $url = str_replace("?", "---", $url); return $url; } function decodeurl($url) { $url = str_replace("@@@", "=", $url); $url = str_replace("___", "&", $url); $url = str_replace("---", "?", $url); return $url; } function makesitemurl($productidNEWPP) { if ($productidNEWPP) { $URLNEWPP = checkexs($productidNEWPP)."/".$productidNEWPP.".html"; $URLNEWPP = aggiustaurl($URLNEWPP); return $URLNEWPP; } else { return NULL; } } function fixspaces($text) { $text = str_replace(" ", "_", $text); return $text; } function settitlehereSEO($title, $faketitle) { global $newcat6; if ($title == "Sonata Op.27 No.2") { $titlehereSEO = "Moonlight ".$title; } else { //Here we make sure the $title doens't include the $faketitle already ! 9/7/21, 10:40 AM... $faketitleHere = str_replace(", ", "", $faketitle); if (stripos($title, $faketitleHere) !== false) { $titlehereSEO = $title; } else { $titlehereSEO = $title.$faketitle; } } return $titlehereSEO; } function cleanyoutubeid($youtubeid) { $youtubeid = eregi_replaceFF("(^.+\?v=)(.+)(&.+$)", "\\2", $youtubeid); $youtubeid = eregi_replaceFF("(^.+\?v=)(.+)", "\\2", $youtubeid); $youtubeid = str_replace("https://youtu.be/", "", $youtubeid); $youtubeid = str_replace("http://youtu.be/", "", $youtubeid); $youtubeid = preg_replace("/youtu.be\//", "", $youtubeid); $youtubeid = trim($youtubeid); return $youtubeid; } function parseyoutubeapi($youtubeURL, $programcalled = 0) { global $YTcurrent, $YTtitle, $YTdescription, $YTdonedescription, $YTauthor, $YTduration, $YTminuti, $YTsecondi, $basedir, $MEMBERid, $newcat6, $is_robot, $s_id; #Interpreta input, se singolo code o URL completo... /* if (eregiFF ("youtube.com", $youtubeURL)) { #Se URL completo... $youtubeURL = eregi_replaceFF("^.+\?v=", "", $youtubeURL); $youtubeURL = trim($youtubeURL); } */ $youtubeURL = cleanyoutubeid($youtubeURL); //Since 3/4/21, 8:41 AM we check $s_id and !$is_robot if not called by the backend... if ($programcalled or ($s_id and !$is_robot)) { /* ///This is old system dismissed on 5-14-2015 because we need to use new API... $filename = 'http://gdata.youtube.com/feeds/api/videos/'.$youtubeURL; if (! ($xmlparser = xml_parser_create()) ) { die ("Cannot create parser"); } xml_set_element_handler($xmlparser, "start_tag", "end_tag"); xml_set_character_data_handler($xmlparser, "tag_contents"); ///start parse... if (!($fp = fopen($filename,