function igc2kmz($file, $outputFile, $timezone, $flightID) { global $CONF, $CONF_tables_prefix, $baseInstallationPath, $db; $str = ""; $version = $CONF['googleEarth']['igc2kmz']['version']; $kmzFile = $outputFile . ".{$version}.kmz"; deleteOldKmzFiles($outputFile, $version); // exit; if (is_file($kmzFile)) { return $version; } $python = $CONF['googleEarth']['igc2kmz']['python']; putenv('PYTHON_EGG_CACHE=' . dirname(__FILE__) . '/data/tmp'); // put some env for python2.5? // putenv("PATH=".$CONF['googleEarth']['igc2kmz']['python'] ); putenv("PATH=/usr/local/bin/"); $path = realpath($CONF['googleEarth']['igc2kmz']['path']); if (!defined('SQL_LAYER')) { define('SQL_LAYER', 'mysql'); } global $phpbb3AbsPath, $dbhost, $dbname, $dbuser, $dbpasswd; $dbpasswdCon = $dbpasswd; if (!$dbpasswdCon) { $dbpasswdCon = $db->password; } $dbhostCon = $dbhost; if (!$dbhostCon) { $dbhostCon = $db->server; } if (!$dbhostCon) { $dbhostCon = 'localhost'; } $engine = SQL_LAYER . "://" . $db->user . ':' . $dbpasswdCon . '@' . $dbhostCon . '/' . $db->dbname; $cmd = "{$python} {$path}/bin/leonardo2kmz.py"; $cmd .= " --engine '{$engine}'"; $cmd .= " --table-prefix={$CONF_tables_prefix}"; $cmd .= " --directory '" . realpath(dirname(__FILE__)) . "'"; // $cmd.=" --igcpath '".dirname(__FILE__).'/'.$CONF['paths']['intermediate']."'"; // $cmd.=" --directory '".realpath(dirname(__FILE__).'/../..')."'"; $cmd .= " --url 'http://" . $_SERVER['SERVER_NAME'] . "{$baseInstallationPath}'"; // $cmd.=" --icon '$baseInstallationPath/templates/basic/tpl/leonardo_logo.gif' "; // $cmd.=" --photos_path '".$CONF['paths']['photos']."' "; // $cmd.=" --photos_url '$baseInstallationPath/'".$CONF['paths']['photos']."'' "; //DEFAULT_PHOTOS_PATH = 'data/flights/photos/%YEAR%/%PILOTID%' //DEFAULT_PHOTOS_URL = '/modules/leonardo/data/flights/photos/%YEAR%/%PILOTID%' $cmd .= " --output '{$kmzFile}'"; $cmd .= " --tz-offset {$timezone}"; $cmd .= " --igc-path=" . $CONF['paths']['intermediate'] . " "; // data/flights/intermediate/%YEAR%/%PILOTID% $cmd .= " {$flightID}"; DEBUG('igc2kmz', 1, "igc2kmz: {$cmd} <BR>"); exec($cmd, $res); if (0) { //echo "timezone: $timezone<br>"; echo "cmd: {$cmd}<BR>"; print_r($res); //print_r($db); //echo "$dbhost , $dbname ,$dbuser ,$dbpasswd @"; exit; } return $version; }
for($i=0;$i<$CONF_photosPerFlight;$i++) { if ($_REQUEST["photo".$i."Delete"]=="1") { // DELETE photo // echo "deleting photo $i<HR>"; $flightPhotos->deletePhoto($i); $flight->hasPhotos--; $photosChanged=true; } } if ( $photosChanged ){ // recompute geoTag info $flightPhotos->computeGeoInfo(); //delete igc2kmz.kmz file require_once dirname(__FILE__).'/FN_igc2kmz.php'; deleteOldKmzFiles($flight->getKMLFilename(3),'xxx'); // delete all versions } $flight->putFlightToDB(1); // $flightPhotos->putToDB(); } // end else openMain(_CHANGE_FLIGHT_DATA,0,''); echo "<center><br><span class='OK'>"._THE_CHANGES_HAVE_BEEN_APPLIED."</span><br><br><br>"; echo "<a href='".getLeonardoLink(array('op'=>'show_flight','flightID'=>$flightID))."'>"._RETURN_TO_FLIGHT."</a><br><br><br>"; echo "</center>"; closeMain(); } else { // show the form
function deleteSecondaryFiles() { # martin jursa 28.05.2008: delete using the deleteFile() method to avoid log flooding $this->deleteFile($this->getJsonFilename()); // json.js $this->deleteFile($this->getPolylineFilename()); // *.poly.txt $this->deleteFile($this->getPointsFilename(1)); // *.1.txt $this->deleteFile($this->getKMLFilename(0)); // kmz $this->deleteFile($this->getKMLFilename(1)); // man.kmz require_once dirname(__FILE__) . '/FN_igc2kmz.php'; deleteOldKmzFiles($this->getKMLFilename(3), 'xxx'); // delete all versions igc2kmz }
// now delete photos if requested for ($i = 0; $i < $CONF_photosPerFlight; $i++) { if ($_REQUEST["photo" . $i . "Delete"] == "1") { // DELETE photo // echo "deleting photo $i<HR>"; $flightPhotos->deletePhoto($i); $flight->hasPhotos--; $photosChanged = true; } } if ($photosChanged) { // recompute geoTag info $flightPhotos->computeGeoInfo(); //delete igc2kmz.kmz file require_once dirname(__FILE__) . '/FN_igc2kmz.php'; deleteOldKmzFiles($flight->getKMLFilename(3), 'xxx'); // delete all versions } $flight->putFlightToDB(1); // $flightPhotos->putToDB(); } // end else openMain(_CHANGE_FLIGHT_DATA, 0, ''); echo "<center><br><span class='OK'>" . _THE_CHANGES_HAVE_BEEN_APPLIED . "</span><br><br><br>"; echo "<a href='" . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $flightID)) . "'>" . _RETURN_TO_FLIGHT . "</a><br><br><br>"; echo "</center>"; closeMain(); } else { // show the form // if ($_GET['checkg'] + 0 == 1) {