topical media & game development

talk show tell print

mashup-flickr-13-Complete-gallery-edit.php / php



  <?php 
  include (dirname(__FILE__) . '/../lib/gallery.php');
  gallery = new FlickrGallery();        
  gallery->authenticate("write");
  if (!gallery->checkAuthenticatedUser())
  {
    gallery->error("You do not have permission to edit these details");
  }
  ?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/gallery.css" rel="stylesheet" type="text/css" />
    <title>Flickr Gallery</title>
  </head>
  <body>
  <?php 
    id = _REQUEST['id'];
    if (!empty(id))
    {
      info = gallery->getPhotoInfo(id);
      title = info['title'];
      img = 'http://static.flickr.com/' . info['server'] . '/' . info['id'] 
        . '_' . info['secret'] . '.jpg';
      photoPage = 'http://www.flickr.com/photos/' . info['owner']['nsid'] . '/' 
        . id . '/';
      description = info['description'];
      
      tags = "";
      if (!empty(info['tags']['tag']))
      {
        foreach (info['tags']['tag'] as tag)
        {
          raw = tag['raw'];
          // Note use of !== operator here
          if (strpos(raw, ' ') !== FALSE)
          {
            // Contains a space, so surround in quotes
            raw = '&quot;' . raw . '&quot;';
          }   
          tags .= raw . " ";
        }
      }
    }
  ?>
  <?php include ('header.php') ?>
  <?php include ('navigation.php') ?>
    <div class="photo-edit">
      <form action=<doEdit.php> method="post">
        <p class="photo-image"><a href="<?php echo photoPage ?>"><img src="<?php 
  echo img ?>" alt="<?php echo title ?>" title="<?php echo title ?>" /></a></p>
        <p class="photo-title-edit"><input name="title" type="text" id="title" 
  value="<?php echo title ?>" size="50" />
        <p class="photo-description-edit">
          <textarea name="description" cols="50" rows="6" wrap="VIRTUAL" 
  id="description"><?php echo description ?></textarea>
        </p>
      <p class="photo-tags-edit"><input name="tags" type="text" id="tags" value="<?php echo tags ?>" size="50" />
      <p class="photo-description-edit">
          <input name="id" type="hidden" value="<?php echo id ?>" />
          <input type="submit" name="Submit" value="Submit Changes" />
          <input type="reset" name="Reset" value="Reset" />
        </p>
      </form>
    </div>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.