function convertGeometryCollection($geom) { global $depth; $searchstr = array(",POINT", ",LINESTRING", ",POLYGON", ",MULTIPOINT", ",MULTILINESTRING", ",MULTIPOLYGON"); $replacestr = array(" , POINT", " , LINESTRING", " , POLYGON", " , MULTIPOINT", " , MULTILINESTRING", " , MULTIPOLYGON"); $geom = str_replace($searchstr, $replacestr, $geom); writeTag("open", "gml", "MultiGeometry", Null, True, True); $depth++; $geoms = explodeGeom($geom); foreach ($geoms as $geom) { writeTag("open", "gml", "geometryMember", Null, True, True); $depth++; convertGeom($geom); $depth--; writeTag("close", "gml", "geometryMember", Null, True, True); } $depth--; writeTag("close", "gml", "MultiGeometry", Null, True, True); }
if ($maxLength) { echo "<xsd:maxLength value=\"{$maxLength}\"/>"; } } echo '</xsd:restriction></xsd:simpleType>'; } writeTag("close", "xsd", "element", NULL, False, True); $atts = Null; } $depth--; writeTag("close", "xsd", "sequence", Null, True, True); $depth--; writeTag("close", "xsd", "extension", Null, True, True); $depth--; writeTag("close", "xsd", "complexContent", Null, True, True); $depth--; writeTag("close", "xsd", "complexType", Null, True, True); } $postgisObject->close(); foreach ($tables as $table) { $atts["name"] = $table; $atts["type"] = $table . "_Type"; if ($gmlNameSpace) { $atts["type"] = $gmlNameSpace . ":" . $atts["type"]; } $atts["substitutionGroup"] = "gml:_Feature"; writeTag("selfclose", "xsd", "element", $atts, True, True); } $depth--; writeTag("close", "xsd", "schema", Null, True, True);
function addItem(&$rss, &$prog) { global $config; $rss .= "\n\n<item>"; writeTag($rss, "title", $prog->get('title')); /* 08.02.06 start rama hack to print roles */ $roleArr = $prog->getRoles(); $roleArrSize = count($roleArr); for ($i = 0; $i < $roleArrSize; $i++) { $role_name = $roleArr[$i]["role_name"]; $contact_name = $roleArr[$i]["contact_data"]["name"]; //$role_info = "$contact_name, $role_name"; $role_info = array('contact_name' => $contact_name, 'role_name' => $role_name); writeTag($rss, "roles", NULL, NULL, $role_info); } /* end rama hack to print roles */ writeTag($rss, "link", $config['rootUrl'] . "/get.php?id=" . $prog->id); writeTag($rss, "pubDate", toW3CDate($prog->get('entry_date'))); writeTag($rss, "description", $prog->get('abstract')); writeTag($rss, "BroadcastDate", toW3CDate($prog->get('broadcast_date'))); if ($prog->isVideoPrg()) { $type = 'video/mov'; } else { $type = 'audio/mpeg'; } $audioAttrs = selectAudioVideo($prog); if ($audioAttrs['url']) { //MODIFIED BY Martin Schmidt, was if($audioAttrs) //$filepath = $prog->getFilePath($audioAttrs); //$tmpFile = linkAudio($filepath, $audioAttrs); $enclAttrs = array('type' => $type, 'length' => $audioAttrs['filesize'], 'url' => $audioAttrs['url']); writeTag($rss, "enclosure", NULL, NULL, $enclAttrs); } $streamAttrs = selectStream($prog); if ($streamAttrs['url']) { //MODIFIED BY Martin Schmidt, was if($streamAttrs) //$filepath = $prog->getFilePath($audioAttrs); //$tmpFile = linkAudio($filepath, $audioAttrs); $enclAttrs = array('type' => $type, 'length' => $streamAttrs['filesize'], 'url' => $streamAttrs['url']); writeTag($rss, "streamurl", NULL, NULL, $enclAttrs); } $rss .= "\n</item>"; }
/** * Write out all tags for any given entry.. * * @param array $entry */ function writeTags($tags, $oldtags, $code) { if (is_string($tags)) { $tags = explode(", ", $tags); } $oldtags = explode(", ", $oldtags); // Loop through new tags, and add them.. if (is_array($tags) && count($tags) > 0) { foreach ($tags as $tag) { writeTag($tag, $code); make_related_tags($tag, $tags); } } // Loop through old tags, and delete them if they are no longer present. if (is_array($oldtags) && count($oldtags) > 0) { foreach ($oldtags as $oldtag) { if (!in_array($oldtag, $tags)) { deleteTag($oldtag, $code); } } } }
function genBBox($XMin, $YMin, $XMax, $YMax) { global $depth; global $tables; global $db; global $srs; writeTag("open", "gml", "boundedBy", null, True, True); $depth++; writeTag("open", "gml", "Box", array("srsName" => "EPSG:" . $srs), True, True); $depth++; writeTag("open", "gml", "coordinates", array("decimal" => ".", "cs" => ",", "ts" => " "), True, False); print $XMin . "," . $YMin . " " . $XMax . "," . $YMax; writeTag("close", "gml", "coordinates", null, False, True); $depth--; writeTag("close", "gml", "Box", null, True, True); $depth--; writeTag("close", "gml", "boundedBy", null, True, True); }
/** * * * @param unknown $table * @param unknown $sql * @param unknown $sql2 * @param unknown $from */ function doSelect($table, $sql, $sql2, $from) { global $db; global $depth; global $postgisObject; global $srs; global $gmlNameSpaceUri; global $lf; global $gmlNameSpace; global $gmlNameSpaceGeom; global $gmlFeature; global $gmlGeomFieldName; global $gmlUseAltFunctions; global $defaultBoundedBox; global $cacheDir; global $startTime; global $useWktToGmlInPHP; global $thePath; global $HTTP_FORM_VARS; global $tableObj; global $postgisschema; global $fieldConfArr; if (!$gmlFeature[$table]) { $gmlFeature[$table] = $table; } if ($sql2) { $postgisObject->execQuery("BEGIN"); $result = $postgisObject->execQuery($sql2 . $from); //logfile::write($sql2.$from."\n"); if ($postgisObject->numRows($result) == 1) { while ($myrow = $postgisObject->fetchRow($result)) { if (!empty($myrow["txmin"])) { //added NR genBBox($myrow["txmin"], $myrow["tymin"], $myrow["txmax"], $myrow["tymax"]); } else { //return; } } } else { print $defaultBoundedBox; } } else { print $defaultBoundedBox; } $result = $postgisObject->execQuery($sql . $from . " LIMIT 1000000"); if ($postgisObject->numRows($result) < 1) { $sql = str_replace(",public.ST_AsText(public.ST_Transform(the_geom,25832)) as the_geom", "", $sql); $from = str_replace("view", "join", $from); $result = $postgisObject->execQuery($sql . $from); } logfile::write("SQL fired\n\n"); logfile::write($sql . $from . "\n"); $totalTime = microtime_float() - $startTime; logfile::write("\nQuery time {$totalTime}\n"); //foreach($postgisObject -> execQuery($sql.$from." LIMIT 10000") as $myrow) { //Iteration directly over result. Only PDO if ($postgisObject->PDOerror) { makeExceptionReport($postgisObject->PDOerror); } while ($myrow = $postgisObject->fetchRow($result)) { writeTag("open", "gml", "featureMember", null, True, True); $depth++; writeTag("open", $gmlNameSpace, $gmlFeature[$table], array("fid" => "{$table}.{$myrow["fid"]}"), True, True); $depth++; $checkIfGeomHasPassed = false; // Check that geom field is written out only once. $numFields = sizeof($myrow); $keys = array_keys($myrow); for ($i = 0; $i < $numFields; $i++) { $FieldName = $keys[$i]; $FieldValue = $myrow[$FieldName]; if ($tableObj->metaData[$FieldName]['type'] != "geometry" && $FieldName != "txmin" && $FieldName != "tymin" && $FieldName != "txmax" && $FieldName != "tymax" && $FieldName != "tymax" && $FieldName != "oid") { if ($gmlUseAltFunctions['altFieldValue']) { $FieldValue = altFieldValue($FieldName, $FieldValue); } if ($gmlUseAltFunctions['altFieldNameToUpper']) { $FieldName = altFieldNameToUpper($FieldName); } if ($gmlUseAltFunctions['changeFieldName']) { $FieldName = changeFieldName($FieldName); } $fieldProperties = (array) json_decode($fieldConfArr[$FieldName]->properties); if ($fieldProperties['cartomobilePictureUrl']) { //if ($myrow[$fieldProperties['cartomobilePictureUrl']]) { $FieldValue = getCartoMobilePictureUrl($table, $FieldName, $fieldProperties['cartomobilePictureUrl'], $myrow["fid"]); //} } //$FieldValue = htmlentities($FieldValue); $FieldValue = altUseCdataOnStrings($FieldValue); if ($FieldValue && ($FieldName != "fid" && $FieldName != "FID")) { writeTag("open", $gmlNameSpace, $FieldName, null, True, False); //$FieldType = pg_field_type($result, $i); echo $FieldValue; writeTag("close", $gmlNameSpace, $FieldName, null, False, True); } } elseif ($tableObj->metaData[$FieldName]['type'] == "geometry") { // Check if the geometry field use another name space and element name if (!$gmlGeomFieldName[$table]) { $gmlGeomFieldName[$table] = $FieldName; } if ($gmlNameSpaceGeom) { $tmpNameSpace = $gmlNameSpaceGeom; } else { $tmpNameSpace = $gmlNameSpace; } writeTag("open", $tmpNameSpace, $gmlGeomFieldName[$table], null, True, True); $depth++; if ($useWktToGmlInPHP) { $__geoObj = geometryfactory::createGeometry($myrow[$FieldName], "EPSG:" . $srs); echo $__geoObj->getGML(); unset($__geoObj); } else { echo $myrow[$FieldName]; } $depth--; writeTag("close", $tmpNameSpace, $gmlGeomFieldName[$table], null, True, True); } } $depth--; writeTag("close", $gmlNameSpace, $gmlFeature[$table], null, True, True); $depth--; writeTag("close", "gml", "featureMember", null, True, True); } $totalTime = microtime_float() - $startTime; print "\n<!-- {$totalTime} -->"; $postgisObject->execQuery("ROLLBACK"); }
function addItem(&$rss, &$prog) { global $config; $rss .= "\n\n<item>"; writeTag($rss, "title", $prog->get('title')); writeTag($rss, "link", $config['rootUrl'] . "/get.php?id=" . $prog->id); writeTag($rss, "pubDate", toW3CDate($prog->get('entry_date'))); writeTag($rss, "description", $prog->get('abstract')); writeTag($rss, "guid", $prog->get('id')); writeTag($rss, "sotf:episodesequence", $prog->get('episode_sequence')); writeTag($rss, "sotf:episodetitle", $prog->get('episode_title')); writeTag($rss, "sotf:broadcastdate", $prog->get('broadcast_date')); $files = $prog->getAssociatedObjects('sotf_media_files', 'main_content DESC, filename'); for ($i = 0; $i < count($files); $i++) { $files[$i] = array_merge($files[$i], sotf_AudioFile::decodeFormatFilename($files[$i]['format'])); $files[$i]['playtime_string'] = strftime('%M:%S', $fFiles[$i]['play_length']); } if ($files) { $rss .= "\n<sotf:mediafiles>"; foreach ($files as $f) { if ($f['stream_access'] = 't') { #$rss .= "\n<sotf:mediafileitem>"; #writeTag($rss, "sotf:mediafileurl", $config['rootUrl']."/listen.php/audio.m3u?id=".$prog->get('id')); #writeTag($rss, "sotf:mediafileimage", $config['rootUrl']."/static/listen.gif"); #writeTag($rss, "sotf:mediafiletype", "audio"); #writeTag($rss, "sotf:mediafilebitrate", $f['bitrate']); #writeTag($rss, "sotf:mediafileformat", $f['format']); #$rss .= "\n</sotf:mediafileitem>"; $rss .= "\n<sotf:mediafileitem url=\"" . $config['rootUrl'] . "/listen.php/audio.m3u?id=" . $prog->get('id') . "\" image=\"" . $config['rootUrl'] . "/static/listen.gif\" type=\"audiostream\" bitrate=\"" . $f['bitrate'] . "\" format=\"" . $f['format'] . "\" />"; } if ($f['download_access'] = 't') { #$rss .= "\n<sotf:mediafileitem>"; #writeTag($rss, "sotf:mediafileurl", $config['rootUrl']."/getFile.php/".$f['filename']."?audio=1&id=".$prog->get('id')."&filename=".$f['filename']); #writeTag($rss, "sotf:mediafileimage", $config['rootUrl']."/static/download.gif"); #writeTag($rss, "sotf:mediafiletype", "audio"); #writeTag($rss, "sotf:mediafilebitrate", $f['bitrate']); #writeTag($rss, "sotf:mediafileformat", $f['format']); #$rss .= "\n</sotf:mediafileitem>"; $rss .= "\n<sotf:mediafileitem url=\"" . $config['rootUrl'] . "/getFile.php/fid__" . $f['id'] . "\" image=\"" . $config['rootUrl'] . "/static/download.gif\" type=\"audiofile\" bitrate=\"" . $f['bitrate'] . "\" format=\"" . $f['format'] . "\" />"; } } $rss .= "\n</sotf:mediafiles>"; } $rss .= "\n</item>"; }
$row["f_table_abstract"] .= " CAN'T PROJECT LAYER"; makeExceptionReport($postgisObject->PDOerror); } $row2 = $postgisObject->fetchRow($result2); writeTag("open", null, "LatLongBoundingBox", array("minx" => $row2['txmin'], "miny" => $row2['tymin'], "maxx" => $row2['txmax'], "maxy" => $row2['tymax']), True, False); writeTag("close", null, "LatLongBoundingBox", null, False, True); } writeTag("open", null, "Abstract", null, True, False); echo $row["f_table_abstract"]; writeTag("close", null, "Abstract", null, False, True); $depth--; writeTag("close", null, "FeatureType", null, True, True); } } $depth--; writeTag("close", null, "FeatureTypeList", null, True, True); ?> <ogc:Filter_Capabilities> <ogc:Spatial_Capabilities> <ogc:Spatial_Operators> <ogc:Disjoint/> <ogc:Equals/> <ogc:DWithin/> <ogc:Beyond/> <ogc:Intersect/> <ogc:Touches/> <ogc:Crosses/> <ogc:Within/> <ogc:Contains/> <ogc:Overlaps/> <ogc:BBOX/>
/** * Write out all tags for any given entry.. * * @param array $entry */ function writeTags($tags, $oldtags, $code) { // Tags are separated by space(s) if (is_string($tags)) { if ($tags == '') { return; // Nothing to do } else { $tags = preg_split('/,?[ ]+/', $tags); } } // Loop through new tags, and add them.. if (is_array($tags) && count($tags) > 0) { foreach ($tags as $tag) { writeTag($tag, $code); makeRelatedTags($tag, $tags); } } // Loop through old tags, and delete them if they are no longer present. if (is_string($oldtags)) { if ($oldtags == '') { return; // Nothing to do } else { $oldtags = preg_split('/,?[ ]+/', $oldtags); } } if (is_array($oldtags) && count($oldtags) > 0) { foreach ($oldtags as $oldtag) { if (!in_array($oldtag, $tags)) { deleteTag($oldtag, $code); } } } }
function makeXML($pluginDir, $extras = array()) { if (substr($pluginDir, -1, 1) != '/') { $pluginDir .= '/'; } $sourceFile = $pluginDir . 'plugin.php'; $destFile = $pluginDir . 'plugin.xml'; $backFile = $pluginDir . 'plugin.bak'; $baseFolder = substr($pluginDir, 0, -1); // echo $baseFolder; $baseFolder = substr($baseFolder, strrpos($baseFolder, '/') + 1); // echo "Transcribing from {$sourceFile} to {$destFile}...<br />"; $adminText = ''; $mainPrefText = ''; $manageText = ''; $fileText = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n\n"; $fileText .= '<!-- $' . 'Id: plugin.xml,v 0.0 2008/06/26 20:44:10 e107steved Exp ' . '$ -' . "->\n\n"; // Split it to stop message getting edited when this file committed! if (!is_readable($sourceFile)) { return LAN_XMLGEN_10 . $sourceFile . "<br />"; } include_once $sourceFile; // Transcribe variables $fileText .= writeTagList('e107Plugin', array('name' => $eplug_name, 'version' => $eplug_version, 'compatibility' => '0.8', 'installRequired' => $extras['installationrequired'] ? 'true' : 'false'), FALSE); $fileText .= writeTagList('author', array('name' => $eplug_author, 'url' => $eplug_url, 'email' => $eplug_email), TRUE); $fileText .= writeTag('description', $eplug_description); $fileText .= writeTag('readMe', $eplug_readme); $fileText .= writeTag('folder', $baseFolder); if (isset($eplug_comment_ids) && is_array($eplug_comment_ids)) { foreach ($eplug_comment_ids as $cid) { if (is_numeric($cid)) { $cid = '***' . $baseFolder . $cid . '***'; } // Should be text - so draw attention to it $fileText .= writeTag('commentID', $cid); } } foreach ($extras as $k => $v) { if (in_array($k, array('copyright', 'update_url'))) { $fileText .= writeTag($k, $v); } } if (!varsettrue($extras['copyright'])) { $fileText .= writeTag('copyright', 'Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)'); } $baseFolder .= '/'; // 'commentID' tags needed $adminText .= writeTag('configFile', $eplug_conffile, 2); $adminText .= writeTag('icon', str_replace($baseFolder, '', $eplug_icon), 2); $adminText .= writeTag('iconSmall', str_replace($baseFolder, '', $eplug_icon_small), 2); $adminText .= writeTag('caption', $eplug_caption, 2); $adminText .= writeTag('installDone', $eplug_done, 2); $fileText .= writeTag('administration', "\n" . $adminText . TAB_CHAR); if (varsettrue($eplug_link) && varsettrue($eplug_link_name) && varsettrue($eplug_link_url)) { $fileText .= TAB_CHAR . '<menuLink name="' . $eplug_link_name . '" url="' . str_replace(e_PLUGIN, '', $eplug_link_url) . '" />' . "\n"; } // Could add more menuLink options $fileText .= writeTag('mainPrefs', "\n" . listPrefs($eplug_prefs, varset($eplug_array_pref, '')) . TAB_CHAR); // Could add userclasses // Management section $temp = ''; foreach ($extras as $k => $v) { if (in_array($k, array('install', 'uninstall', 'upgrade'))) { $temp1 = ''; foreach (array('when', 'type', 'file', 'class', 'function') as $t) { if (isset($v[$t])) { $temp1 .= ' ' . $t . '="' . $v[$t] . '"'; } } if ($temp1) { $temp .= TAB_CHAR . TAB_CHAR . '<' . $k . $temp1 . ' />' . "\n"; } } } if ($temp) { // Only add management section if something to add $fileText .= TAB_CHAR . "<management>\n" . $temp . TAB_CHAR . "</management>\n"; } $fileText .= "</e107Plugin>"; // All assembled - write file if (is_readable($backFile)) { // Delete any existing backup if (!unlink($backFile)) { return LAN_XMLGEN_16; } } if (is_readable($destFile)) { // Rename existing plugin.xml if (!rename($destFile, $backFile)) { return LAN_XMLGEN_15; } } if (($fh = fopen($destFile, 'wt')) === FALSE) { return LAN_XMLGEN_09 . $destFile . "<br />"; } if (fwrite($fh, $fileText) == FALSE) { return LAN_XMLGEN_08 . $destFile . "<br />"; } fclose($handle); return LAN_XMLGEN_07; // Return success }