function getOsName() { global $HTTP_USER_AGENT, $OsSet1; $Agent = $HTTP_USER_AGENT; $OsNum = sizeof($OsSet1); for ($i = 0; $i < $OsNum; $i++) { if ($OsSet1[$i] == 'Windows') { return getOsVersion($Agent); } else { if (stristr($Agent, $OsSet1[$i])) { return $i + 5; } } } return 0; }
protected function processPkgsForOs(&$xElem) { # Get the OS version from the childElement $childElement = $this->_xpath->query("./def:criterion", $xElem); $osVersion = getOsVersion($childElement->item(0)); # Os cannot be detected if ($osVersion == NULL) { return null; } $pkgsForOs = array(); $pkgsForOs[$osVersion] = array(); $xPkgs = $this->_xpath->query(".//def:criterion[@comment]", $xElem); foreach ($xPkgs as $pkg) { $pkgTest = $pkg->getAttribute('comment'); if (preg_match("/^(.*) is earlier than (.*)\$/", $pkgTest, $matches) == 1) { array_push($pkgsForOs[$osVersion], array($matches[1] => $matches[2])); } } return $pkgsForOs; }
function displayHeader($title = " ", $back = '', $external = false, $title2 = '', $id_attr = '') { global $CFG_GLPI, $LANG; /*if ($external) $external = "rel='external'"; else */ $external = ""; if ($back != '') { $back = $CFG_GLPI["root_doc"] . "/plugins/mobile/front/" . $back; } if (strlen($title2) > 0) { $title2 = " " . $title2; } $this->displayCommonHtmlHeader($title); echo "<div data-role='page' data-theme='c' id='{$id_attr}' "; if (nativeSelect()) { echo "class='native-select'"; } echo ">"; if (!$this->checkDisplayHeaderBar()) { echo "<div data-role='header' data-theme='c'>"; echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/central.php' rel='external'>"; echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/pics/logo.png' alt='Logo' width='62' height='30' />"; echo "</a>"; echo "<h1>" . $title . $title2 . "</h1>"; $dataTransition = "data-transition='slide'"; if (navigatorDetect() == 'Android' && getOsVersion() < "3.0") { $dataTransition = ""; } if ($back != '') { echo "<a href='" . $back . "' " . $external . " data-icon='arrow-l' data-back='true' {$dataTransition} class='ui-btn-right' style='margin-top:6px;'>" . $LANG['buttons'][13] . "</a>"; } elseif (strpos($_SERVER['PHP_SELF'], 'central.php') === false) { echo "<a href='#' onclick='history.back();' data-icon='arrow-l' class='ui-btn-right' {$dataTransition} data-back='true' style='margin-top:6px;'>" . $LANG['buttons'][13] . "</a>"; } if (strpos($_SERVER['PHP_SELF'], 'central.php') !== false) { echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/option.php' data-icon=\"gear\" class='ui-btn-right' data-rel='dialog' style='margin-top:6px;'>" . $LANG['plugin_mobile']['navigation']['options'] . "</a>"; } echo "</div>"; } }