Beispiel #1
0
    $msg = "";
}
?>

<?php 
includeFile('site/header.php');
?>

	<div class='row'>
		<div class='col-md-9'>
			<h2>Contact</h2>

			<h3>Send A Message</h3>

			<?php 
getAlerts();
?>

			<form class='form-horizontal' action='index.php' method='post'>
				<div class='form-group'>
					<label for='name' class='col-sm-2 control-label'>Full Name</label>

					<div class='col-sm-10'>
						<input type='text' id='name' class='form-control' name='name' value='<?php 
echo $name;
?>
' placeholder='Full Name'>
					</div>
				</div>

				<div class='form-group'>
 function getAudioMetas($paths)
 {
     if (!is_array($paths)) {
         $paths = array($paths);
     }
     if (preg_match("/\\/\$/i", $paths[0])) {
         // это каталог
         $files = $this->directory_list($paths[0]);
     } else {
         $dirs = array();
         $tmp = array();
         foreach ($paths as $path) {
             $dirs[$this->safeDirname($path)] = 1;
         }
         foreach ($dirs as $dir => $v) {
             $tmp = array_values($this->directory_list($dir));
             foreach ($tmp as $file) {
                 if (in_array($file["path"], $paths)) {
                     $files[] = $file;
                 }
             }
         }
     }
     $check_misc_artist = array();
     $sortarray1 = array();
     $sortarray2 = array();
     $coversize = 0;
     $cover = "";
     $audioinfo = "";
     $genre = "";
     $bitrate = 0;
     $countfiles = 0;
     $packed_tracks = array();
     $tracks = array();
     $other_files = array();
     $res = array();
     $album = "";
     $artist = "";
     $year = "";
     foreach ($files as $file) {
         if (!$file["isdir"]) {
             $ThisFileInfo = $this->getMetaInfo($file["path"], $file["size"], true);
             if (isset($ThisFileInfo["audio"]) && !isset($ThisFileInfo["video"]) || preg_match("/(mp3|ogg|wma)\$/i", $file["name"])) {
                 // парсим им¤ файла
                 if (preg_match("/(\\d+)(.*)\\.[^\\.]*/i", $file["name"], $matches)) {
                     $track = $matches[1];
                     $title = $matches[2];
                 }
                 $ThisFileInfo['playtime_seconds'] = ($file["size"] - $ThisFileInfo['avdataoffset']) * 8 / $ThisFileInfo['audio']['bitrate'];
                 $title = $this->best_comment($ThisFileInfo, 'title', trim($title));
                 $artist = $this->best_comment($ThisFileInfo, 'artist');
                 $album = $this->best_comment($ThisFileInfo, 'album');
                 $year = isset($ThisFileInfo['comments']['year']) ? implode(";", $ThisFileInfo['comments']['year']) : "";
                 $track = isset($ThisFileInfo['comments']['track']) ? $ThisFileInfo['comments']['track'][0] : $track;
                 $track = explode("/", $track);
                 $track = preg_replace('{[^0-9]}', "", $track[0]);
                 $genre = isset($ThisFileInfo['comments']['genre']) ? implode(";", $ThisFileInfo['comments']['genre']) : "";
                 $tracks[] = array("name" => $file["name"], "track" => $track, "artist" => $artist, "title" => $title, "album" => $album, "year" => $year, "genre" => $genre, "length" => round($ThisFileInfo["playtime_seconds"]), "bitrate" => round($ThisFileInfo['audio']["bitrate"] / 1000), "sample_rate" => $ThisFileInfo['audio']["sample_rate"] / 1000, "channelmode" => $ThisFileInfo['audio']["channelmode"], "bitrate_mode" => $ThisFileInfo['audio']["bitrate_mode"], "size" => $file["size"], "path" => $file["path"]);
                 $packed_tracks[] = str_replace("\r\n", ";", implode("|", $tracks[count($tracks) - 1]));
                 $sortarray1[] = $track;
                 $sortarray2[] = $file["name"];
                 if (!$audioinfo) {
                     $audioinfo = $this->getAudioInfoStr($ThisFileInfo);
                 }
                 $bitrate += $ThisFileInfo['audio']["bitrate"];
                 $countfiles++;
                 $check_misc_artist[$artist] = 1;
             } else {
                 $other_files[] = implode("|", array($file["name"], 0));
             }
             if (preg_match("/(jpe?g|gif|png)\$/i", $file["name"]) && $ThisFileInfo["video"]["resolution_x"] * $ThisFileInfo["video"]["resolution_y"] > $coversize) {
                 $cover = $file["path"];
                 $coversize = $ThisFileInfo["video"]["resolution_x"] * $ThisFileInfo["video"]["resolution_y"];
             }
         } else {
             $other_files[] = implode("|", array($file["name"], 1));
         }
     }
     array_multisort($sortarray1, SORT_NUMERIC, $sortarray2, SORT_NUMERIC, $packed_tracks);
     $res["alerts"] = getAlerts(implode("\r\n", $packed_tracks));
     if (count($check_misc_artist) > 1 && !$res["alerts"]["TracksNotWhole"]) {
         $artist = "Various Artist";
     }
     $typeof = "јльбом";
     if (preg_match("/soundtrack/i", $paths[0] . $genre . $album . $artist)) {
         $typeof = "—аундтрек";
     }
     if (preg_match("/(live|concert)/i", $paths[0] . $album)) {
         $typeof = " онцерт";
     }
     if (preg_match("/single/i", $paths[0] . $album)) {
         $typeof = "—ингл";
     }
     if (preg_match("/remix/i", $paths[0] . $album)) {
         $typeof = "–емикс";
     }
     if (preg_match("/various/i", $paths[0] . $album)) {
         $typeof = "—борник";
     }
     if (preg_match("/(best|this is me|gold|collection|platinum|коллекци¤)/i", $paths[0] . $album)) {
         $typeof = "—борник";
     }
     $res["cover"] = $cover;
     $res["year"] = $year;
     $res["artist"] = $artist;
     $res["album"] = $album;
     $res["genre"] = $genre;
     $res["tracks"] = $tracks;
     $res["packed_tracks"] = $packed_tracks;
     $res["bitrate"] = $countfiles ? round($bitrate / $countfiles / 1000) : 0;
     $res["audioinfo"] = sprintf($audioinfo, $res["bitrate"]);
     $res["other_files"] = $other_files;
     $res["typeof"] = $typeof;
     $res["count_tracks"] = $countfiles;
     return $res;
 }
}
// content
$days = getorset('0', 'Days of Market Signals', '3');
if ($days == 0) {
    $days = 30;
}
for ($i = 0; $i < $days; $i++) {
    $today = time() - $i * 24 * 60 * 60;
    $date = date("Y-m-d", $today);
    $occ = $doc->createElement('content');
    $occ = $root->appendChild($occ);
    addNode($doc, $occ, 'date', $date);
    addNode($doc, $occ, 'datestring', date("l, F j, Y", $today));
    $signals = array();
    if ($i == 0) {
        getAlerts(&$signals);
    }
    // getSignals( &$signals, $date );
    getBuys(&$signals, $date);
    getSells(&$signals, $date);
    foreach ($signals as $detail) {
        $det = $doc->createElement('detail');
        $det = $occ->appendChild($det);
        addNode($doc, $det, 'signal', $detail);
    }
}
echo $doc->saveXML();
// --------- Functions -------------------------
function getAlerts($signals)
{
    // System Alert - GM 47% Price Change
Beispiel #4
0
/**
 * get the weather and other relevant location data for a location and time
 *
 * @param object $weatherObject - a json object containing weather information
 * @param object $value - an object containing descriptive information for an individual location
 *
 * @return array $currentSummary - an array containing weather and other data associated with a location and time
 */
function getWeatherSummary($weatherObject, $value)
{
    $jsonWeatherSummary = json_decode($weatherObject, true);
    $currentSummary = array("latitude" => $jsonWeatherSummary["latitude"], "longitude" => $jsonWeatherSummary["longitude"], "locationName" => $value["locationName"], "locationTime" => $value["locationTime"], "convertedLocationTime" => getTime($value["locationTime"], $jsonWeatherSummary["timezone"]), "predictedWeather" => $jsonWeatherSummary["currently"], "preppedAlerts" => prepAlerts($jsonWeatherSummary, $jsonWeatherSummary["timezone"]), "alerts" => getAlerts($jsonWeatherSummary), "activeStep" => $value["activeStep"], "distance" => $value["distance"]);
    return $currentSummary;
}