function mod_roster($r, $n, $us = "us", $size = "100%") { $error = ''; if (empty($r) || empty($n) || empty($us)) { echo 'Missing guild realm/name/or locale (us/eu).'; return; } $r = stripslashes(str_replace(' ', '+', $r)); $n = stripslashes(str_replace(' ', '+', $n)); if (strtolower($us) == "us") { $us = "www"; } else { $us = "eu"; } $output = readXML('http://' . $us . '.wowarmory.com/guild-info.xml?r=' . $r . '&n=' . $n); if (strpos($output, "<guildInfo/>") !== false) { echo 'Incorrect guild realm/name/or locale (us/eu).'; return; } groupHead("<b>Roster</b>", $size); /* echo '<textarea rows="12" cols="128" style="font-size: 11px;">'; echo htmlspecialchars($output); echo '</textarea>'; */ echo '<table cellpadding="0" cellspacing="0" border="0" width="100%">'; $pos = 0; $guildName = ''; while (true) { $thisElem = readElement($output, $pos); if ($thisElem == false) { break; } else { $element = readAttribs($thisElem[0]); if ($element[0] == 'character') { //echo "<br />Element: [".$element[0]." | Name: ".$element['name'].", Gender: ".$element['gender'].", Race: ".$element['race'].", Class: ".$element['class']."]"; $pic = strtolower($element['gender']) . '-' . strtolower(str_replace(' ', '', $element['race'])); $pic2 = strtolower($element['class']); echo '<tr><td align="left" height="24"><a href="http://www.wowarmory.com/character-sheet.xml?' . $element['url'] . '" class="classCol' . $element['class'] . '">' . '<img src="../images/icons/race/' . $pic . '.gif" border="0" width="18" height="18" />' . '<img src="../images/icons/class/' . $pic2 . '.gif" border="0" alt="' . $pic2 . '" /> [<b>' . $element['level'] . '</b>] ' . $element['name'] . '</a></td><td align="right"><u>Rank ' . $element['rank'] . '</u></td></tr>'; } $pos = $thisElem[1]; } } echo '</table>'; groupFoot(); }
function readBackground() { // Read the background configuration XML $background_data = readXML('conf', 'background'); // Get the default values $background_default = defaultBackground(); // Stored data array $background_conf = array(); // Read the stored values if ($background_data) { // Initialize the background configuration XML data $background_xml = new SimpleXMLElement($background_data); // Loop the notice configuration elements foreach ($background_xml->children() as $background_child) { $background_conf[$background_child->getName()] = $background_child; } } // Checks no value is missing in the stored configuration foreach ($background_default as $background_name => $background_value) { if (!isset($background_conf[$background_name]) || empty($background_conf[$background_name])) { $background_conf[$background_name] = $background_default[$background_name]; } } return $background_conf; }
This is the main configuration reader ------------------------------------------------- License: AGPL Author: Vanaryon Last revision: 26/08/11 */ // Someone is trying to hack us? if (!defined('JAPPIX_BASE')) { exit; } // Define the default main configuration values $main_conf = array('name' => 'Jappix', 'desc' => 'a free social network', 'resource' => 'Jappix', 'lock' => 'on', 'anonymous' => 'on', 'registration' => 'on', 'bosh_proxy' => 'on', 'manager_link' => 'on', 'groupchats_join' => '', 'encryption' => 'on', 'https_storage' => 'off', 'https_force' => 'off', 'compression' => 'off', 'multi_files' => 'off', 'developer' => 'off'); // Define a default values array $main_default = $main_conf; // Read the main configuration file $main_data = readXML('conf', 'main'); // Read the main configuration file if ($main_data) { // Initialize the main configuration XML data $main_xml = new SimpleXMLElement($main_data); // Loop the main configuration elements foreach ($main_xml->children() as $main_child) { $main_value = $main_child->getName(); // Only push this to the array if it exists if (isset($main_conf[$main_value]) && $main_child) { $main_conf[$main_value] = $main_child; } } } // Finally, define the main configuration globals define('SERVICE_NAME', $main_conf['name']);
function setBackground($string) { // Get the default values $array = defaultBackground(); // Read the background configuration $xml = readXML('conf', 'background'); if ($xml) { $read = new SimpleXMLElement($xml); foreach ($read->children() as $child) { $current_child = (string) $child; // Any value? if ($current_child) { $array[$child->getName()] = $current_child; } } } $css = ''; // Generate the CSS code switch ($array['type']) { // Image case 'image': $css .= "\n" . ' background-image: url(../store/backgrounds/' . urlencode($array['image_file']) . '); background-repeat: ' . $array['image_repeat'] . '; background-position: ' . $array['image_horizontal'] . ' ' . $array['image_vertical'] . '; background-color: ' . $array['image_color'] . ';'; // Add CSS code to adapt the image? if ($array['image_adapt'] == 'on') { $css .= ' background-attachment: fixed; background-size: cover; -moz-background-size: cover; -webkit-background-size: cover;'; } $css .= "\n"; break; // Color // Color case 'color': $css .= "\n" . ' background-color: ' . $array['color_color'] . ';' . "\n"; break; // Default: use the filtering regex // Default: use the filtering regex default: $css .= '$3'; break; } // Apply the replacement! return preg_replace('/(\\.body-images( )?\\{)([^\\{\\}]+)(\\})/i', '$1' . $css . '$4', $string); }
} // Get the HTTP host $http_host = 'jappix.com'; if ($_SERVER['HTTP_HOST']) { $http_host_split = str_replace('www.', '', $_SERVER['HTTP_HOST']); $http_host_split = preg_replace('/:[0-9]+$/i', '', $http_host_split); if ($http_host_split) { $http_host = $http_host_split; } } // Define the default hosts configuration values $hosts_conf = array('main' => $http_host, 'muc' => 'muc.' . $http_host, 'pubsub' => 'pubsub.' . $http_host, 'vjud' => 'vjud.' . $http_host, 'anonymous' => 'anonymous.' . $http_host, 'bosh' => 'http://' . $http_host . ':5280/http-bind', 'bosh_main' => '', 'bosh_mini' => '', 'static' => '', 'upload' => ''); // Define a default values array $hosts_default = $hosts_conf; // Read the hosts configuration file $hosts_data = readXML('conf', 'hosts'); // Read the hosts configuration file if ($hosts_data) { // Initialize the hosts configuration XML data $hosts_xml = new SimpleXMLElement($hosts_data); // Loop the hosts configuration elements foreach ($hosts_xml->children() as $hosts_child) { $hosts_value = $hosts_child->getName(); // Only push this to the array if it exists if (isset($hosts_conf[$hosts_value]) && $hosts_child) { $hosts_conf[$hosts_value] = str_replace('{PROTOCOL}', $protocol, $hosts_child); } } } // Finally, define the hosts configuration globals define('HOST_MAIN', $hosts_conf['main']);
function getUsers() { // Try to read the XML file $data = readXML('conf', 'users'); $array = array(); // Any data? if ($data) { $read = new SimpleXMLElement($data); // Check the submitted user exists foreach ($read->children() as $child) { // Get the node attributes $attributes = $child->attributes(); // Push the attributes to the global array (converted into strings) $array[$attributes['name'] . ''] = $attributes['password'] . ''; } } return $array; }
print "<h2 class=\"title\">" . $menuOrder[$k] . "</h2>\n"; } /* print "<p style=font-size:10px>"; echo '<span style="color:red">'; print "<a href=$file target=_blank style=color:red;>debug</a></span></p>\n"; */ //print "<blockquote>"; readXML($reader, $k, $validHTML, $openTag, $hrefTag, $docroot); //print "</blockquote>"; if ($k == "scope_content") { $thisFile = str_replace($k, "dsc_sc", $file); //print "<p style=font-size:10px;><span style=color:red><a href=$thisFile target=_blank style=color:red;>debug</a></span></p>\n"; $dscReader = new XMLReader(); $dscReader->open($thisFile); readXML($dscReader, "dsc_sc", $validHTML, $openTag, $hrefTag, $docroot); $dscReader->close(); } //echo '<p class="top"><a href="#top">Return to top</a></p>'; } $reader->close(); $firstSection = $k; } } else { $validHTML = array('p' => 'p', 'ul' => 'ul', 'li' => 'li', 'head' => 'h2', 'title' => 'em'); $file = $appurl . "?doc=" . $doc . "_ead.xml§ion="; $file .= $section; $reader = new XMLReader(); $reader->open($file); readDSC($reader, $section, $validHTML, $openTag, $hrefTag); }
if ($env != "") { $debug = '<p style="font-size:10px;"><a href="' . $file . '" target="_blank" style="color:red;">debug</a></p>'; } if ($k == "summary") { print "<h2>Summary Information</h2>\n"; echo $debug; $summary = readSummary($reader, $summary); writeSummary($summary); echo '<br clear="all" />'; } else { echo '<a name="' . $k . '"></a>'; //if ($k != "arrangement") print "<h2>" . $menuOrder[$k] . "</h2>\n"; echo $debug; print "<blockquote>"; readXML($reader, $k, $validHTML, $openTag, $hrefTag, $docroot); print "</blockquote>"; /* if ($k == "scope_content") { $thisFile = str_replace($k,"dsc_sc",$file); print "<p style=font-size:10px;><span style=color:red><a href=$thisFile target=_blank style=color:red;>debug</a></span></p>\n"; $dscReader = new XMLReader(); $dscReader->open($thisFile); readXML($dscReader, "dsc_sc", $validHTML, $openTag, $hrefTag,$docroot); $dscReader->close(); } */ echo '<p class="top"><a href="#top">Return to top</a></p>'; } $reader->close(); $firstSection = $k;
$img['id'] = $data; $arr[] = $img; } else { $arr[] = array('error' => 1, 'message' => IMAGE_ERROR_MOVING); } } else { $arr[] = array('error' => 1, 'message' => IMAGE_LIMIT_SIZE); } } else { if ($ext == 'xml') { $i++; $newName = time() + $i; $newName = $newName . '.' . $ext; $file = IMAGE_UPLOAD_URL_TEMP . $newName; if (move_uploaded_file($_FILES['photos']['tmp_name'][$name], $file)) { $data = readXML($file, $table, $table_id); $arr[] = array('error' => 0, 'message' => 'Upload thành công', 'img' => 'xml.png', 'img_url_thumb' => 'themes/website/img/', 'img_url' => CONS_BASE_URL . '/themes/website/img/'); unlink($file); } else { $arr[] = array('error' => 1, 'message' => IMAGE_ERROR_MOVING); } } else { $arr[] = array('error' => 1, 'message' => 'Unknown extension!'); } } } //end foreach echo json_encode($arr); return true; } if (isset($_POST['uploadWebPicture'])) {
for ($i = 0; $i < count($fileList); $i++) { echo $fileList[$i] . '<br/>'; } /** * 在数据库中读取路径 */ //假设$userId为1 $userId = 1; //指定用户下的xml列表 $xmlList = array(); try { $array = array($userId); $sql = "select xmlPath from xmls where xmls.userId = ?"; $result = sqlQuery($sql, $array); foreach ($result as $row) { //将xmlPath存起来 $xmlList[] = $row['xmlPath']; } $dbh = null; } catch (PDOException $e) { die("Error!: " . $e->getMessage() . "<br/>"); } foreach ($xmlList as $xml) { //判断该文件路径在sampleXML中是否存在 if (in_array($xml, $fileList)) { echo $xml; readXML($xml); } else { echo "无此文件<br/>"; } }
echo '</body>'; echo '</html>'; exit; } // Determine page selection ---------------------------------------------------------- if ($lg == 1) { echo "<h3>IP Tracking Interface</h3>"; $filename = '../data/message_post.xml'; echo "\n <div class='gbookAdminRecordBanner'></div>\n <div class='gbookAdminRecord'>"; readXML($filename); echo "</div>"; } elseif ($lg == 2) { echo "<h3>Spammer Tracking Interface</h3>"; $filename = '../data/message_spam.xml'; echo "\n\t\t<div class='gbookAdminRecordBanner'></div>\n\t\t<div class='gbookAdminRecord'>"; readXML($filename); echo "</div>"; } elseif ($lg == 3) { echo '<h3>Current Guestbook Settings</h3>'; echo '<p>Note: To change any of the values below, simply open the file <em>config.php</em> in notepad<br /> and changes the corresponding value to "1" to "0" depending on your selection.</p>'; echo "\n\t\t<div class='gbookAdminRecordBanner'></div>\n\t\t<div class='gbookAdminRecord'>"; echo '<table width="500">'; echo '<tr><th>Setting</th><th>Option Selected</th></tr>'; echo '<tr><td>Guestbook Version</td><td>' . $gb_system_version . '</td></tr>'; echo '<tr><td>Email Field Optional</td><td>'; //colour font blue if ($email_optional == 1) { echo 'Yes'; } else { echo 'No'; }
$db = $conn->dg; $collection = $db->last_update; $last_update = $collection->find()->limit(1)->sort(["received_at" => -1]); foreach ($last_update as $last) { $last_update_entry = $last; $received_date = strtotime($last_update_entry['received_at']); } $date_now = strtotime(date("Y-m-d H:i:s")); if ($last_update->count() == 0 || $date_now - $received_date > ACTUAL_FILE_TIME) { $date = date("d/m/Y"); // Сегодняшняя дата в необходимом формате $link = "http://www.cbr.ru/scripts/XML_daily.asp?date_req={$date}"; // Ссылка на XML-файл с курсами валют $content = file_get_contents($link); // Скачиваем содержимое страницы $response_cbrf = readXML($link); $response_cbrf['RUB'] = ["Nominal" => 1, "Name" => "Российский рубль", "Value" => 1]; $query = array('received_at' => date("Y-m-d H:i:s"), 'response_cbrf' => $response_cbrf); $collection->insert($query); } else { $response_cbrf = $last_update_entry['response_cbrf']; } $conn->close(); } catch (MongoConnectionException $e) { die('Error connecting to MongoDB server' . $e->getMessage()); } catch (MongoException $e) { die('Error: ' . $e->getMessage()); } $costUsd = $_GET['costusd']; $currency = $_GET['currency']; $costRub = $costUsd * $response_cbrf['USD']['Value'] / $response_cbrf['USD']['Nominal'];