Example #1
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;
     */
 }
Example #2
0
 function sortlink($value, $code)
 {
     global $dbClass;
     if ($this->noSort || eregi('_nosort$', $code)) {
         return x('b', $value);
     }
     if (preg_match("/^(date|time)\$/", $code) && is_object($dbClass) && $dbClass->tableExists('datetime')) {
         $code = 'datetime';
     }
     if ($_GET['sortbyDir'] == 'DESC') {
         $order = 'ASC';
     } else {
         $order = 'DESC';
     }
     $arrow = "<img src='classes/img/arrow" . $_GET["sortbyDir"] . ".png' alt='' border=0>";
     if ($_GET["sortby"] == $code) {
         $value = "{$arrow}{$value}";
     }
     return x("a href='" . core_rebuildURL(array('sortbyDir' => $order, 'sortby' => $code)) . "'", x('b', $value));
 }
Example #3
0
 function loginPrompt($modeForced = "")
 {
     // mode = "login"
     //        "tellpwd"
     $this->dbg("loginPrompt", "start execution");
     $mode = "login";
     if ($_POST["remindpassword"]) {
         unset($_GET["forgotpassword"]);
         if ($message = $this->remindPassword($_POST["auth_username"])) {
             $message = $this->errMsg($message);
             $mode = "tellpwd";
         } else {
             $message = "<font color=green size=-1>The password reminder is sent to you</font>";
         }
     }
     if ($_GET["forgotpassword"] && !$_SESSION["auth_pwdsent"]) {
         $mode = "tellpwd";
     }
     if ($_POST["auth_pwd1"] || $_POST["auth_pwd2"]) {
         if ($message = $this->changePwd($_POST["auth_username"], $_POST["auth_password"], $_POST["auth_pwd1"], $_POST["auth_pwd2"])) {
             $mode = "cpw";
             $message = $this->errMsg($message);
         } else {
             return array("cpw", False, False);
         }
     }
     if ($this->titleMessage) {
         print $this->titleMessage;
     }
     $this->dbg("loginPrompt", "mode={$mode} modeForced={$modeForced}");
     if ($modeForced) {
         $this->dbg("loginPrompt", "mode {$mode} -> {$modeForced}");
         $mode = $modeForced;
     }
     $post = "login";
     if ($mode == "login") {
         if (list($g, $l, $u) = $this->login($_POST["auth_username"], $_POST["auth_password"])) {
             return $this->whoAmI();
         }
         if ($_POST["auth_username"] && $_POST["auth_password"]) {
             $message = $this->errMsg("Wrong username or password");
         }
         $pwPrompt = "password";
         $suPrompt = "login";
         $lnPrompt = "user name";
     } elseif ($mode == "tellpwd") {
         $pwPrompt = "";
         $suPrompt = "remind password";
         $lnPrompt = "e-mail address";
         $post = "remindpassword";
     } elseif ($mode == "cpw") {
         $pwPrompt = "current password";
         $suPrompt = "change password";
         $lnPrompt = "user name";
     }
     core_importantMessage($this->loginMessage, "font");
     echo "<center>\n", "<form name=login action=", core_rebuildURL(array(), array("forgotpassword" => "drop", "quit" => "drop")), "&", htmlspecialchars(SID), " method=post>\n";
     $t = new table("class='login'");
     $t->tr("", "colspan='3' align='center'", eregi_replace("\n|\r", "<br>", $message));
     $this->tr($t, "auth_username", "text", $lnPrompt, "auth_man.png", $value = $_POST["auth_username"]);
     if ($pwPrompt) {
         $this->tr($t, "auth_password", "password", $pwPrompt);
     }
     if ($mode == "cpw") {
         $this->tr($t, "auth_pwd1", "password", "new password");
         $this->tr($t, "auth_pwd2", "password", "retype new password");
     }
     $t->tro();
     $t->td("", "<input name='{$post}' value='{$suPrompt}' type='submit'>");
     $t->td();
     $t->td("align='right'", $this->showPasswordReminder && $mode == "login" && !$_SESSION["auth_pwdsent"] ? x("a href=" . core_rebuildURL(array("forgotpassword" => "yes")), "forgot your password?") : "");
     $t->trc();
     $t->close();
     echo "</form></center>";
 }
Example #4
0
 function loginPrompt($modeForced = '')
 {
     // mode = 'login'
     //        'tellpwd'
     $this->dbg("loginPrompt", "start execution");
     $mode = 'login';
     if ($_POST["remindpassword"]) {
         unset($_GET["forgotpassword"]);
         if ($message = $this->remindPassword($_POST["auth_username"])) {
             $message = $this->errMsg($message);
             $mode = 'tellpwd';
         } else {
             $message = "<font color=green size=-1>The password reminder is sent to you</font>";
         }
     }
     if ($_GET["forgotpassword"] && !$_SESSION["auth_pwdsent"]) {
         $mode = 'tellpwd';
     }
     if ($_POST["auth_pwd1"] || $_POST["auth_pwd2"]) {
         if ($message = $this->changePwd($_POST["auth_username"], $_POST["auth_password"], $_POST["auth_pwd1"], $_POST["auth_pwd2"])) {
             $mode = 'cpw';
             $message = $this->errMsg($message);
         } else {
             return array('cpw', False, False);
         }
     }
     if ($this->titleMessage) {
         print $this->titleMessage;
     }
     $this->dbg("loginPrompt", "mode={$mode} modeForced={$modeForced}");
     if ($modeForced) {
         $this->dbg("loginPrompt", "mode {$mode} -> {$modeForced}");
         $mode = $modeForced;
     }
     $post = 'login';
     if ($mode == 'login') {
         if (list($g, $l, $u) = $this->login($_POST["auth_username"], $_POST["auth_password"])) {
             return $this->whoAmI();
         }
         if ($_POST["auth_username"] && $_POST["auth_password"]) {
             $message = $this->errMsg("Wrong username or password");
         }
         $pwPrompt = 'password';
         $suPrompt = 'login';
         $lnPrompt = 'user name';
     } elseif ($mode == 'tellpwd') {
         $pwPrompt = '';
         $suPrompt = 'remind password';
         $lnPrompt = 'e-mail address';
         $post = 'remindpassword';
     } elseif ($mode == 'cpw') {
         $pwPrompt = 'current password';
         $suPrompt = 'change password';
         $lnPrompt = 'user name';
     }
     core_importantMessage($this->loginMessage, 'font');
     echo "<center>\n", "<form name=login action=", core_rebuildURL(array(), array('forgotpassword' => 'drop', 'quit' => 'drop')), '&', htmlspecialchars(SID), " method=post>\n";
     $t = new table('class=login');
     $t->tr('', 'colspan=3 align=center', eregi_replace("\n|\r", "<br>", $message));
     $this->tr($t, 'auth_username', 'text', $lnPrompt, 'auth_man.png', $value = $_POST["auth_username"]);
     if ($pwPrompt) {
         $this->tr($t, 'auth_password', 'password', $pwPrompt);
     }
     if ($mode == 'cpw') {
         $this->tr($t, 'auth_pwd1', 'password', 'new password');
         $this->tr($t, 'auth_pwd2', 'password', 'retype new password');
     }
     $t->tro();
     $t->td('', "<input name='{$post}' value='{$suPrompt}' type='submit'>");
     $t->td();
     $t->td('align=right', $this->showPasswordReminder && $mode == 'login' && !$_SESSION["auth_pwdsent"] ? x("a href=" . core_rebuildURL(array('forgotpassword' => 'yes')), "forgot your password?") : "");
     $t->trc();
     $t->close();
     echo "</form></center>";
 }