function cache($id = False, $type = "globals") { core_setOption("cachedebug"); $this->ID = $id ? "cache-{$id}" : "cache-" . ++$GLOBALS["cachClassCounter"]; $this->type = preg_match("/^g/i", $type) ? "g" : "s"; $this->debug = core_getOption("cachedebug") || core_getOption("debug") > 99; $this->dbg("constructor", "--------------------"); if (!$GLOBALS[$this->cacheID]) { $GLOBALS[$this->cacheID] = array(); } }
function getFooter() { if ($_GET["modal"] == 'yes' || core_getOption('CLI')) { return; } $this->getHeader($bannerText); ?> </div> <!-- div-main-content --> <hr class='hidden'> </div> <!-- block-main --> <?php if ($this->headerToShow) { ?> <div id='block-colophon'> <div id='div-colophon-address'> <address> <strong>NORDITA</strong>, Roslagstullsbacken 23, 106 91 Stockholm, Sweden <br>Phone: +46-8-5537 8444, Fax: +46-8-5537 8404, E-mail: info<span class='snabela'> </span>nordita.org </address> <p class='only_online'> <a href='<?php echo $this->home; ?> /aboutus/map/index.php'>How to get here</a> — <a href='<?php echo $this->home; ?> /sitemap/index.php'>Sitemap</a> </p> <p align='right' class='only_print'><?php echo date('Y-m-d'); ?> </p> </div> </div> </div> <!-- container-body --> <?php } if ($this->menuToShow) { ?> <div id='backdrop-navigation'></div> <div id='backdrop-scrollprotect'></div> <div id='appendix-pageextension'></div> <?php } $js = new js(); $js->show(); print " </body>\n</html>\n"; core_logAccess(); exit; }
function core_internalError($txt, $class = False, $forced = False) { global $headerClass, $core_debug, $cnf; if ($GLOBALS["core_internalError"]++) { exit; } if (True || $forced || $core_debug || core_getOption('YBhere') || core_getOption('test')) { $toPrinError = True; } else { core_bug2mail($txt, 'core_internalError ' . $cnf["version"]); if (function_exists('apps_getBugReport')) { apps_getBugReport($class, $txt); } $toPrinError = function_exists('apps_internalError') ? apps_internalError($txt, $class) : True; } if ($toPrinError) { $message = ($class ? "class " . get_class($class) . ': ' : '') . "{$txt}"; core_syslog("BUG {$message}"); print "<font color='red'><h1>Internal error</h1>{$message}</font>"; core_backtrace('internal error', $class); # if (function_exists('appsGetFooter')) appsGetFooter(); # elseif (@$headerClass) $headerClass->getFooter(); exit; } }
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; */ }
<?php // ========================================================================== // CONFIG.PRIV.PHP // Called by preprints/config.php twice, once with $authClass unset, once // with $authClass set. // ========================================================================== if (isset($authClass) && is_object($authClass)) { $authClass->applicationPasswordMask = "\\w+\\d+\$"; $authClass->addAdmin("brandenb"); $authClass->addAdmin("larus"); /* HVZM -- */ $authClass->addAdmin("hansson"); $authClass->addSuperUser("hvzm"); /* -- HVZM */ $authClass->addSuperUser("yb"); } /* HVZM -- */ $dbName = $GLOBALS["DBS"]["preprints"]["name"]; $dbServer = $GLOBALS["DBS"]["preprints"]["host"]; $dbUser = $GLOBALS["DBS"]["preprints"]["user"]; $dbP = $GLOBALS["DBS"]["preprints"]["pass"]; /* -- HVZM */ if (function_exists("core_getOption") && core_getOption("playground")) { $dbName = "nordita_test"; }
function whoAmI() { if (False && $this->autoLogout && $_SESSION["auth"]["timestamp"]) { core_dbgArray($_SESSION["auth"], "whoAmI", $this->debug || core_getOption("YBhere")); $dt = time() - $_SESSION["auth"]["timestamp"]; if ($dt > $autoLogoutTime) { core_dbg("autoLogout", "sleep for {$dt} > {$autoLogoutTime}", "", 1); $this->logout(); } } $_SESSION["auth"]["timestamp"] = time(); // Check first the standard Apache authenticator, // normally coming from pubcookies if ($localAccount = core_getpwnam($_SERVER["REMOTE_USER"])) { $this->dbg("whoAmI", "REMOTE_USER", $_SERVER["REMOTE_USER"]); $_SESSION["auth"]["username"] = $localAccount["name"]; $_SESSION["auth"]["gecos"] = $localAccount["gecos"]; $_SESSION["auth"]["account_id"] = $localAccount["uid"]; } // Accept (if any) the server authentication prompt $this->authenticate($_POST["auth_username"], $_POST["auth_password"]); if ($_SESSION["auth"]["username"] && $_SESSION["auth"]["gecos"] && $_SESSION["auth"]["account_id"]) { $this->localAccount = core_getpwnam($_SESSION["auth"]["username"]); if (!$GLOBALS["deja"][get_class($this)][$_SESSION["auth"]["username"]]++) { core_dbgArray($_SESSION["auth"], "auth whoAmI"); } $_SERVER["PHP_AUTH_USER"] = $_SESSION["auth"]["username"]; return array($_SESSION["auth"]["gecos"], $_SESSION["auth"]["username"], $_SESSION["auth"]["account_id"]); } else { $this->dbg("whoAmI", "not logged in"); unset($_SESSION["auth"]); } }
function halt($msg, $sqlError = '') { if ($this->doNotStopOnErrors && !core_getOption('YBhere')) { print "<table><tr><td>" . "<FONT COLOR=red>" . "WARNING: The database is write-protected, the query '{$this->lastQuery_String}' is rejected, the database is not changed</font></td></tr></table>"; } else { $this->close(); if (function_exists('core_backtrace')) { core_backtrace(); } print "<table><tr><td>" . "<FONT COLOR=red>" . "<b>{$this->Database} database error</b><br>" . "<pre>" . $this->format($msg) . "</pre>" . $sqlError . "</td></tr></table>"; if (function_exists('appsGetFooter')) { appsGetFooter(); } die(""); } }
function send($to, $subject, $message, $countThisMail = True, $signThisMail = True) { global $apps_listOfEmails; $this->dbg('send', "to={$to} from={$this->from} subject=" . $this->subjectID . $subject); if (!$this->from) { $this->from = 'noReply'; } if (!$this->fromExtended) { $this->fromExtended = $this->from; } if (!$this->signature) { $this->signature = core_getConfig('signature', 'Computing support'); } if ($GLOBALS["mailDejaVu"][$to][$this->fromExtended][$subject]++) { return; } if ($this->cc) { $headers[] = "Cc: {$this->cc}"; } if ($this->bcc) { $headers[] = "Bcc: {$this->bcc}"; } $headers[] = "X-Mailer: mailClassYB"; $realTO = core_getConfig('redirectMailsInPlaygoundMode') && core_getOption('playground') ? core_getConfig('plygroundEmail') : $to; $realTOdisplay = $realTO == $to ? $to : "{$realTO} <{$to}>"; if ($signThisMail) { $message .= $this->signature; } $autoSignature = "this is an automatic e-mail sent by the {$this->mailID}"; while ($l++ < strlen($autoSignature)) { $autoSignature1 .= '-'; } $message .= join("\n", array("\n", $autoSignature1, $autoSignature)); if (core_getOption('playground')) { $message = "*** This E-mail is sent by the test version of the {$this->mailID} software and should be ignored\n" . "*** (unless you participate in the debugging and expect this E-mail).\n" . "*** Sorry if you got it my mistake...\n\n" . $message; } if (core_getConfig('dontSendMail_Point')) { $this->reallySendMail = False; } if ($this->reallySendMail) { $headers[] = "From: " . $this->fromExtended; $crlf = "\r\n"; #print "realTO=$realTO<br>";$realTO='*****@*****.**'; if (!mail($realTO, $this->subjectID . $subject, $message, join($crlf, $headers) . $crlf)) { core_internalError(get_class($this) . " Can't send an E-mail to {$realTOdisplay}<br>Please restart the procedure"); } // keep trace of the mails sent, useful for a summary core_syslog("mail from={$this->from} to={$realTO}" . ($to == $realTO ? "" : "<{$to}>") . " subject={$subject}"); if ($countThisMail) { $apps_listOfEmails[$realTOdisplay][] = $this->subjectID . $subject; $this->log($realTO, $this->from, $subject); } } else { $headers[] = "From: " . $this->fromForDebug; core_importantMessage("The following E-mail is prepared, but NOT sent:", 'h3', '<b>' . join('<br>', array("To: {$realTOdisplay}", "Subject: " . $this->subjectID . $subject, join('<br>', $headers) . '</b><br><br>' . eregi_replace(' ', ' ', eregi_replace("\n", "<br>", $message))))); } }
if (!$title) { errorPage("Preprint title is missing", "Edit Preprints", "User error"); } if (!$authors) { errorPage("Authors list is missing", "Edit Preprints", "User error"); } // this will be overriden if a preprint upload is selected if ($losAlamosLocation) { $location = $losAlamosLocation; } if (@$_FILES["preprint"]) { // Handle file upload switch ($_FILES["preprint"]["error"]) { case UPLOAD_ERR_OK: // Determine destination directory $dest_dir = core_getOption("playground") ? "/test/{$year}" : "/{$year}"; if (!is_dir(PP_DB . $dest_dir) && !mkdir(PP_DB . $dest_dir, 0700)) { bugPage("Cannot create directory " . PP_DB . "{$dest_dir} to store preprints in."); } // Sanity check if (!file_exists($_FILES["preprint"]["tmp_name"])) { bugPage("_FILES.preprint.tmp_name=" . $_FILES["preprint"]["tmp_name"] . " does not exist"); } // Determine destination file name $pp_name = $_FILES["preprint"]["name"]; $ext = nor_file_name_extension($pp_name); $extra_ext = ""; $do_compress = false; if ($ext == ".gz" || $ext == ".bz2") { $is_compressed = true; $ext = nor_file_name_extension(nor_file_name_sans_extension($pp_name)) . $ext;