Exemple #1
0
function core_latin2utf($data)
{
    if (is_array($data)) {
        $result = array();
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $result[core_utf8_encode($key)] = core_latin2utf($value);
            } else {
                $result[core_utf8_encode($key)] = core_utf8_encode($value);
            }
        }
    } elseif (is_string($data)) {
        $result = core_utf8_encode($data);
    } else {
        $result = $data;
    }
    return $result;
}
Exemple #2
0
 function getInfo()
 {
     if (!$this->infoToShow || $this->getInfoCounter++) {
         return "";
     }
     if (!$GLOBALS["appsDB"]) {
         $GLOBALS["appsDB"] = $GLOBALS["dbClass"];
     }
     $p = array();
     if (core_getOption("localhost")) {
         $this->setInfo("localhost");
     }
     if (core_getOption("YBhere")) {
         $this->setInfo("YBhere");
     }
     #   if (core_getOption("playground"))$this->setInfo($GLOBALS["appsDB"] ? $GLOBALS["appsDB"]->Database."@".$GLOBALS["appsDB"]->Host : "PlayGround");
     if (core_getOption("playground")) {
         $this->setInfo($GLOBALS["appsDB"] ? "DB=" . $GLOBALS["appsDB"]->Database : "PlayGround");
     }
     if (get_class($GLOBALS["authClass"])) {
         if (list($gecos, $l, $u) = $GLOBALS["authClass"]->whoAmI()) {
             $loggedin = x("em", $this->nbsp(core_utf8_encode($gecos)));
             if ($this->logoutToShow) {
                 if ($_GET["onblur"] == "yes") {
                     $loggedin .= " " . x("a class='core_a' href='javascript:window.close();'", "[close window]");
                 } else {
                     $loggedin .= " " . x("a class=core_a href='" . core_rebuildURL(array("quit" => "yes")) . "'", "[logout]");
                 }
             }
             if ($GLOBALS["authClass"]->isSuperuser()) {
                 $this->setInfo("SUPERUSER");
             } elseif ($GLOBALS["authClass"]->isAdmin()) {
                 $this->setInfo("ADMIN");
             }
         }
     }
     if ($w = $this->infoWidget) {
         $p[] = x("span class='red'", join(" ", $w));
     }
     if ($loggedin) {
         $p[] = $loggedin;
     }
     if ($p) {
         return x("p class='loggedin'", join(" ", $p));
     } else {
         $this->infoToShow = False;
     }
     /*
         if ($loggedin)           $p[] = $loggedin;
         if ($w=$this->infoWidget) $p[] = x("span class='red'",join(" ",$w));
         if ($p) return x("p class='loggedin'",join("<br>",$p));
         else  $this->infoToShow = False;
     */
 }