Ejemplo n.º 1
0
function getAlbums($parentId = null, &$items = array(), $showHidden = false)
{
    $parentId = getAlbumID($parentId);
    $q = null;
    \cf\createStaticQuery($q, "\r\n\t\tSELECT id, IFNULL(code,id) AS code, parent_id, name, image, short_descr, descr, hidden, sort_order, tag_title, tag_meta_keywords, tag_meta_descr\r\n\t\tFROM cf_gallery_albums\r\n\t\tWHERE (parent_id=:parentId OR (:parentId IS NULL AND parent_id IS NULL))\r\n\t\t\t" . ($showHidden ? '' : 'AND (hidden IS NULL OR hidden=0)') . "\r\n\t\tORDER BY sort_order ASC\r\n\t");
    $albums = \cf\query2arrays($q, array('parentId' => $parentId), false, 'id');
    foreach ($albums as $id => $album) {
        $item = array('' => $album);
        getAlbums($id, $item, $showHidden);
        $items[$album['name']] = $item;
    }
    return $items;
}
Ejemplo n.º 2
0
        if (isset($result->IDalbum)) {
            Flight::redirect('http://localhost/php/App/track/' . $result->IDalbum . '/create');
        } else {
            Flight::render('createAlbum', array("flash" => $result), 'body_content');
            Flight::render('layout', array('Titre' => 'Ajouter un album'));
        }
    }
});
Flight::route('/', function () {
    // home
    Flight::render('home', array(), 'body_content');
    Flight::render('layout', array('Titre' => 'List albums'));
});
Flight::route('GET /albums', function () {
    // view home
    $albums = getAlbums();
    Flight::render('albums', array('albums' => $albums), 'body_content');
    Flight::render('layout', array('Titre' => 'List albums'));
});
// Lecture APP
Flight::route('GET /album/@id', function ($id) {
    $album = json_decode(getAlbum($id));
    $Header_include = '<script type="text/javascript" src="' . _URL_APP_THEME_ . 'js/soundmanager2.js"></script>';
    //------
    if (isset($album->error)) {
        Flight::notFound();
    }
    //------
    Flight::render('album', array('album' => $album, 'tracks' => 'soon'), 'body_content');
    Flight::render('layout', array('Titre' => $album[0]->title, 'include_in_header' => $Header_include));
});
Ejemplo n.º 3
0
<?php

require "avssinit.php";
if (!$authstatus) {
    echo "not logged in";
    exit;
}
$offset = 0;
$limit = 20;
$res = getAlbums($offset, $limit);
print_r($res);
//showPhotoResult($res);
Ejemplo n.º 4
0
 * Dynamically display images with external js module.
 * @author Ben Tomlin (http://tomlin.no)
 */
define('ALBUMS', 'images/');
define('THUMBS', 'thumbs/');
define('UPLOAD', 'uploads/');
define('TITLE', 'My Albums');
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
session_regenerate_id(true);
require_once 'func.php';
if (isset($_POST['upload'])) {
    upload(UPLOAD);
}
$albums = getAlbums(ALBUMS);
if (isset($_GET['generate'])) {
    generateThumbs($albums, THUMBS);
}
?>
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo TITLE;
?>
</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />

    <link rel="shortcut icon" type="image/png" href="favicon.png" />
Ejemplo n.º 5
0
//Get User's albums and generate a MD5 hash based on this
$json = getJson($lastfmApi);
$sns = SnsClient::factory(array('credentials.cache' => $cache, 'region' => 'eu-west-1'));
$sns->publish(array('TopicArn' => 'arn:aws:sns:eu-west-1:346795263809:LastFM-API-CAlls', 'Message' => $json, 'Subject' => $user . "s JSON API Call"));
$jsonhash = md5($json);
//Cache based on user set variables and JSON hash
$filename = "images/{$user}.{$period}.{$rows}.{$cols}.{$albumInfo}.{$plays}.{$jsonhash}";
//if a previous file exists - request is cached, serve from cache and exit
if (file_exists($filename)) {
    header("Content-Type: image/jpeg");
    error_log("Serving from cache - " . $filename);
    echo file_get_contents($filename);
    exit;
}
//otherwise carry on and getAlbums from LastFM.
$albums = getAlbums(json_decode($json));
//Pass the Albums to getArt to download the art into a $covers array
$covers = getArt($albums, 3);
//From the covers array, create a collage while passing user variables required
$image = createCollage($covers, 3, 0, $cols, $rows, $albumInfo, $plays);
//Output HTTP ContentType header.
header("Content-Type: image/jpeg");
//Output image on stdout.
imagejpeg($image, NULL, 100);
//Save image to local filesystem as cache
imagejpeg($image, $filename, 100);
//After output, save image to S3 for static content
$result = $s3->putObject(array('Bucket' => $bucket, 'Key' => strtolower($key), 'SourceFile' => $filename, 'ACL' => 'public-read', 'ContentType' => 'image/jpeg', 'CacheControl' => 'max-age=16400'));
//delete file
unlink($filename);
//Free resources
Ejemplo n.º 6
0
	<body>
		<div class="Canvas">
			<?php 
echo menuHeader(true, $nick, $_SESSION['role']);
?>
	
		
			<form class="Fancy" enctype="multipart/form-data" onSubmit='' action="./business_logic/newPhoto_bl.php" method="post" name="newPhoto" > 
				<fieldset>
					<legend>Subir Foto</legend>
					<label>Los campos marcados con (*) son obligatorios.</label><br/><br/>
					
					<label>(*) Álbum:</label> &emsp; 
					<select name="albumName">
						<?php 
$userAlbums = getAlbums($nick);
foreach ($userAlbums as $album) {
    echo "<option value='" . $album['name'] . "'>" . $album['name'] . "</option>";
}
?>
 
					</select>
					
					<br/><br/>
					<hr/>	
					<br/>					
					
					<span> (*) Foto: </span>
					<br/><br/>
					<input type="file" name="image" id="image" onChange="loadFile(event)">
					<br/><br/>
<?php

getAlbums();
function getAlbums()
{
    $url = _URL_APP_API_ . "albums";
    $request = curl_init($url);
    curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
    $res = curl_exec($request);
    $output = json_decode($res);
    return $output;
}
function getPlaylists()
{
    $url = _URL_APP_API_ . "playlists";
    $request = curl_init($url);
    curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
    $res = curl_exec($request);
    $output = json_decode($res);
    return $output;
}
function getTrack($id)
{
    $url = _URL_APP_API_ . "track/" . $id;
    $request = curl_init($url);
    curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
    $res = curl_exec($request);
    $output = $res;
    return $output;
}
function getProposedTracks($idPlaylist)
Ejemplo n.º 8
0
<ul>
  <li><?require("templates/createAlbum.php");?></li>
  <?
    require_once("database/album.php");
    $albums = getAlbums($_GET["eid"]);
    foreach($albums as $album){
      ?>
      <li data-aid="<?echo $album["aid"]?>">
        <?require("templates/uploadAlbumImage.php");?>
      </li>
    <?
    }
  ?>

</ul>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="../scripts/manageAlbums.js"></script>
Ejemplo n.º 9
0
         $frm->addDescription("You may upload multiple images in a zip file, or a single jpg or gif file");
         $frm->addFormElement("album_files", "file", "File", "", true);
         $frm->method = "post";
         $frm->draw();
     }
     // form for adding a picture
 } else {
     if (isset($_GET["gid"])) {
         $gallery = getGallery($_GET["gid"]);
         writeHeader(3, "Nerdery Pictures", "<a class=\"boldWhiteLink\" href=\"galleries.php\">Picture Galleries</a> >> " . $gallery->name);
         writeCP();
         $sh = new SectionHeader("<a class=\"boldWhiteLink\" href=\"galleries.php\">Picture Galleries</a> >> " . $gallery->name, true);
         $sh->start();
         $sh->end();
         echo '<table border="0" cellpadding="4" cellspacing="0" width="700">';
         $each = getAlbums($_GET["gid"]);
         $i = 0;
         echo "<tr>" . "<td colspan=\"2\">" . '<a class="modifiedLink" href="galleries.php?gid=' . $_GET["gid"] . '">' . $gallery->name . '</a>' . "</td>" . "</tr>";
         while ($a = $each[$i]) {
             if ($a->lastModified > $_SESSION["PrevVisit"]) {
                 $classname = "modifiedLink";
             } else {
                 $classname = "unmodifiedLink";
             }
             echo "<tr>" . "<td width=\"40\"></td>" . "<td width=\"660\">" . "<a class=\"" . $classname . "\" href=\"galleries.php?gid=" . $_GET["gid"] . "&aid=" . $a->id . "\">" . $a->name . "</a>" . "<br><span class=\"itemText\">" . $a->description . "</span>" . "</td>" . "</tr>";
             $i++;
         }
         echo '</table><br>';
         if ($gallery->isPublic || $gallery->creator == $_SESSION["UserID"]) {
             // form for creating an album
             writeSectionHeader("Create an Album");
Ejemplo n.º 10
0
 function getroot()
 {
     global $CONFIG;
     cpg_db_connect();
     $query = "SELECT cid, name  FROM {$CONFIG['TABLE_CATEGORIES']}";
     $categories = cpg_db_fetch_rowset(cpg_db_query($query));
     echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
     echo "<images>\n";
     foreach ($categories as $category) {
         echo "<image>\n";
         echo "<i>" . $category[0] . "</i>\n";
         echo "<l>" . $category[1] . "</l>\n";
         echo "<t>CAT</t>\n";
         echo "<b></b>\n";
         echo "<s></s>\n";
         echo "</image>\n";
         getAlbums(category);
     }
     echo "</images>\n";
 }
Ejemplo n.º 11
0
            break;
        case "ALL":
            if (isset($nick)) {
                $result = $result . printAlbums(getAlbums($nick), false);
                $result = $result . printAlbums(getAllAlbums("limited", $nick), false);
            }
            $result = $result . printAlbums(getAllAlbums("public", $nick), false);
            addAction($nick, $email, $ip, "all_albums");
            break;
        case $nick:
            $result = $result . printAlbums(getAlbums($nick), true);
            addAction($nick, $email, $ip, "self_albums");
            break;
        default:
            if (isset($nick)) {
                $result = $result . printAlbums(getAlbums($targetNick), false);
                $result = $result . printAlbums(getAlbumsByAccess("limited", null), false);
            }
            $result = $result . printAlbums(getAlbumsByAccess("public", null), false);
            addAction($nick, $email, $ip, "others_albums");
            break;
    }
    echo $result;
} else {
    echo "No se ha especificado ningún usuario.";
}
function printAlbums($albums, $self)
{
    $line = "";
    foreach ($albums as $alb) {
        $nick = $alb['nick'];
Ejemplo n.º 12
0
<?php

include_once './functions/database_logic.php';
include_once './functions/user_logic.php';
session_start();
$ip = get_client_ip();
$nick = $_SESSION['nick'];
$email = $_SESSION['email'];
$role = getRole($nick);
$target = $_GET['user'];
if ($role == "admin") {
    $albums = getAlbums($nick);
    foreach ($albums as $album) {
        $myAlbum = $album['name'];
        deleteAlbum($target, $albumName, $email, $ip);
    }
    removeUser($target);
}
?>
 
function getImageAlbums($album_name)
{
    global $albums, $fbo, $uid;
    // Get a list of user albums
    $albums = getAlbums();
    $albums2 = arrayMutate($albums);
    if (($idx = array_search($album_name, $albums2["name"])) !== false) {
        $imageAlbums[] = $albums[$idx];
        disp("Found {$album_name}", 5);
        // If "Album Name #X" is found in the full list of albums, add that to the list.
        for ($i = 2; $idx = array_search("{$album_name} #{$i}", $albums2["name"]); $i++) {
            $imageAlbums[] = $albums[$idx];
            disp("Found {$album_name} #{$i}", 5);
        }
    } else {
        disp("{$album_name} not found. Creating.", 2);
        $imageAlbums[0] = createAlbum($album_name);
    }
    $imageAlbums = arrayMutate($imageAlbums);
    return $imageAlbums;
}
Ejemplo n.º 14
0
function getEvent($id){

  $db = new PDO('sqlite:database/db/EventagerDB.db');
  $stmt = $db->prepare('SELECT * FROM Event WHERE eid=?');
  $stmt->execute(array($id));
  $res = $stmt->fetch();

  $stmt = $db->prepare('SELECT fpath FROM Image WHERE iid=?');
  $stmt->execute(array($res['eimage']));
  $imgPath = $stmt->fetch();

  $stmt = $db->prepare('SELECT uid FROM EventFollower WHERE eid=?');
  $stmt->execute(array($res['eid']));
  $following = $stmt->fetchAll();

  $stmt = $db->prepare('SELECT uid FROM EventOwner WHERE eid=?');
  $stmt->execute(array($id));
  $owner = $stmt->fetch();

  $stmt = $db->prepare('SELECT uname FROM User WHERE uid=?');
  $stmt->execute(array($owner['uid']));
  $creatorName = $stmt->fetch();

  $stmt = $db->prepare('SELECT count(uid) AS attendees FROM EventFollower WHERE eid=?');
  $stmt->execute(array($id));

  $attendeeCount = $stmt->fetch();
  //print_r($attendeeCount);
?>
<input id="eventIdField" type="text" value="<?echo $res["eid"];?>" hidden="hidden"/>
<section id="event">
<div id="coverImage">
<img src="<?echo $imgPath['fpath']?>" id="mainimage"/>
<h1 id="eventTitle"><span id="nameAndauthor"><?echo $res['ename']?> <br> <div id="author"> created by <?echo $creatorName['uname']?></div></span></h1>
</div>

<p class="eventInfo"><?echo $attendeeCount['attendees']?> attending</p>
<? $alreadyFollowing = FALSE;
foreach($following as $follower){
  if($_SESSION['id'] === $follower['uid']){
    $alreadyFollowing = TRUE;
    break;
  }
}
if(!$alreadyFollowing){
  ?><button id="followButton" class="eventInfo"> Follow </button>
<?//<a href="database/action_addFollower.php?eventId=<?echo $res['eid']\?\>">?>
<?}
else{
  ?><button id="unfollowButton" class="eventInfo"> Unfollow </button><?
}?>

<p id="date" class="eventInfo">When: <?echo $res['edate']?></p>

<div id="description">
<h1>Description:</h1>
  <p><?echo $res['description']?></p>
</div>


<div id="albums">
<h2>Albums</h2>
<ul>
<?
  require_once("database/album.php");
  $albums = getAlbums($id);
  foreach($albums as $album){
    $thumbPath = getAlbumThumbPath($album);
    ?>
    <li>
      <div class="album">
        <a href="view_album.php?id=<?echo $album['aid']?>" target="_blank">
          <img class="albumDisplay" src="<? print($thumbPath); ?>" alt="<? echo $album['nome']?>" width="110" height="90"/>
          <span class="albumName albumDisplay"> <? echo $album['nome']; ?> </span>
        </a>
      </div>
    </li>
    <?
  }
?>
  <a id="createAlbumButton" href="javascript:;">Add Album</a>
</ul>
</div>

<div id="albumCreation" class="hiddenForm">
  <form id="albumCreationForm" action="database/action_createAlbum.php" method="post" enctype="multipart/form-data">
    <input type="hidden" id="csrf" name="csrf" value="<?echo $_SESSION['tok']?>" />
    <label>Album Name:</label>
    <input type="text" name="albumName"/>
    <br>
    <input type="submit" value="Create album!"/>
   </form>
</div>

<?
getEventThreads($res['eid']);?>
</section>
<?
//ainda falta meter o forum funcional, opçoes pro owner, ...
}
function STOREArtistAlbumTracks($ArtistURL)
{
    $dom = new simple_html_dom();
    $BASE_URL = "http://rapgenius.com";
    $artistStartPage = scraperwiki::scrape($BASE_URL . $ArtistURL);
    $dom->load($artistStartPage);
    $albumArray = getAlbums($dom);
    $albumURLArray = $albumArray['urls'];
    $albumNameArray = $albumArray['names'];
    #print_r($albumArray);
    foreach ($albumURLArray as $i => $album) {
        $albumDom = new simple_html_dom();
        # print $album . "\n";
        $albumPage = scraperwiki::scrape($BASE_URL . $album);
        $albumDom->load($albumPage);
        #print $albumDom ."\n\n";
        #$albumA = $albumDom->find('ul.album_list',0);
        print "album => " . $albumNameArray[$i] . "\n";
        $trackArray = getSongList($albumDom);
        $albumName = $albumNameArray[$i];
        #print_r($trackArray);
        foreach ($trackArray as $j => $track) {
            $trackPage = scraperwiki::scrape($BASE_URL . $track);
            $trackDom = new simple_html_dom();
            #print $track . "\n";
            $trackDom->load($trackPage);
            //use trackDom to get lyrics and metadata?
            $trackMeta = getTrackMetaData($trackDom);
            #print_r($trackMeta);
            $trackMeta['album'] = $albumName;
            addTrack($track, $trackMeta);
        }
    }
}