$stylesheet = $_REQUEST['styleURL']; $user = $_SESSION['valid_user']; $name = $_REQUEST['styleName']; $query = "INSERT INTO stylesheets(name,creator,url) VALUES ('" . $name . "','" . $user . "','" . $stylesheet . "');"; //$query = "UPDATE user SET stylesheet='". $stylesheet . "' WHERE username='******'"; echo $query; return insertRow($query); } session_start(); $action = $_REQUEST['do']; if ($action == "fetch") { echo "success"; getList(); } else { if ($action == "add") { if (addStyle()) { echo "success"; getList(); } else { echo "failure"; } } else { if ($action == "setStyle") { if (setStyle() == null) { echo "failure"; } else { echo "success"; } } else { if ($action == "delStyle") { if (delStyle() == null) {
function addLabel($mslabel) { ?> LABEL ALIGN <?php echo $mslabel->align . PHP_EOL; ?> ANGLE <?php echo $mslabel->angle . PHP_EOL; ?> ANTIALIAS <?php echo $mslabel->antialias . PHP_EOL; ?> BUFFER <?php echo $mslabel->buffer . PHP_EOL; ?> COLOR <?php echo $mslabel->color . PHP_EOL; ?> ENCODING '<?php echo $mslabel->encoding; ?> ' FONT '<?php echo $mslabel->font; ?> ' FORCE <?php echo $mslabel->force . PHP_EOL; ?> MAXLENGTH <?php echo $mslabel->maxlength . PHP_EOL; ?> # Incompatible with # MAXOVERLAPANGLE <?php echo $mslabel->maxoverlapangle . PHP_EOL; ?> MAXSIZE <?php echo $mslabel->maxsize . PHP_EOL; ?> MINDISTANCE <?php echo $mslabel->mindistance . PHP_EOL; ?> MINFEATURESIZE <?php echo $mslabel->minfeaturesize . PHP_EOL; ?> MINSIZE <?php echo $mslabel->minsize . PHP_EOL; ?> OFFSET <?php echo $mslabel->offset . PHP_EOL; ?> <?php if (!empty($mslabel->outlinecolor)) { ?> OUTLINECOLOR <?php echo $mslabel->outlinecolor . PHP_EOL; ?> OUTLINEWIDTH <?php echo $mslabel->outlinewidth . PHP_EOL; } ?> PARTIALS <?php echo $mslabel->partials . PHP_EOL; ?> POSITION <?php echo $mslabel->position . PHP_EOL; ?> PRIORITY <?php echo $mslabel->priority . PHP_EOL; ?> <?php if ($mslabel->repeatdistance) { ?> REPEATDISTANCE <?php echo $mslabel->repeatdistance; } echo PHP_EOL; ?> <?php if ($mslabel->shadowcolor) { ?> SHADOWCOLOR '<?php echo $mslabel->shadowcolor; ?> '<?php } ?> <?php if ($mslabel->shadowsize) { ?> SHADOWSIZE <?php echo $mslabel->shadowsize; } echo PHP_EOL; ?> SIZE <?php echo $mslabel->size . PHP_EOL; ?> TYPE <?php echo $mslabel->type . PHP_EOL; ?> <?php if ($mslabel->wrap) { ?> WRAP '<?php echo $mslabel->wrap; ?> '<?php } ?> <?php if ($msstyle = $mslabel->style) { addStyle($private_data_path, $msstyle); } ?> END <?php }
$xml->writeAttribute("xmlns", "http://earth.google.com/kml/2.1"); $xml->setIndent(true); $xml->startElement("Document"); $xml->writeElement("name", $trackname); // line style $xml->startElement("Style"); $xml->writeAttribute("id", "lineStyle"); $xml->startElement("LineStyle"); $xml->writeElement("color", "7f0000ff"); $xml->writeElement("width", "4"); $xml->endElement(); $xml->endElement(); // marker styles addStyle($xml, "red", "http://maps.google.com/mapfiles/markerA.png"); addStyle($xml, "green", "http://maps.google.com/mapfiles/marker_greenB.png"); addStyle($xml, "gray", "http://labs.google.com/ridefinder/images/mm_20_gray.png"); $style = "#redStyle"; // for first element $i = 0; $totalMeters = 0; $totalSeconds = 0; while ($query->fetch()) { $distance = isset($prev_latitude) ? haversine_distance($prev_latitude, $prev_longitude, $latitude, $longitude) : 0; $prev_latitude = $latitude; $prev_longitude = $longitude; $seconds = isset($prev_dateoccured) ? strtotime($dateoccured) - strtotime($prev_dateoccured) : 0; $prev_dateoccured = $dateoccured; $totalMeters += $distance; $totalSeconds += $seconds; if (++$i == $query->num_rows) { $style = "#greenStyle";
function processGuestsArray($activities, $nicknames) { asort($nicknames, SORT_STRING); $localGuest = ""; $localTimeStamp = 0; $_SESSION['chat_guests'] = isset($_SESSION['chat_guests']) ? array_unique($_SESSION['chat_guests']) : array(); $returnedArray = array(); foreach ($nicknames as $key => $localGuest) { $addLine = ""; $localTimeStamp = $activities[$key]; if ($localTimeStamp == "") { $offset = SLEEP_DELAY; } else { $offset = abs(UNIX_TIME_STAMP - $localTimeStamp); } if ($offset <= SLEEP_DELAY) { if (!in_array($localGuest, $_SESSION['chat_guests'])) { $addLine = "+ " . addStyle($localGuest, "entering_username"); $_SESSION['chat_guests'][] = $localGuest; } else { if ($localGuest == $_SESSION['user_nickname']) { $usernameStyle = "username_myself"; } else { $usernameStyle = "username"; } $addLine = addStyle($localGuest, $usernameStyle); } } elseif (in_array($localGuest, $_SESSION['chat_guests'])) { if ($localGuest != $_SESSION['user_nickname']) { $addLine = "- " . addStyle($localGuest, "leaving_username"); } unset($_SESSION['chat_guests'][array_search($localGuest, $_SESSION['chat_guests'])]); } if ($addLine != "") { $returnedArray[count($returnedArray)] = $addLine; } } return $returnedArray; }
<?php include_once 'functions.php'; ?> <html> <head> <?php echo addStyle('css/style.css'); ?> <?php echo addScript('js/script.js'); ?> </head> <body> <p>Hello</p> </body> </html>