<?php // component to dynamically generate a configuration file for the Planet feed aggregator global $base; // where to put the generated config file? $outputfile = $base."lib/venus/sucs/generatedconfig.ini"; // Where Planet should output its generated files to $planetoutputdir = $base."htdocs/planet"; $sucsdbname = "sucs"; $hackergotchipath = "/var/www/sucssite/htdocs/pictures/people/"; // open connection to sucs database $sucsDB = NewADOConnection('postgres8'); $sucsDB->Connect('dbname='.$sucsdbname.' user=apache'); $sucsDB->SetFetchMode(ADODB_FETCH_ASSOC); // fetch blogroll $blogroll = $sucsDB->GetAll("SELECT username, blogfeed AS feeduri FROM members WHERE syndicateblog=TRUE"); // figure out whether each user has a hackergotchi picture foreach($blogroll as &$blog) { if (is_file($hackergotchipath.$blog['username'].".png")) { $blog['hackergotchi'] = TRUE; } else { $blog['hackergotchi'] = FALSE; } } $smarty->assign("blogroll", $blogroll); $smarty->assign("planetoutputdir", $planetoutputdir); $config = $smarty->fetch("planetconfig.tpl"); file_put_contents($outputfile, $config); ?>