public function get_web_log() { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "web_request_spk.xml"); $sql_from_xml = $xml->getNode("web_log"); $sqlselect = str_replace("FILTER_BY_PROGRAM", "", $sql_from_xml); //Run the SQL query $result = mssql_query($sqlselect); $numfields = mssql_num_fields($result); $string_result = ""; while ($row = mssql_fetch_row($result)) { $string_result .= "<tr>"; for ($i = 0; $i < $numfields; $i++) { if (mssql_field_name($result, $i) == "IP_ADDRESS") { $ip = explode(":", $row[$i]); $string_result .= "<td>" . $ip[0] . "</td>"; $string_result .= "<td>" . $ip[1] . "</td>"; } else { $string_result .= "<td>" . $row[$i] . "</td>"; } } $string_result .= "</tr>"; } return $string_result; }
/** * @param String $url * @param int $id * @return Photo[] */ public static function getPhotos($url) { $xh = new XMLHandler($url); $photoItems = $xh->getNodes("photo"); $photoList = array(); foreach ($photoItems as $photoNode) { $p = new Photo(); $p->setId($photoNode->getElementsByTagName("id")->item(0)->textContent); $p->setAlt($photoNode->getElementsByTagName("htmlAlt")->item(0)->textContent); $p->setOrientation($photoNode->getElementsByTagName("orientation")->item(0)->textContent); //set thumbnail pic and large pic $photoInstancesNode = $photoNode->getElementsByTagName("instance"); foreach ($photoInstancesNode as $pi) { $type = $pi->getElementsByTagName("type")->item(0)->textContent; /* @var $pi DomElement */ if ($type == "Thumbnail") { $p->getThumb()->parsePhotoInstance($pi); } elseif ($type == "Large") { $p->getLarge()->parsePhotoInstance($pi); } elseif ($type == "HighRes") { $p->getHiRes()->parsePhotoInstance($pi); } elseif ($type == "Custom") { $p->getCustom()->parsePhotoInstance($pi); } } $photoList[] = $p; } return $photoList; }
public function get_userinfo($userid, $password) { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $sqlselect = "SELECT userid,password,userright,ws,ws_name,location,fullname,gender,position,member_since,avatar FROM pospass WITH (NOLOCK) WHERE userid ='" . $userid . "';"; //Run the SQL query $sqlquery = mssql_query($sqlselect); $string_result = '{"uservalidation":"false"}'; //$login = new Blowfish(); //$encpassword = $login->genpwd($password); $encpassword = $this->encryptIt($password); while ($result = mssql_fetch_array($sqlquery)) { //$verify = $login->verify_hash($password, $result["password"]); if ($encpassword == $result["password"]) { $xml = new XMLHandler(LOCAL_DIR . "/etc/greenSys.config.xml"); $_SESSION["activedb"] = (string) $xml->Child("locationmapping", $result["location"]); $_SESSION["user-id"] = (string) $userid; $_SESSION["user-ws"] = (string) $result["ws"]; $_SESSION["ws-name"] = (string) $result["ws_name"]; $_SESSION["user-fullname"] = (string) $result["fullname"]; $_SESSION["user-gender"] = (string) $result["gender"]; $_SESSION["user-position"] = (string) $result["position"]; $_SESSION["user-member_since"] = (string) $result["member_since"]; $_SESSION["user-avatar"] = (string) $result["avatar"]; //session_write_close(); //setcookie("user-id",(string)$userid, time()+3600*24); $string_result = '{"uservalidation":"true","fullname":"' . $result["fullname"] . '","gender":"' . $result["gender"] . '","position":"' . $result["position"] . '","member_since":"' . $result["member_since"] . '","avatar":"' . $result["avatar"] . '"}'; } } return $string_result; }
public function __construct($API_KEY, $apiUrl) { $this->API_KEY = $API_KEY; $trimmedUrl = rtrim($apiUrl, "/"); $this->apiUrl = $trimmedUrl . "/"; $xh = new XMLHandler($this->getFeedUrl()); $this->newsUrl = $xh->getHrefValue("news"); $this->categoryUrl = $xh->getHrefValue("categoryDefinitions"); $this->commentUrl = $xh->getHrefValue("comments"); $this->feedName = $xh->getValue("name"); }
public function __construct($API_KEY, $apiUrl) { $this->API_KEY = $API_KEY; $trimmedUrl = rtrim($apiUrl, "/"); $this->apiUrl = $trimmedUrl . "/"; //JLog::add('load api handler.', JLog::INFO, 'com_braftonarticles'); $xh = new XMLHandler($this->getFeedUrl()); $this->newsUrl = $xh->getHrefValue("news"); $this->categoryUrl = $xh->getHrefValue("categoryDefinitions"); $this->commentUrl = $xh->getHrefValue("comments"); $this->feedName = $xh->getValue("name"); }
/** * @param String $url * @return array[int]Category */ public static function getCategories($url) { $xh = new XMLHandler($url); $nl = $xh->getNodes("category"); $catList = array(); foreach ($nl as $n) { $c = new NewsCategory(); $c->id = $n->getElementsByTagName("id")->item(0)->textContent; $c->name = $n->getElementsByTagName("name")->item(0)->textContent; $catList[] = $c; } return $catList; }
/** * @param String $url * @return array[int]Category */ public static function getCategories($url) { $xh = new XMLHandler($url); $nl = $xh->getNodes("category"); $catList = array(); foreach ($nl as $n) { $c = new NewsCategory(); $c->id = $n->getElementsByTagName("id")->item(0)->textContent; $c->name = $n->getElementsByTagName("name")->item(0)->textContent; //JLog::add('category name:'. $c->name, JLog::INFO, 'com_braftonarticles'); $catList[] = $c; } return $catList; }
/** * @param string $url * @param int $id * @return Comment[] */ public static function getComments($url) { $xh = new XMLHandler($url); $nl = $xh->getNodes("commentListItem"); $commentList = array(); foreach ($nl as $n) { $c = new NewsComment(); $c->setID($n->getElementsByTagName("id")->item(0)->textContent); $c->setLocation($n->getElementsByTagName("location")->item(0)->textContent); $c->setUser($n->getElementsByTagName("name")->item(0)->textContent); $c->setCommentTxt($n->getElementsByTagName("text")->item(0)->textContent); $c->setPostDate($n->getElementsByTagName("postDate")->item(0)->textContent); $commentList[] = $c; } return $commentList; }
public function LoadSettings() { try { $xml = new XMLHandler(LOCAL_DIR . "/etc/greenSys.config.xml"); $this->dbhost = $xml->Child("database", "dbhost"); $this->dbuser = $xml->Child("database", "dbuser"); $this->dbpass = $xml->Child("database", "dbpass"); $this->dbname = $xml->Child("database", "dbname"); /*if(isset($_SESSION["activedb"])){ $this->dbname =$_SESSION["activedb"]; }*/ } catch (Exception $e) { $title = "ERROR IN CLASS: " . get_class($this); $test = new MsgBox($title, $e->getMessage()); $this->content .= $test->Show(); } }
public function render_user_menu($userid) { try { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "web_request_global.xml"); $sql_from_xml = $xml->getNode("selectedmenu"); $sqlselect = str_replace("FILTER_BY_PROGRAM", " WHERE USERID='{$userid}' ", $sql_from_xml); //Run the SQL query $sqlquery = mssql_query($sqlselect); $string_result = ""; $createChild = false; while ($result = mssql_fetch_array($sqlquery)) { if ($result["HAS_CHILD"] == "1") { if ($createChild) { $string_result .= '</ul>'; $string_result .= '</li>'; } $string_result .= '<li class="treeview{activeclass}">'; $string_result .= ' <a href="#"><i class="' . $result["MENU_CLASS"] . '"></i> <span>' . $result["MENU_DESCRIPTION"] . '</span> <i class="fa fa-angle-left pull-right"></i></a>'; $string_result .= ' <ul class="treeview-menu">'; $createChild = true; } else { $aciveclass = ""; $aciveclassforparent = ""; if ($result["URL_TARGET"] == $_GET['app']) { $aciveclass = ' class="active"'; $aciveclassforparent = " active"; } $string_result = str_replace("{activeclass}", $aciveclassforparent, $string_result); $string_result .= '<li' . $aciveclass . '><a href="' . $result["URL_TARGET"] . '"><i class="' . $result["MENU_CLASS"] . '"></i>' . $result["MENU_DESCRIPTION"] . '</a></li>'; } } if ($createChild) { $string_result .= '</ul>'; $string_result .= '</li>'; } return $string_result; } catch (Exception $e) { throw new Exception($e->getMessage()); } }
public function get_unit_rfs() { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "web_request_spk.xml"); $sql_from_xml = $xml->getNode("rfs"); $sqlselect = str_replace("FILTER_BY_PROGRAM", "", $sql_from_xml); //Run the SQL query $result = mssql_query($sqlselect); $numfields = mssql_num_fields($result); $string_result = ""; while ($row = mssql_fetch_row($result)) { $string_result .= "<tr>"; for ($i = 0; $i < $numfields; $i++) { $string_result .= "<td>" . $row[$i] . "</td>"; } $string_result .= "</tr>"; } return $string_result; }
} if (defined('load_items_class')) { if (!@(include 'classes/class.items.php')) { die('<b>Error:</b> can not load items class!'); } $items = new Items(); } if (defined('load_mangos_class')) { if (!@(include 'classes/class.mangos.php')) { die('<b>Error:</b> can not load Mangos class!'); } $mangos = new Mangos(); } if (defined('load_arenateams_class')) { if (!@(include 'classes/class.arenateams.php')) { die('<b>Error:</b> can not load arenateams class!'); } $arenateams = new Arenateams(); } if (defined('load_search_class')) { if (!@(include 'classes/class.search.php')) { die('<b>Error:</b> can not load search engine class!'); } $search = new SearchMgr(); } // start XML parser if (!@(include 'classes/class.xmlhandler.php')) { die('<b>Error:</b> can not load XML handler class!'); } $xml = new XMLHandler($armory->_locale); $xml->StartXML();
/** * @param String $element * @return String */ public static function getSetting($element) { $xh = new XMLHandler("../Classes/settings.xml"); return $xh->getValue($element); }
public function salesstatistik_summary($filterby) { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "web_request_spk.xml"); $sql_from_xml = $xml->getNode("salesstatistik_summary"); $sqlselect = str_replace("FILTER_BY_PROGRAM", "year(getdate()),'" . $_SESSION["user-ws"] . "'", $sql_from_xml); $sqlselect = $sqlselect . " WHERE TIPE='" . $filterby . "' "; //Run the SQL query $result = mssql_query($sqlselect); //$numfields = mssql_num_fields($result); $jsonString = "["; $fieldsCollection = ""; $counter = 0; while ($row = mssql_fetch_row($result)) { if ($fieldsCollection != "") { $fieldsCollection .= ","; } $fieldsCollection .= (string) $row[2]; $counter++; } for ($i = $counter; $i < 6; $i++) { if ($fieldsCollection != "") { $fieldsCollection .= ","; } $fieldsCollection .= 0; } $jsonString .= $fieldsCollection . "]"; return $jsonString; }
public function run_inquirydetail($criteria) { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "inquiry.xml"); $sql_from_xml = $xml->getNode("inquiry"); $sqlselect = str_replace("FILTER_BY_PROGRAM", " WHERE SPK.NO_SPK = '" . $criteria . "' ", $sql_from_xml); //Run the SQL query $result = mssql_query($sqlselect); $numfields = mssql_num_fields($result); $string_result = ""; while ($row = mssql_fetch_row($result)) { for ($i = 0; $i < $numfields; $i++) { $fieldType = mssql_field_type($result, $i); if ($fieldType == "datetime") { if ($row[$i] != null) { $dateVal = strtotime($row[$i]); $string_result .= "<tr><th scope=\"row\">" . mssql_field_name($result, $i) . "</th><td>:</td><td>" . date('d-m-Y', $dateVal) . "</td></tr>"; } else { $string_result .= "<tr><th scope=\"row\">" . mssql_field_name($result, $i) . "</th><td>:</td><td>-</td></tr>"; } } else { if ($i == 0) { $string_result .= "<tr><th scope=\"row\">" . mssql_field_name($result, $i) . "</th><td>:</td><td>" . $row[$i] . " <a href='loadspk_" . $criteria . "'><button type=\"button\" class=\"btn btn-info btn-xs\">edit</button></a></td></tr>"; } else { $string_result .= "<tr><th scope=\"row\">" . mssql_field_name($result, $i) . "</th><td>:</td><td>" . $row[$i] . "</td></tr>"; } } } } $string_result .= "<tr><th scope=\"row\" colspan=3><a href='loadspk_" . $criteria . "'><button type=\"button\" class=\"btn btn-info\">edit mode</button></a></th></tr>"; return $string_result; }
private function CreateAdditionalItemTooltip($itemID, XMLHandler $xml, Characters $characters, $parent = false, $comparsion = false) { if (!$xml) { return false; } elseif ($parent == true && is_array($comparsion)) { return false; // both variables can't have 'true' value. } // Item comparsion mode $realm = false; if (is_array($comparsion) && isset($this->realmData[$comparsion['realm_id']])) { $realm = $this->realmData[$comparsion['realm_id']]; } $data = $this->wDB->selectRow("SELECT * FROM `item_template` WHERE `entry`=?", $itemID); if (!$data) { return false; } $isCharacter = $characters->CheckPlayer(); $xml->XMLWriter()->startElement('id'); $xml->XMLWriter()->text($itemID); $xml->XMLWriter()->endElement(); //id $xml->XMLWriter()->startElement('name'); if ($this->_locale == 'en_gb' || $this->_locale == 'en_us') { $xml->XMLWriter()->text($data['name']); } else { $xml->XMLWriter()->text(Items::getItemName($itemID)); } $xml->XMLWriter()->endElement(); //name $xml->XMLWriter()->startElement('icon'); $xml->XMLWriter()->text(Items::getItemIcon($itemID, $data['displayid'])); $xml->XMLWriter()->endElement(); //icon // 3.2.x heroic item flag if ($data['Flags'] == 8 || $data['Flags'] == 4104 && $data['itemset'] > 0) { $xml->XMLWriter()->startElement('heroic'); $xml->XMLWriter()->text(1); $xml->XMLWriter()->endElement(); //heroic } $xml->XMLWriter()->startElement('overallQualityId'); $xml->XMLWriter()->text($data['Quality']); $xml->XMLWriter()->endElement(); //overallQualityId $xml->XMLWriter()->startElement('bonding'); $xml->XMLWriter()->text($data['bonding']); $xml->XMLWriter()->endElement(); //bonding $xml->XMLWriter()->startElement('maxCount'); $xml->XMLWriter()->text($data['maxcount']); $xml->XMLWriter()->endElement(); //maxCount if ($data['startquest'] > 0) { $xml->XMLWriter()->startElement('startQuestId'); $xml->XMLWriter()->text($data['startquest']); $xml->XMLWriter()->endElement(); //startQuestId } $xml->XMLWriter()->startElement('classId'); $xml->XMLWriter()->text($data['class']); $xml->XMLWriter()->endElement(); //classId $xml->XMLWriter()->startElement('equipData'); $xml->XMLWriter()->startElement('inventoryType'); $xml->XMLWriter()->text($data['InventoryType']); $xml->XMLWriter()->endElement(); //inventoryType $xml->XMLWriter()->startElement('subclassName'); $xml->XMLWriter()->text(Items::GetItemSubTypeInfo($itemID, true, $data)); $xml->XMLWriter()->endElement(); //subclassName if ($data['class'] == ITEM_CLASS_CONTAINER) { $xml->XMLWriter()->startElement('containerSlots'); $xml->XMLWriter()->text($data['ContainerSlots']); $xml->XMLWriter()->endElement(); //containerSlots } $xml->XMLWriter()->endElement(); //equipData if ($data['class'] == ITEM_CLASS_WEAPON) { $xml->XMLWriter()->startElement('damageData'); $xml->XMLWriter()->startElement('damage'); $xml->XMLWriter()->startElement('type'); $xml->XMLWriter()->text('0'); $xml->XMLWriter()->endElement(); //type $xml->XMLWriter()->startElement('min'); $xml->XMLWriter()->text($data['dmg_min1']); $xml->XMLWriter()->endElement(); //min $xml->XMLWriter()->startElement('max'); $xml->XMLWriter()->text($data['dmg_max1']); $xml->XMLWriter()->endElement(); //max $xml->XMLWriter()->endElement(); //damage $xml->XMLWriter()->startElement('speed'); $xml->XMLWriter()->text(round($data['delay'] / 1000, 2)); $xml->XMLWriter()->endElement(); //speed $xml->XMLWriter()->startElement('dps'); $dps = null; for ($jj = 1; $jj <= 2; $jj++) { $d_type = $data['dmg_type' . $jj]; $d_min = $data['dmg_min' . $jj]; $d_max = $data['dmg_max' . $jj]; if ($d_max > 0 && $data['class'] != ITEM_CLASS_PROJECTILE) { $delay = $data['delay'] / 1000; if ($delay > 0) { $dps = $dps + round(($d_max + $d_min) / (2 * $delay), 1); } if ($jj > 1) { $delay = 0; } } } $xml->XMLWriter()->text($dps); $xml->XMLWriter()->endElement(); //dps $xml->XMLWriter()->endElement(); //damageData } if ($data['block'] > 0) { $xml->XMLWriter()->startElement('blockValue'); $xml->XMLWriter()->text($data['block']); $xml->XMLWriter()->endElement(); //blockValue } if ($data['fire_res'] > 0) { $xml->XMLWriter()->startElement('fireResist'); $xml->XMLWriter()->text($data['fire_res']); $xml->XMLWriter()->endElement(); //fireResist } if ($data['nature_res'] > 0) { $xml->XMLWriter()->startElement('natureResist'); $xml->XMLWriter()->text($data['nature_res']); $xml->XMLWriter()->endElement(); //natureResist } if ($data['frost_res'] > 0) { $xml->XMLWriter()->startElement('frostResist'); $xml->XMLWriter()->text($data['frost_res']); $xml->XMLWriter()->endElement(); //frostResist } if ($data['shadow_res'] > 0) { $xml->XMLWriter()->startElement('shadowResist'); $xml->XMLWriter()->text($data['shadow_res']); $xml->XMLWriter()->endElement(); //shadowResist } if ($data['arcane_res'] > 0) { $xml->XMLWriter()->startElement('arcaneResist'); $xml->XMLWriter()->text($data['arcane_res']); $xml->XMLWriter()->endElement(); //arcaneResist } for ($i = 1; $i < 11; $i++) { if ($data['stat_type' . $i] > 0 && $data['stat_value' . $i] > 0) { $bonus_template = Items::GetItemBonusTemplate($data['stat_type' . $i]); $xml->XMLWriter()->startElement($bonus_template); $xml->XMLWriter()->text($data['stat_value' . $i]); $xml->XMLWriter()->endElement(); } } $xml->XMLWriter()->startElement('armor'); if ($data['ArmorDamageModifier'] > 0) { $xml->XMLWriter()->writeAttribute('armorBonus', 1); } $xml->XMLWriter()->text($data['armor']); $xml->XMLWriter()->endElement(); //armor $ench_array = array(1 => 'head', 2 => 'neck', 3 => 'shoulder', 4 => 'shirt', 5 => 'chest', 6 => 'belt', 7 => 'legs', 8 => 'boots', 9 => 'wrist', 10 => 'gloves', 11 => 'ring1', 12 => 'trinket1', 13 => 'mainhand', 14 => 'offhand', 15 => 'relic', 16 => 'back', 17 => 'stave', 19 => 'tabard', 20 => 'chest', 21 => 'mainhand', 22 => '', 23 => 'offhand', 24 => '', 25 => 'thrown', 26 => 'gun', 28 => 'sigil'); if (isset($ench_array[$data['InventoryType']])) { $itemSlotName = $ench_array[$data['InventoryType']]; } else { $itemSlotName = false; } if (!$parent && $isCharacter && $itemSlotName) { $enchantment = $characters->getCharacterEnchant($itemSlotName, $characters->GetGUID()); if ($enchantment) { $xml->XMLWriter()->startElement('enchant'); $xml->XMLWriter()->text($this->aDB->selectCell("SELECT `text_" . $this->_locale . "` FROM `armory_enchantment` WHERE `id`=? LIMIT 1", $enchantment)); $xml->XMLWriter()->endElement(); //enchant } } // Random property if ($data['RandomProperty'] > 0 || $data['RandomSuffix'] > 0) { if (!$isCharacter) { $xml->XMLWriter()->startElement('randomEnchantData'); $xml->XMLWriter()->endElement(); //randomEnchantData } if ($itemSlotName) { $rPropInfo = Items::GetRandomPropertiesData($itemID, $characters->GetGUID(), $characters->GetEquippedItemGuidBySlot($itemSlotName)); } else { $rPropInfo = Items::GetRandomPropertiesData($itemID, $characters->GetGUID()); } if ($isCharacter && !$parent && is_array($rPropInfo)) { $xml->XMLWriter()->startElement('randomEnchantData'); $xml->XMLWriter()->startElement('suffix'); $xml->XMLWriter()->text($rPropInfo['suffix']); $xml->XMLWriter()->endElement(); //enchant if (is_array($rPropInfo['data'])) { foreach ($rPropInfo['data'] as $randProp) { $xml->XMLWriter()->startElement('enchant'); $xml->XMLWriter()->text($randProp); $xml->XMLWriter()->endElement(); //enchant } } $xml->XMLWriter()->endElement(); //randomEnchantData } } $xml->XMLWriter()->startElement('socketData'); $socket_data = false; $socketBonusCheck = array(); for ($i = 1; $i < 4; $i++) { if ($data['socketColor_' . $i] > 0) { switch ($data['socketColor_' . $i]) { case 1: $color = 'Meta'; $socket_data = array('color' => 'Meta'); $gem = Items::extractSocketInfo($characters->GetGUID(), $itemID, $i, $characters->GetEquippedItemGuidBySlot($itemSlotName)); if ($gem && !$parent) { $socket_data['enchant'] = $gem['enchant']; $socket_data['icon'] = $gem['icon']; $currentColor = $this->aDB->selectCell("SELECT `color` FROM `armory_gemproperties` WHERE `spellitemenchantement`=? LIMIT 1", $gem['enchant_id']); if ($currentColor == 1) { $socket_data['match'] = '1'; } } break; case 2: $socket_data = array('color' => 'Red'); $gem = Items::extractSocketInfo($characters->GetGUID(), $itemID, $i, $characters->GetEquippedItemGuidBySlot($itemSlotName)); if ($gem && !$parent) { $socket_data['enchant'] = $gem['enchant']; $socket_data['icon'] = $gem['icon']; $currentColor = $this->aDB->selectCell("SELECT `color` FROM `armory_gemproperties` WHERE `spellitemenchantement`=? LIMIT 1", $gem['enchant_id']); if ($currentColor == 6 || $currentColor == 10 || $currentColor == 14) { $socket_data['match'] = '1'; } } break; case 4: $socket_data = array('color' => 'Yellow'); $gem = Items::extractSocketInfo($characters->GetGUID(), $itemID, $i, $characters->GetEquippedItemGuidBySlot($itemSlotName)); if ($gem && !$parent) { $socket_data['enchant'] = $gem['enchant']; $socket_data['icon'] = $gem['icon']; $currentColor = $this->aDB->selectCell("SELECT `color` FROM `armory_gemproperties` WHERE `spellitemenchantement`=? LIMIT 1", $gem['enchant_id']); if ($currentColor == 6 || $currentColor == 12 || $currentColor == 14) { $socket_data['match'] = '1'; } } break; case 8: $socket_data = array('color' => 'Blue'); $gem = Items::extractSocketInfo($characters->GetGUID(), $itemID, $i, $characters->GetEquippedItemGuidBySlot($itemSlotName)); if ($gem && !$parent) { $socket_data['enchant'] = $gem['enchant']; $socket_data['icon'] = $gem['icon']; $currentColor = $this->aDB->selectCell("SELECT `color` FROM `armory_gemproperties` WHERE `spellitemenchantement`=? LIMIT 1", $gem['enchant_id']); if ($currentColor == 10 || $currentColor == 12 || $currentColor == 14) { $socket_data['match'] = '1'; } } break; } if (is_array($socket_data)) { $xml->XMLWriter()->startElement('socket'); foreach ($socket_data as $socket_key => $socket_value) { $xml->XMLWriter()->writeAttribute($socket_key, $socket_value); } $xml->XMLWriter()->endElement(); //socket $color = false; } } } if (isset($socketBonusCheck)) { $socketBonusCheckCount = count($socketBonusCheck); $socketMatches = 0; foreach ($socketBonusCheck as $socket) { if ($socket['color'] == $socket['current']) { $socketMatches++; } elseif ($socket['color'] == 2 && ($socket['current'] == 6 || $socket['current'] == 10 || $socket['current'] == 14)) { $socketMatches++; } elseif ($socket['color'] == 4 && ($socket['current'] == 6 || $socket['current'] == 12 || $socket['current'] == 14)) { $socketMatches++; } elseif ($socket['color'] == 8 && ($socket['current'] == 10 || $socket['current'] == 12 || $socket['current'] == 14)) { $socketMatches++; } } if ($socketBonusCheckCount == $socketMatches) { $socket_data['match'] = '1'; } } if ($data['socketBonus'] > 0) { $bonus_text = $this->aDB->selectCell("SELECT `text_" . $this->_locale . "` FROM `armory_enchantment` WHERE `id`=?", $data['socketBonus']); $xml->XMLWriter()->startElement('socketMatchEnchant'); $xml->XMLWriter()->text($bonus_text); $xml->XMLWriter()->endElement(); //socketMatchEnchant } $xml->XMLWriter()->endElement(); //socketData $allowable_classes = Items::AllowableClasses($data['AllowableClass']); if ($allowable_classes) { $xml->XMLWriter()->startElement('allowableClasses'); foreach ($allowable_classes as $al_class) { $xml->XMLWriter()->startElement('class'); $xml->XMLWriter()->text($al_class); $xml->XMLWriter()->endElement(); //class } $xml->XMLWriter()->endElement(); //allowableClasses } $allowable_races = Items::AllowableRaces($data['AllowableRace']); if ($allowable_races) { $xml->XMLWriter()->startElement('allowableRaces'); foreach ($allowable_races as $al_race) { $xml->XMLWriter()->startElement('race'); $xml->XMLWriter()->text($al_race); $xml->XMLWriter()->endElement(); //race } $xml->XMLWriter()->endElement(); //allowableRaces } if ($data['RequiredSkill'] > 0) { $xml->XMLWriter()->startElement('requiredSkill'); $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_" . $this->_locale . "` FROM `armory_skills` WHERE `id`=?", $data['RequiredSkill'])); $xml->XMLWriter()->writeAttribute('rank', $data['RequiredSkillRank']); $xml->XMLWriter()->endElement(); //requiredSkill } if ($data['RequiredReputationFaction'] > 0) { $xml->XMLWriter()->startElement('requiredFaction'); $xml->XMLWriter()->writeAttribute('name', $this->aDB->selectCell("SELECT `name_" . $this->_locale . "` FROM `armory_faction` WHERE `id`=?", $data['RequiredReputationFaction'])); $xml->XMLWriter()->writeAttribute('rep', $data['RequiredReputationRank']); $xml->XMLWriter()->endElement(); //requiredFaction } $xml->XMLWriter()->startElement('requiredLevel'); $xml->XMLWriter()->text($data['RequiredLevel']); $xml->XMLWriter()->endElement(); //requiredLevel $xml->XMLWriter()->startElement('itemLevel'); $xml->XMLWriter()->text($data['ItemLevel']); $xml->XMLWriter()->endElement(); //itemLevel if ($data['itemset'] > 0) { $xml->XMLWriter()->startElement('setData'); $itemsetName = $this->aDB->selectCell("SELECT `name_" . $this->_locale . "` FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']); $xml->XMLWriter()->startElement('name'); $xml->XMLWriter()->text($itemsetName); $xml->XMLWriter()->endElement(); $setdata = $this->aDB->selectRow("SELECT * FROM `armory_itemsetinfo` WHERE `id`=?", $data['itemset']); // t9/t10 Onyxia trinkets if ($data['itemset'] >= 843 && $data['itemset'] != 881 && $data['itemset'] != 882) { // Get itemset info from other table (armory_itemsetdata) $currentSetData = $this->aDB->selectRow("SELECT * FROM `armory_itemsetdata` WHERE `original`=? AND (`item1`=? OR `item2`=? OR `item3`=? OR `item4`=? OR `item5`=?)", $data['itemset'], $itemID, $itemID, $itemID, $itemID, $itemID); if ($currentSetData) { for ($i = 1; $i < 6; $i++) { if (Items::IsItemExists($currentSetData['item' . $i])) { $xml->XMLWriter()->startElement('item'); $xml->XMLWriter()->writeAttribute('name', Items::getItemName($currentSetData['item' . $i])); if ($characters->IsItemEquipped($currentSetData['item' . $i])) { $xml->XMLWriter()->writeAttribute('equipped', 1); } $xml->XMLWriter()->endElement(); //item } } } } else { for ($i = 1; $i < 10; $i++) { if (isset($setdata['item' . $i]) && Items::IsItemExists($setdata['item' . $i])) { $xml->XMLWriter()->startElement('item'); $xml->XMLWriter()->writeAttribute('name', Items::getItemName($setdata['item' . $i])); $xml->XMLWriter()->endElement(); //item } } } $itemsetbonus = Items::GetItemSetBonusInfo($setdata); if (is_array($itemsetbonus)) { foreach ($itemsetbonus as $item_bonus) { $xml->XMLWriter()->startElement('setBonus'); $xml->XMLWriter()->writeAttribute('desc', $item_bonus['desc']); $xml->XMLWriter()->writeAttribute('threshold', $item_bonus['threshold']); $xml->XMLWriter()->endElement(); //setBonus } } $xml->XMLWriter()->endElement(); //setData } $xml->XMLWriter()->startElement('spellData'); $spellData = 0; $spellInfo = false; for ($i = 1; $i < 6; $i++) { if ($data['spellid_' . $i] > 0) { $spellData = 1; $spell_tmp = $this->aDB->selectRow("SELECT * FROM `armory_spell` WHERE `id`=?", $data['spellid_' . $i]); if ($this->_locale == 'en_gb' || $this->_locale == 'ru_ru') { $tmp_locale = $this->_locale; } else { $tmp_locale = 'en_gb'; } if (!isset($spell_tmp['Description_' . $tmp_locale])) { continue; } $spellInfo = $this->spellReplace($spell_tmp, Utils::ValidateText($spell_tmp['Description_' . $tmp_locale])); if ($spellInfo) { $spellData = 2; $spellInfo = str_replace('"', '"', $spellInfo); $xml->XMLWriter()->startElement('spell'); $xml->XMLWriter()->startElement('trigger'); $xml->XMLWriter()->text($data['spelltrigger_' . $i]); $xml->XMLWriter()->endElement(); //trigger $xml->XMLWriter()->startElement('desc'); $xml->XMLWriter()->text($spellInfo); $xml->XMLWriter()->endElement(); //desc $xml->XMLWriter()->endElement(); //spell } } } if ($spellData == 1 && !empty($data['description'])) { $xml->XMLWriter()->startElement('spell'); $xml->XMLWriter()->startElement('trigger'); $xml->XMLWriter()->text(6); $xml->XMLWriter()->endElement(); //trigger $xml->XMLWriter()->startElement('desc'); if ($this->_locale == 'en_gb' || $this->_locale == 'en_us') { $xml->XMLWriter()->text($data['description']); } else { $xml->XMLWriter()->text(Items::GetItemDescription($itemID)); } $xml->XMLWriter()->endElement(); //desc if (!$parent) { for ($k = 1; $k < 4; $k++) { if ($spell_tmp['EffectItemType_' . $k] > 0 && Items::IsItemExists($spell_tmp['EffectItemType_' . $k])) { $xml->XMLWriter()->startElement('itemTooltip'); self::ItemTooltip($spell_tmp['EffectItemType_' . $k], $xml, $characters, true); $xml->XMLWriter()->endElement(); //itemTooltip $spellreagents = $this->GetSpellItemCreateReagentsInfo($spell_tmp['EffectItemType_' . $k]); if (is_array($spellreagents)) { foreach ($spellreagents as $reagent) { $xml->XMLWriter()->startElement('reagent'); $xml->XMLWriter()->writeAttribute('count', $reagent['count']); $xml->XMLWriter()->writeAttribute('name', $reagent['name']); $xml->XMLWriter()->endElement(); //reagent } } else { $xml->XMLWriter()->startElement('reag'); $xml->XMLWriter()->endElement(); //reagent } } } } $xml->XMLWriter()->endElement(); //spell } $xml->XMLWriter()->endElement(); //spellData if (!empty($data['description']) && $data['description'] != $spellInfo && $spellData != 1) { $xml->XMLWriter()->startElement('desc'); if ($this->_locale == 'en_gb' || $this->_locale == 'en_us') { $xml->XMLWriter()->text($data['description']); } else { $xml->XMLWriter()->text(Items::GetItemDescription($itemID)); } $xml->XMLWriter()->endElement(); //desc } if (!$parent) { $itemSource = Items::GetItemSource($itemID); if (is_array($itemSource)) { $xml->XMLWriter()->startElement('itemSource'); foreach ($itemSource as $source_key => $source_value) { $xml->XMLWriter()->writeAttribute($source_key, $source_value); } $xml->XMLWriter()->endElement(); //itemSource } if ($itemSource['value'] == 'sourceType.vendor' && ($reqArenaRating = Items::IsRequiredArenaRating($itemID))) { $xml->XMLWriter()->startElement('requiredPersonalArenaRating'); $xml->XMLWriter()->writeAttribute('personalArenaRating', $reqArenaRating); $xml->XMLWriter()->endElement(); //requiredPersonalArenaRating } } }
/** * @param String $url * @return NewsItem[] */ public static function getNewsList($url, $format) { //Exception thrown in XMLHandler constructor if url is incorrect $xh = new XMLHandler($url); $newsList = array(); if (isset($xh)) { $news = $xh->getNodes(NEWS_LIST_ITEM); $exceptionList = array(); foreach ($news as $n) { /* @var $n DomElement */ $ni = new NewsItem(); try { //Check if all required nodes exist, throw exception if not! if ($n->getElementsByTagName(ID)->length == 0) { throw new XMLNodeException("Element " . ID . " for " . NEWS_LIST_ITEM); } //set value of ID here to use in debugging! $ni->id = $n->getElementsByTagName(ID)->item(0)->textContent; if ($n->getElementsByTagName(PUBLISH_DATE)->length == 0) { throw new XMLNodeException("Element " . PUBLISH_DATE . " for " . NEWS_LIST_ITEM . " with id: " . $ni->id); } if (!$n->getAttribute(HREF)) { throw new XMLNodeException("Attribute " . HREF . " for " . NEWS_LIST_ITEM . " with id: " . $ni->id); } if ($n->getElementsByTagName(HEADLINE)->length == 0) { throw new XMLNodeException("Element " . HEADLINE . " for " . NEWS_LIST_ITEM . " with id: " . $ni->id); } //Check if date is valid if not throw exception $ni->publishDate = $n->getElementsByTagName(PUBLISH_DATE)->item(0)->textContent; $dateIsValid = date_parse($ni->publishDate); if (!$dateIsValid) { throw new DateParseException("Invalid Date for " . PUBLISH_DATE . " on " . NEWS_LIST_ITEM . " with id: " . $ni->id . "<br />\n"); } //Set the value of all other required elements $ni->href = $n->getAttribute(HREF); $ni->headline = $n->getElementsByTagName(HEADLINE)->item(0)->textContent; $ni->format = $format; //Add to newslist array $newsList[] = $ni; } catch (XMLException $e) { $exceptionList[] = $e; //Add exception to a list } catch (DateParseException $e) { $exceptionList[] = $e; } } //If exception list contains any exceptions throw a new exception which relays all exceptions to the user if (!empty($exceptionList)) { echo implode("<br />", $exceptionList) . "<br /><br />"; } } return $newsList; }
<?php require_once (__ROOT__.'/classes/XMLHandler.php'); /* ------------------------------------------ * initialize XML handler * ------------------------------------------ */ $lXMLAccountFilePath = "./data/accounts.xml"; $XMLHandler = new XMLHandler("owasp-esapi-php/src/", $_SESSION["security-level"]); $XMLHandler->SetDataSource($lXMLAccountFilePath); try{ switch ($_SESSION["security-level"]){ case "0": // This code is insecure $lEnableHTMLControls = FALSE; $lFormMethod = "GET"; $lEnableJavaScriptValidation = FALSE; $lProtectAgainstMethodTampering = FALSE; $lEncodeOutput = FALSE; $lProtectAgainstXPathInjection = FALSE; break; case "1": // This code is insecure $lEnableHTMLControls = TRUE; $lFormMethod = "GET"; $lEnableJavaScriptValidation = TRUE; $lProtectAgainstMethodTampering = FALSE; $lEncodeOutput = FALSE; $lProtectAgainstXPathInjection = FALSE; break; case "2":
public function count_activetrans($criteria) { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "test.xml"); $sql_from_xml = $xml->getNode("count_active_trans"); $sqlselect = str_replace("FILTER_BY_PROGRAM", " AND SESSION_ID = '" . $criteria . "' ", $sql_from_xml); //Run the SQL query $sqlquery = mssql_query($sqlselect); $string_result = ""; while ($result = mssql_fetch_array($sqlquery)) { $string_result = $result["BARCODE_COUNT"]; } return $string_result; }
die('<b>Error:</b> unable to load search engine class!'); } $search = new SearchMgr($armory); } if (defined('load_itemprototype_class')) { if (!@(include 'classes/class.itemprototype.php')) { die('<b>Error:</b> unable to load ItemPrototype Class!'); } // Do not create class instance here. It should be created in Characters or Items classes. } if (defined('load_item_class')) { if (!@(include 'classes/class.item.php')) { die('<b>Error:</b> unable to load Item Class!'); } // Do not create class instance here. It should be created in Characters or Items classes. } // Start XML parser if (!@(include 'classes/class.xmlhandler.php')) { die('<b>Error:</b> unable to load XML handler class!'); } $xml = new XMLHandler($armory->GetLocale()); $xml->StartXML(); // Do not remove this if (isset($_GET['_DISPLAYVERSION_'])) { $xml->XMLWriter()->startElement('ARMORY_REVISION'); $xml->XMLWriter()->text(ARMORY_REVISION); $xml->XMLWriter()->endElement(); //ARMORY_REVISION header('Content-type: text/xml'); die($xml->StopXML()); }
public function outstanding_po() { //select the database mssql_select_db($this->dbname, $this->dbcon); //SQL Select statement $xml = new XMLHandler(XML_DIR . "web_request_spk.xml"); $sql_from_xml = $xml->getNode("outstanding_po"); $sqlselect = str_replace("FILTER_BY_PROGRAM", "", $sql_from_xml); //Run the SQL query $result = mssql_query($sqlselect); $numfields = mssql_num_fields($result); $string_result = "<table class=\"table table-hover\"><thead><tr>"; $string_result = ""; $string_result .= "<div class=\"box\">"; $string_result .= "\t<div class=\"box-header\">"; $string_result .= " <h3 class=\"box-title\">Current Outstanding PO</h3>"; $string_result .= " </div><!-- /.box-header -->"; $string_result .= " <div class=\"box-body\">"; $string_result .= " <table id=\"example1\" class=\"table table-bordered table-striped\">"; $string_result .= " <thead>"; $string_result .= " <tr>"; for ($i = 0; $i < $numfields; $i++) { $string_result .= "<th>" . mssql_field_name($result, $i) . "</th>"; } $string_result .= " </tr>"; $string_result .= " </thead>"; $string_result .= " <tbody>"; while ($row = mssql_fetch_row($result)) { $string_result .= "<tr>"; for ($i = 0; $i < $numfields; $i++) { if ($i == 0) { $string_result .= "<th scope=\"row\"><a href=\"loadpo_" . $row[$i] . "\">" . $row[$i] . "</a></th>"; } else { $string_result .= "<td>" . $row[$i] . "</td>"; } } $string_result .= "</tr>"; } $string_result .= "\t\t\t </tbody>"; $string_result .= "\t\t </table>"; $string_result .= " </div><!-- /.box-body -->"; $string_result .= " </div><!-- /.box -->"; return $string_result; }