                    


<?php
//-->-->-->-->-->-->-->-->
   require '/usr50/home/retrovox/public_html/manage/php-lib/RETROVOX-CONSTANT-VARIABLES.php';  
   require '/usr50/home/retrovox/public_html/manage/php-lib/fnRetrovoxParseXml.php';

   $sDataPath = '/usr50/home/retrovox/public_html/product-data';
   $sProductId = $_GET["product"];
   $sFilePath = "$sDataPath/product-$sProductId.xml";
   
   if ($sProductId == '')
   {
    echo "
      <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'>
      <html>
       <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'>
       <META HTTP-EQUIV='Keywords'
		CONTENT='Retrovox Products'>
       <META HTTP-EQUIV='Description'
		CONTENT='Retrovox Product, no item'>
	      <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'>

      <head><title>Retrovox Product Display, (No product specified)</title>
      </head>
      <body>
      ${S-RETROVOX-TITLE-IMAGE-HTML}
      <center><h1>No product was specified to edit</h1></center>
      <br>
      <ol type = 'a'>   
      <li>
      <a href = '/product-data/'>View the product data directory</a></li>
      <li>
      <a href = '/manage/add-product-form.php'>
      Add a new product to the Retrovox database</a></li>
      <li>
      Select a product to edit from the list below
      
      <table border = '0'>";

     $iCurrentProductId = 0;
     $sExtractedId = '';    //-- to get the product-id from the file name
     $sFileContents = '';
     $aaProductData = '';
     $iCount = '0';         //-- used to shade alternate rows of display table

     $dh  = opendir($sDataPath);
     while (false !== ($sCurrentFileName = readdir($dh)))
     {
       $sExtractedId = 
        str_replace('.xml', '', str_replace('product-', '', $sCurrentFileName));
        if (is_numeric($sExtractedId))
        {
          $iCurrentProductId = $sExtractedId;
          $sFileContents = implode('', file($sDataPath."/".$sCurrentFileName));
          $aaProductData = fnRetrovoxParseXml($sFileContents);
          if (($iCount % 2) == 0)
            { $sBackgroundColour = "#ffffff"; }
          else
            { $sBackgroundColour = "#efefef"; }

          echo "
           <tr bgcolor = \"$sBackgroundColour\"><td>".
                 $aaProductData['product-id']."</td><td>".
                 $aaProductData['product-name'].
            "</td><td><a href = '/product-data/display-product.php?product=".
            $aaProductData['product-id']."'>view page </a></td><td>
            <a href = '/product-data/display-product-tabular.php?product=".
            $aaProductData['product-id']."'>view data </a></td><td>
            <a href = '/product-data/display-product-xml.php?product=".
            $aaProductData['product-id']."'>view xml </a></td><td>
            <a href = '/manage/edit-product-form.php?product=".
            $aaProductData['product-id']."'>edit </a></td></tr>";
            $iCount++;
         } //-- if is product data file
      } //-- while more files


     echo "
      </table></li>
      </ol>
      <small>TIP:
       You can specify a product to edit using a 'query string' in the 
       URL for this page. For example, you could type
       <a href='http://www.retrovox.com.au/product-data/display-product-tabular.php?product=62'>
       http://www.retrovox.com.au/product-data/display-product-tabular.php?product=62</a>
       in your browsers address-bar in order to view the product with the id 62 
      </small>
      </body>
      </html>";
      exit; 
   } //-- if no product

   if (!file_exists($sFilePath))
   {
    echo "
      <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'>
      <html>
       <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'>
       <META HTTP-EQUIV='Keywords'
		CONTENT='Retrovox'>
       <META HTTP-EQUIV='Description'
		CONTENT='Retrovox notepad, item doesnt exist'>
	      <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'>

      <head><title>Retrovox Product Display, (The item doesn't exist)</title>
      </head>
      <body>
      $S-RETROVOX-TITLE-IMAGE-HTML
      <center><h1>The item doesn't exist</h1></center>
	  <p>There is no product on the Retrovox site with the product-id which
             you just specified. Please try again</p>
          <br>
       <ol type = 'a'>   
         <li>
         <a href = '/product-data/'>View the product data directory</a></li>
         <li>
         <a href = '/manage/add-product-form.php'>
         Add a new product to the Retrovox database</a></li>
       </ol>
       </body>
      </html>";
      exit; 
   } //-- if product doesnt exist
 
   if (!is_readable($sFilePath))
   {
    echo "
      <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 3.2//EN'>
      <html>
       <META HTTP-EQUIV='Content-Type' CONTENT='text/html; CHARSET='iso-8859-1'>
       <META HTTP-EQUIV='Keywords'
		CONTENT='Retrovox'>
       <META HTTP-EQUIV='Description'
		CONTENT='Retrovox, product file not readable'>
	      <LINK REV='made' HREF='mailto:matth3wbishop@yahoo.com'>

      <head><title>Retrovox Product Display, (The product file is not readable)</title>
      </head>
      <body>
      $S-RETROVOX-TITLE-IMAGE-HTML
      <center><h1>The product file is not readable</h1></center>
	  <p>The file containing the data for the product which you specified
             is not readable. The permissions for this file will need to be 
             altered by the system administrator
            </p>
          <br>
      </body>
      </html>";
     return; 
   } //-- if product file not readable 


   //$aaProductData = parse_ini_file($sFilePath);
   //echo "short-description=".$aaProductData["short-description"];


   $sProductData = implode('', file($sFilePath));
   $aaProductData = fnRetrovoxParseXml($sProductData);




//--<--<--<--<--<
?>

<HTML>
<HEAD>
   <TITLE>Edit Retrovox Product Information </TITLE>
</HEAD>


<body>
 <?=$S-RETROVOX-TITLE-IMAGE-HTML?>
 <center>
   <form method = 'post' 
         action = 'http://www.retrovox.com.au/manage/update-product.php'>
   <table  border = "1">
<?php
//-->-->-->-->-->-->-->-->
   echo "
        <tr>
	  <td><strong><em>product-id</em></strong></td>
	  <td>".$aaProductData['product-id'].
	  "<input type = 'hiddenrentProduc6ile will need to be 
             altered     <br>
      </body>
      </html>";
     return; 
   } //-- if product file not readable 


   //$aaProductData = parse_ini_file($sFilePath);
   //echo "short-description=".$a HTTP-E         ovox database</a></li>
      <li>
ARSET='is                       9-1'>
       <META HTTP-EQUIV='Keywords'Cs106063 025375  0         echo "short-description=    CONTENT))))))))))))    $sFileCont 6em></) && ))))))    '>
       ndColour =#ffffff"; }ct file not readable 


   //$aaProduct</a></li>
    <li><a  


   E         ovox>Retase</a></lt</a'oductData["shortRSET='is          ta);

//--<--<--<--<--<
readabl HTTP-EQUIV='Keywords'Cs11111
      <?=$sProductId?>product file not readable 


   //$aaProduc$sFileCont 6em><></li>
    <li><a  


   >Retauctse</a></l$sFileCont 6em></>$key></l40'edId))</l3'p?pro	ile_);

//--<--<--            9-1$sFileCont 6em></]-<
?>RetauctA HTTP-EQUIV='Keywords'C.xml'>
      View the raw XML data age fore not r E         ovoxsubmitass        Stmlv eot rT h eot rC h tse g eoRETROVOX  } //-- for ta for this pra f-id'is product</a></li>
    <li><a href = '/product-data/-data/display-product-xml.php?product=<?=$sProductId?>'>
      View the XML data for this product in a web-page</a></li>
    <li><a href = 'edit-product-form.php?product=<?=$sProductId?>'>
      Edit the data for this product</a> (Administrators Only)</li>

  </ol>
</body>
</html>
                                        