[wpkg_web] / profiles_xml_out.php Repository:
ViewVC logotype

View of /profiles_xml_out.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 30 - (download) (annotate)
Thu Jan 11 12:29:10 2007 UTC (11 years, 1 month ago) by linuxkidd
File size: 1783 byte(s)
Updated for removed priority.
Made connect.php check for existence of config.php.

<?php
include "connect.php";

$prof_sql="select * from profiles";

$packs_sql="select packages.idtxt as idtxt from prof_packs left join packages on ( prof_packs.pack_id=packages.id ) where prof_id=%s order by idtxt";

$deps_sql="select profiles.name as name from prof_deps left join profiles on ( prof_deps.dep_id=profiles.id ) where prof_id=%s order by name";

if(isset(
$_GET['name'])) {
  
$prof_sql.=" where name=" quote_smart($_GET['name']);
} else if (isset(
$_GET['id'])) {
  
$prof_sql.=" where id=" quote_smart($_GET['id']);
}

$prof_h=mysql_query($prof_sql) or die ($prof_sql " --- " mysql_error());

if(isset(
$_GET['idtxt']) || isset($_GET['id'])) {
  
$prof_data=mysql_fetch_array($prof_h);
  
$filename=$prof_data['name'] . ".xml";
  
$prof_h=mysql_query($prof_sql) or die ($prof_sql " --- " mysql_error());
} else {
  
$filename='profiles.xml';
}

header('Content-type: text/xml');
header('Content-Disposition: attachment; filename="' $filename '"');

print 
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
print 
"<profiles>\n";

while(
$prof_data=mysql_fetch_array($prof_h)) {
  print 
sprintf("<profile id='%s'>\n",$prof_data['name']);

  
$deps_h=mysql_query(sprintf($deps_sql,quote_smart($prof_data['id']))) or die(sprintf($deps_sql,quote_smart($prof_data['id'])) . " --- " mysql_error());
  while(
$deps_data=mysql_fetch_array($deps_h)) {
    print 
sprintf("  <depends profile-id='%s' />\n",$deps_data['name']);
  }

  
$packs_h=mysql_query(sprintf($packs_sql,quote_smart($prof_data['id']))) or die(sprintf($packs_sql,quote_smart($prof_data['id'])) . " --- " mysql_error());
  while(
$pack_data=mysql_fetch_array($packs_h)) {
    print 
sprintf("  <package package-id='%s' />\n",$pack_data['idtxt']);
  }
  print 
"</profile>\n\n";
}
print 
"</profiles>\n";

?>

ViewVC Help
Powered by ViewVC 1.0.3