本文整理汇总了PHP中functions::gpc_declare_input方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::gpc_declare_input方法的具体用法?PHP functions::gpc_declare_input怎么用?PHP functions::gpc_declare_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::gpc_declare_input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSignature
static function getSignature()
{
//people::loadClass();
$stdout = "";
// ------------------------------
// Obtain user data
// ------------------------------
functions::gpc_declare_input("usr", false);
functions::gpc_declare_input("beenthere", false, true);
$userdata = functions::callMethod('people', 'lib/people', 'doorlabelData');
// yes, get doorlabel data
if (empty($userdata)) {
return BLURB_SORRY_PEOPLE_SEARCH;
}
// ------------------------------
// Adapt user data
// ------------------------------
$entry = array();
if (isset($GLOBALS["usr"]) && $GLOBALS["usr"]) {
$entry = $userdata[$GLOBALS["usr"]];
if ($entry["nw_user"] == "sigste") {
$entry["nw_fullname"] = str_replace("igurdur", "igurður", $entry["nw_fullname"]);
}
if (!class_exists("fromdb_cv", FALSE)) {
require_once PATH_CLASSES . "/fromdb/cv.php";
}
$dbCv = new fromdb_cv();
$cvitems = $dbCv->getCvs();
$entry["nw_cv"] = isset($cvitems[$entry["nw_user"]]) ? $cvitems[$entry["nw_user"]] : "";
}
// ------------------------------
// Output user data or input form
// ------------------------------
if (count($entry)) {
$sig = self::constructSignatures($entry, "en");
//$userdata = functions::callMethod('people','lib/people','doorlabelData'); // yes, get doorlabel data
//$stdout .= self::outputSignature($userdata[$GLOBALS["usr"]]);
//$showform = 0;
/* FOR SIGNATURE FILES
header("Content-Type: application/octet-stream");
print utf8_decode(self::outputSignature($entry));
die();
*/
$stdout .= "<div class='col-content-left'>\r\n" . " <ul class='tightlist'>\r\n" . " <li class='bottommargin'>Select a <a href='" . $_SERVER["PHP_SELF"] . "?usr=" . $GLOBALS["usr"] . "#text'><strong>text signature</strong></a></li>\r\n" . " <li class='bottommargin'>Select a <a href='" . $_SERVER["PHP_SELF"] . "?usr=" . $GLOBALS["usr"] . "#graphic'><strong>graphic (HTML formatted) signature</strong></a></li>\r\n" . " <li class='bottommargin'>" . "<a href='" . $_SERVER["PHP_SELF"] . "#maildb_doorlabel'><strong>Back to E-Mail Signature Page</strong></a></li>\r\n" . " </ul>\r\n" . "</div> <div class='col-content-right'>\r\n" . functions::OutputWikiPage('0', '2458') . "</div><div style='clear:both'><br></div>\r\n" . "\r\n";
foreach ($sig as $type => $si) {
$stdout .= PAGE_BREAK . "<hr id='" . $type . "' style='margin-top:2em'>\r\n";
foreach ($si as $id => $s) {
$stdout .= "<h4>" . ucfirst($type) . " Signature Example #" . $id . "</h4>\r\n" . self::outputSignature($s, $type) . "\r\n" . "\r\n";
}
}
} else {
// leave vertical space for error messages
unset($GLOBALS["usr"]);
$stdout .= self::outputSignatureForm($userdata);
}
return $stdout;
}
示例2: array
// $GLOBALS[SUBSITE]["stylesheets-conditional"]
// $GLOBALS[SUBSITE]["scripts"]
// $GLOBALS[SUBSITE]["scripts-conditional"]
// $GLOBALS[SUBSITE]["containers"]
// $GLOBALS[SUBSITE]["regions"]
// //$this->getConfig("boxes")
// //$this->getConfig("startpage")
// ===========================================================================
if (!class_exists("auth", FALSE)) {
require_once PATH_CLASSES . "/lib/auth.php";
}
// -------------------------------------------------------------------------
if (SHOW_TEST_TABS) {
functions::gpc_declare_input("bannerimage", 0, true, array(0, 1), true);
functions::gpc_declare_input("splashimage", 1, true, array(0, 1), true);
functions::gpc_declare_input("minimenu", 0, true, array(0, 1), true);
}
// =========================================================================
// -- COMMON SITE-WIDE <head> ELEMENTS
//
// $GLOBALS[SUBSITE]["head"][] = <element>
// -------------------------------------------------------------------------
// Loaded in document->buildPageHtml()
// -------------------------------------------------------------------------
// --> Defined in document->buildPageAuxHead()
// =========================================================================
// =========================================================================
// -- PER-SUBSITE PHP CLASS FILES
//
// $GLOBALS[SUBSITE]["classes"][<classname>] = <classfile>
// -------------------------------------------------------------------------
示例3: OutputSolarsystem
static function OutputSolarsystem($models = array(), $language = "en")
{
$stdout = $title = $model_scale = "";
$pluto_orbit_model = 1;
$s = 0;
$models = array();
// gpc_declare_input ($vname, $default, $bool, $allowed, $set_session, $strip_tags)
functions::gpc_declare_input("doit", false, true);
functions::gpc_declare_input("m", array(), false);
functions::gpc_declare_input("language", "sv", false);
functions::gpc_declare_input("p", array(), false);
if (!$GLOBALS["doit"]) {
$GLOBALS["m"][0] = "sweden";
}
// ------------------------------------
if (!empty($GLOBALS["m"])) {
foreach ($GLOBALS["m"] as $model) {
if (isset(self::$model_definition[$model])) {
$models[] = self::$model_definition[$model];
}
}
} elseif (!empty($GLOBALS["p"])) {
foreach (array_reverse($GLOBALS["p"]) as $k => $v) {
if (!empty($v)) {
$model_scale = $v;
$model_choice = $k;
}
}
$sun_diam = 1391980000;
// m
$au = 149597870700.0;
// m
$pluto_orbit = 5874000000000.0;
// m
$scale_unit = "m";
if (is_numeric($model_scale) && $model_scale > 0) {
switch ($model_choice) {
case "sun":
$pluto_orbit_model = $pluto_orbit * $model_scale / $sun_diam;
break;
case "au":
$pluto_orbit_model = $pluto_orbit * $model_scale / $au;
break;
case "pluto":
$pluto_orbit_model = $model_scale;
break;
}
if ($pluto_orbit_model > 10000) {
$scale_unit = "km";
$pluto_orbit_model /= 1000;
}
$models[] = array("title" => $GLOBALS["language"] == "en" ? "My Solar System" : "Min Solsystemsmodell", "scale_unit" => $scale_unit, "pluto_orbit" => $pluto_orbit_model, "is_sss" => false);
}
}
// ------------------------------------
$chk = array();
foreach (self::$model_definition as $key => $data) {
if (!empty($data["title"]) && $key != "alvsjo") {
$chk[] = "<input type='checkbox' name='m[]' value='" . $key . "'" . (in_array($key, $GLOBALS["m"]) ? " checked" : "") . "> " . $data["title"] . "\r\n";
}
}
$lang = array();
foreach (array("en" => "English", "sv" => "Swedish") as $key => $data) {
$lang[] = "<option value='" . $key . "'" . ($key == $GLOBALS["language"] ? " selected" : "") . "> " . $data . "\r\n";
}
$par = array();
foreach (array("sun" => "Model diameter of Sun", "au" => "Model AU (average distance of Earth to Sun)", "pluto" => "Model average distance of Pluto from Sun") as $key => $data) {
if (!empty($data)) {
$par[] = "<input type='text' name='p[" . $key . "]' size='10'" . (isset($model_choice) && isset($model_scale) && $key == $model_choice ? " value='" . $model_scale . "'" : "") . "> m — " . $data . "\r\n";
}
}
$stdout .= "<div class='medwide-box only_online'>\r\n" . "<div class='col c1of2'>\r\n\r\n";
$stdout .= " <form action='" . $_SERVER["PHP_SELF"] . "' method='post'>\r\n" . " <h3>Select Solar System Model(s):</h3>\r\n" . " <p>\r\n" . " " . implode($chk, " <br>") . " </p>\r\n" . " <p>Language: <select name='language'>\r\n" . " " . implode($lang, " ") . " </select></p>\r\n" . " <input type='submit' name='doit' value='Display model data'>\r\n" . " </form>\r\n" . "\r\n";
$stdout .= "</div> <div class='col c2of2 divider'>\r\n\r\n";
$stdout .= " <form action='" . $_SERVER["PHP_SELF"] . "' method='post'>\r\n" . " <h3>...or design your own model:</h3>\r\n" . " <p class='nobottommargin'>Units should be in <em>meters</em>. Select only one option.</p>\r\n" . " <p>\r\n" . " " . implode($par, " <br>") . " </p>\r\n" . " <p>Language: <select name='language'>\r\n" . " " . implode($lang, " ") . " </select></p>\r\n" . " <input type='submit' name='doit' value='Display model data'>\r\n" . " </form>\r\n" . "\r\n";
$stdout .= "</div><div style='clear:both'><br></div>\r\n" . "</div>\r\n";
// ------------------------------------
if (empty($models)) {
$stdout .= "<div class='medwide-box'><div class='box error padding background'>" . ($GLOBALS["language"] == "en" ? "No solar model was selected." : "Ingen solsystemsmodell har valts") . "</div></div>\r\n";
} else {
foreach ($models as $model) {
$stdout .= self::outputSolarsystemTable($model, $GLOBALS["language"]);
}
}
// ------------------------------------
return $stdout;
}
示例4: OutputVideoList
public static function OutputVideoList()
{
// --------------------------------
// -- Fetch data
// --------------------------------
$playlists = $playlistArray = $sections = array();
if (!class_exists("fromdb_youtube", FALSE)) {
require_once PATH_CLASSES . "/fromdb/youtube.php";
}
//TODO: perhaps merge to one callable method?
//TODO: perhaps cache?
$playlistArray["event"] = fromdb_youtube::getEventPlaylistArray();
$playlistArray["seminar"] = fromdb_youtube::getSeminarPlaylistArray();
$playlistArray["presentation"] = fromdb_youtube::getPresentationPlaylistArray();
$playlists["other"] = fromdb_youtube::getOtherVideoArray();
$i = 0;
foreach ($playlistArray as $key => $pl) {
if ($key != "other") {
$sections[$key] = array_keys($pl);
// used for sectioned list of all known playlists
$playlists = array_merge($playlists, $pl);
$i += count($pl);
}
}
// --------------------------------
// -- If Error
// --------------------------------
if ($i == 0) {
return "<p class='red bold'>» ERROR: <em>No videos found</em>." . (isset($GLOBALS["nw_debug"]["fromcache_get"]) ? " [" . $GLOBALS["nw_debug"]["fromcache_get"] . "]" : "") . "</p>\r\n\r\n";
}
// --------------------------------
// -- Output data
// --------------------------------
functions::gpc_declare_input("ev", "", false);
functions::gpc_declare_input("cl", "", false);
if (!empty($playlists[$GLOBALS["ev"]])) {
if (empty($GLOBALS["cl"])) {
// $ev yes, $cl no
return video::outputVideoListEvent($playlists[$GLOBALS["ev"]]);
} else {
// $ev yes, $cl yes
return video::outputVideoSingle($playlists[$GLOBALS["ev"]], $GLOBALS["cl"]);
}
} else {
// $ev no, $cl no
return video::outputVideoListAll($playlists, $sections);
}
}
示例5: OutputMenuUpdate
public static function OutputMenuUpdate()
{
//UNDER CONSTRUCTION
$stdout = "";
$options = $headers = $allConfids = $allConfidsUpdated = array();
$updatedRecords = 0;
$noRecordsInDB = true;
functions::gpc_declare_input("ud", false, true);
functions::gpc_declare_input("uu", false, true);
functions::gpc_declare_input("um", false, true);
functions::gpc_declare_input("uf", false, true);
functions::gpc_declare_input("ut", false, true);
functions::gpc_declare_input("ug", false, true);
self::initiatePositionsClass();
// --> $GLOBALS["positionsClass"]
// ----------------------------------------------
// -- Act on selected option
// ----------------------------------------------
// UPDATE manually kept fields from all legacy files
if ($GLOBALS["ud"]) {
$updatedRecords = $GLOBALS["positionsClass"]->updateDatabaseFromLocalFiles(1);
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
if ($GLOBALS["uu"]) {
$updatedRecords = $GLOBALS["positionsClass"]->updateDatabaseFromLocalFiles(0);
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
if ($GLOBALS["um"]) {
$updatedRecords = self::OutputLookupEditor("method");
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
if ($GLOBALS["uf"]) {
$updatedRecords = self::OutputLookupEditor("field");
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
if ($GLOBALS["ut"]) {
$updatedRecords = self::OutputLookupEditor("type");
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
if ($GLOBALS["ug"]) {
$updatedRecords = self::OutputLookupEditor("group");
if ($updatedRecords) {
$noRecordsInDB = false;
}
}
// ------------------------------------------------------------------------
// -- Output data
// ------------------------------------------------------------------------
if (!empty($_REQUEST) && !$noRecordsInDB && isset($updatedRecords)) {
$stdout .= $updatedRecords > 0 ? " <p class='box padding confirm background'>Successfully updated " . "<strong>" . $updatedRecords . "</strong> records in the database 'nw_positions'.</p>\r\n" : " <p class='box padding error background'><strong>Could not update any records</strong> " . "in the database 'nw_events'." . (!$noRecordsInDB && $updatedRecords == ERROR_NO_EVENTS_REQUESTED ? " [No events requested]" : "") . (!$noRecordsInDB && $updatedRecords == 0 ? " [No events updated]" : "") . "</p>\r\n";
}
// -----------------------
$stdout .= "";
$headers["manual"] = "Initiate Tables From Manually Kept Files";
$options["manual"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?ud=1'>EMPTY tables and then UPDATE manually kept fields from all legacy files</a>";
$options["manual"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?uu=1'>Keep tables and UPDATE manually kept fields from all legacy files</a>";
/*
$headers["lookup"] = "Update Lookup Tables";
$options["lookup"][] = "<a href='".$_SERVER["PHP_SELF"]."?um=1'>EDIT lookup table 'method'</a>";
$options["lookup"][] = "<a href='".$_SERVER["PHP_SELF"]."?uf=1'>EDIT lookup table 'field'</a>";
$options["lookup"][] = "<a href='".$_SERVER["PHP_SELF"]."?ut=1'>EDIT lookup table 'type'</a>";
$options["lookup"][] = "<a href='".$_SERVER["PHP_SELF"]."?ug=1'>EDIT lookup table 'group'</a>";
if (!$noRecordsInDB) $options["manual"][] = "<a href='".str_replace("nw_events_update","nw_events_edit",$_SERVER["PHP_SELF"])."'>EDIT manually kept fields - SINGLE event</a> <span style='padding-left:1em;font-weight:normal'>(use [Edit] links)</span>";
$headers["agenda"] = "Agenda Fields";
$options["agenda"][] = "<a href='".$_SERVER["PHP_SELF"]."?ua=1'>UPDATE Agenda fields - ALL events</a>";
if (!$noRecordsInDB) $options["agenda"][] = "<a href='".$_SERVER["PHP_SELF"]."?un=1'>UPDATE Agenda fields - CURRENT and FUTURE events</a>";
if (!$noRecordsInDB) $options["agenda"][] = "<a href='".str_replace("nw_events_update","nw_events_edit",$_SERVER["PHP_SELF"])."'>UPDATE Agenda fields - SINGLE event</a> <span style='padding-left:1em;font-weight:normal'>(use [Update] links)</span>";
$options["agenda"][] = "<a href='".AGENDA_URI."/'>EDIT Agenda events</a>";
//$options["vm"][] = "<a href='".$_SERVER["PHP_SELF"]."?uv=1'>UPDATE VM fields</a>";
$headers["vm"] = "VM Fields";
$options["vm"][] = "[UPDATE VM fields]";
$headers["varia"] = "Varia";
$options["varia"][] = "<a href='".$_SERVER["PHP_SELF"]."?um=1'>Recreate 'menulookup' cache</a>";
*/
foreach (array("manual", "lookup") as $db) {
if (!empty($options[$db])) {
$stdout .= "<div class='box blackborder padding'>\r\n" . (!empty($headers[$db]) ? "<h4>" . $headers[$db] . "</h4>\r\n" : "") . " <ul class='bold tightlist'>\r\n" . " <li>" . implode($options[$db], "</li>\r\n <li>") . "</li>\r\n" . " </ul>\r\n" . "</div>\r\n";
}
}
// -----------------------
return $stdout;
}
示例6: checkLogin
public static function checkLogin()
{
// -----------------------
// -- No output if no login required for this page; continue anyhow if login requested
// -----------------------
if (!self::isLoginRequested() && !self::isLoginRequired() && !isset($_SESSION["mypear_auth_attempted"])) {
return true;
}
//TODO: set default avatar???
// -----------------------
// -- No output if no login RPC-requested but login required
// -----------------------
//if (!isset($_REQUEST["login"]) || !$_REQUEST["login"]) return false;
if (self::isLoginRequested() && !self::isLoginRequested()) {
return false;
}
// -----------------------
// -- No output if no login RPC-requested from a login form
// -----------------------
//if (!isset($_REQUEST["auth_submitted"])) return false; // --> requested
// -----------------------
// -- No output if user is already authenticated
// -----------------------
if (self::isAuthenticated()) {
return true;
}
// -----------------------
// -- Analyze submitted form data, and set error messages if errors were found.
// GPC indata:
// $_REQUEST["login"]
// $_REQUEST["auth_username"]
// $_REQUEST["auth_password"]
// $_REQUEST["auth_submitted"]
// -----------------------
$error_found = false;
if (isset($GLOBALS["nw_loginerror"])) {
unset($GLOBALS["nw_loginerror"]);
}
$GLOBALS["nw_loginerror"]["username"] = array();
$GLOBALS["nw_loginerror"]["password"] = array();
// -----------------------
// -- Groom indata
// (NB. Input field names 'auth_username' and 'auth_password'' are also used in
// myPear-style login form. The NW field name 'auth_submitted' is called 'login'
// in myPear forms. Neither of this really matters.)
// -----------------------
// Fix for myPear authentication (or addslashes, perhaps?)
if (isset($_REQUEST["auth_password"])) {
$_REQUEST["auth_password"] = str_replace("'", "", $_REQUEST["auth_password"]);
}
if (isset($_GET["auth_password"])) {
$_GET["auth_password"] = str_replace("'", "", $_GET["auth_password"]);
}
if (isset($_POST["auth_password"])) {
$_POST["auth_password"] = str_replace("'", "", $_POST["auth_password"]);
}
functions::gpc_declare_input("auth_username", "");
functions::gpc_declare_input("auth_password", "");
// -----------------------
// -- Input check for each value. Return if input errors were found.
// Error messages are stored in $GLOBALS["nw_loginerror"], to be processed by calling function.
// -----------------------
if (empty($GLOBALS["auth_username"])) {
$GLOBALS["nw_loginerror"]["username"][] = "You have to enter a username!";
}
if (isset($GLOBALS["auth_username"]) && strstr($GLOBALS["auth_username"], " ")) {
$GLOBALS["nw_loginerror"]["username"][] = "There seems to be an error in your username!";
}
if (empty($GLOBALS["auth_password"])) {
$GLOBALS["nw_loginerror"]["password"][] = "You have to enter a password!";
}
if (!empty($GLOBALS["nw_loginerror"]["username"]) || !empty($GLOBALS["nw_loginerror"]["password"])) {
return false;
}
unset($GLOBALS["nw_loginerror"]);
// -----------------------
// -- Authenticate user, and set avatar if authenticated or return error if not.
// -----------------------
if (self::authenticate($GLOBALS["auth_username"], $GLOBALS["auth_password"])) {
//if (self::isValidFunctionUser($GLOBALS["auth_username"],$GLOBALS["auth_password"])) {
// -----------------------
// Set parameters for authenticated functional user
// --> $_SESSION["nwAuth"]["authenticated","identity","institute","employeegrp"]
// -----------------------
//TODO: how important is this now? check if obsolete
self::setNwAvatar($GLOBALS["auth_username"]);
// -----------------------
// -- Set myPear autologout parameters
//TODO: seem not to be able to call "myPear::_AUTH()" at this point
// -----------------------
/*
if (OK_TO_CALL_MYPEAR && class_exists("myPear") && class_exists("myPear::_AUTH()")) {
myPear::_AUTH()->$autoLogout = true;
myPear::_AUTH()->$autoLogoutTime = 36000; // seconds
}
*/
} else {
$GLOBALS["nw_loginerror"]["username"][] = "Please enter correct username and password";
return false;
}
//.........这里部分代码省略.........
示例7: OutputRoomsAvailability
static function OutputRoomsAvailability()
{
$stdout = "";
// --------------------------
// GPC adaptation
// (must be outside check for 'beenthere')
// --------------------------
functions::gpc_declare_input("beenthere", false, true);
functions::gpc_declare_input("areaNordita", "", false);
functions::gpc_declare_input("areaAlbanova", $GLOBALS["beenthere"] ? "" : "on", false);
functions::gpc_declare_input("areaKth", "", false);
functions::gpc_declare_input("dateFrom", $GLOBALS["beenthere"] ? "" : date("Y-m-d"), false);
functions::gpc_declare_input("dateTo", $GLOBALS["beenthere"] ? "" : date("Y-m-d"), false);
functions::gpc_declare_input("timeFrom", "9", false);
functions::gpc_declare_input("timeTo", "18", false);
functions::gpc_declare_input("seatsMin", "", false);
functions::gpc_declare_input("seatsMax", "", false);
$errormessage = "";
$founderror = array();
// --------------------------
// Redirect if selected area 'only Nordita'
// --------------------------
/*
if (!empty($GLOBALS["areaNordita"])) {
$url = "http://rooms.albanova.se/view_week.php?date=" . strtotime($GLOBALS["dateFrom"]." 02:00:00") . "&area=25";
return "<meta http-equiv='refresh' content='0;URL=".$url."'>\r\n";
}
*/
if ($GLOBALS["beenthere"]) {
// --------------------------
// Adapt indata
// --------------------------
$GLOBALS["dateToAct"] = empty($GLOBALS["dateTo"]) ? $GLOBALS["dateFrom"] : $GLOBALS["dateTo"];
$GLOBALS["seatsMinAct"] = empty($GLOBALS["seatsMin"]) ? "1" : $GLOBALS["seatsMin"];
$GLOBALS["seatsMaxAct"] = empty($GLOBALS["seatsMax"]) ? "9999" : $GLOBALS["seatsMax"];
$GLOBALS["fromAlbaNova"] = !empty($GLOBALS["areaAlbanova"]) ? true : false;
$GLOBALS["fromKthCampus"] = !empty($GLOBALS["areaKth"]) ? true : false;
// --------------------------
// Check for errors
// --------------------------
if (empty($GLOBALS["areaAlbanova"]) && empty($GLOBALS["areaKth"])) {
$founderror["areaAlbanova"] = $founderror["areaKth"] = 1;
$errormessage .= " <p class='red bold'>» " . "Please select at least one area." . "</p>\r\n";
}
if (empty($GLOBALS["dateFrom"])) {
$founderror["dateFrom"] = 1;
$errormessage .= " <p class='red bold'>» " . "Please fill in a start date." . "</p>\r\n";
} else {
if (!preg_match("/(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/", $GLOBALS["dateFrom"], $res) || !checkdate($res[2], $res[3], $res[1])) {
$founderror["dateFrom"] = 1;
$errormessage .= " <p class='red bold'>» " . "The start date '<em>" . $GLOBALS["dateFrom"] . "</em>' looks a bit funny." . "</p>\r\n";
}
}
if (!empty($GLOBALS["dateTo"]) && (!preg_match("/(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)/", $GLOBALS["dateTo"], $res) || !checkdate($res[2], $res[3], $res[1]))) {
$founderror["dateTo"] = 1;
$errormessage .= " <p class='red bold'>» " . "The final date '<em>" . $GLOBALS["dateTo"] . "</em>' looks a bit funny (leave empty for same as start date)." . "</p>\r\n";
}
if (!isset($founderror["dateFrom"]) && !isset($founderror["dateTo"]) && $GLOBALS["dateFrom"] > $GLOBALS["dateToAct"]) {
$founderror["dateFrom"] = $founderror["dateTo"] = 1;
$errormessage .= " <p class='red bold'>» " . "The start and end dates for the chosen period seem a bit backward." . "</p>\r\n";
}
if (!empty($GLOBALS["timeFrom"]) && (!is_numeric($GLOBALS["timeFrom"]) || !is_int($GLOBALS["timeFrom"] + 0) || $GLOBALS["timeFrom"] < 0)) {
$founderror["timeFrom"] = 1;
$errormessage .= " <p class='red bold'>» " . "The start time '<em>" . $GLOBALS["timeFrom"] . "</em>' looks a bit funny." . "</p>\r\n";
}
if (!empty($GLOBALS["timeTo"]) && (!is_numeric($GLOBALS["timeTo"]) || !is_int($GLOBALS["timeTo"] + 0) || $GLOBALS["timeTo"] < 0)) {
$founderror["timeTo"] = 1;
$errormessage .= " <p class='red bold'>» " . "The end time '<em>" . $GLOBALS["timeTo"] . "</em>' looks a bit funny." . "</p>\r\n";
}
if (!isset($founderror["timeFrom"]) && !isset($founderror["timeTo"]) && $GLOBALS["timeFrom"] > $GLOBALS["timeTo"]) {
$founderror["timeFrom"] = $founderror["timeTo"] = 1;
$errormessage .= " <p class='red bold'>» " . "The start and end times seem a bit backward (leave empty for default values 9-18)." . "</p>\r\n";
}
if (!empty($GLOBALS["seatsMin"]) && (!is_numeric($GLOBALS["seatsMin"]) || !is_int($GLOBALS["seatsMin"] + 0) || $GLOBALS["seatsMin"] < 0)) {
$founderror["seatsMin"] = 1;
$errormessage .= " <p class='red bold'>» " . "The minimum number of seats '<em>" . $GLOBALS["seatsMin"] . "</em>' looks a bit funny." . "</p>\r\n";
}
if (!empty($GLOBALS["seatsMax"]) && (!is_numeric($GLOBALS["seatsMax"]) || !is_int($GLOBALS["seatsMax"] + 0) || $GLOBALS["seatsMax"] < 0)) {
$founderror["seatsMax"] = 1;
$errormessage .= " <p class='red bold'>» " . "The maximum number of seats '<em>" . $GLOBALS["seatsMax"] . "</em>' looks a bit funny." . "</p>\r\n";
}
if (!isset($founderror["seatsMin"]) && !isset($founderror["seatsMax"]) && $GLOBALS["seatsMinAct"] > $GLOBALS["seatsMaxAct"]) {
$founderror["seatsMin"] = $founderror["seatsMax"] = 1;
$errormessage .= " <p class='red bold'>» " . "The minimum and maximum requirements for seating seem a bit backward (leave empty for listing all rooms)." . "</p>\r\n";
}
// --------------------------
// Output form, with error messages if there are errors, and if no errors, also output list
// --------------------------
$stdout .= self::outputRoomsAvailabilityForm($errormessage, $founderror);
if (!array_sum($founderror)) {
$stdout .= self::outputRoomsAvailabilityResult();
}
} else {
// end if (beenthere)
// --------------------------
// Output form during first run
// --------------------------
$stdout .= self::outputRoomsAvailabilityForm();
}
// --------------------------
//.........这里部分代码省略.........
示例8: parseVisitorsFile
public static function parseVisitorsFile()
{
$stdout = $errormessage = $pagecontent = "";
$founderror = array();
$cachefile = CACHE_DIR . "/delete.me.nordita_parse.txt";
functions::gpc_declare_input("plain", 0, true);
functions::gpc_declare_input("beenthere", 0, true);
$showform = 1;
if ($GLOBALS["plain"] && file_exists($cachefile)) {
$pagecontent = file_get_contents($cachefile);
if (!empty($pagecontent)) {
print $pagecontent;
}
die;
}
if ($GLOBALS["beenthere"]) {
functions::gpc_declare_input("filename", "", false);
// Check for errors in input
if ($_FILES["filename"]["error"]) {
$founderror["filename"] = 1;
switch ($_FILES["filename"]["error"]) {
case UPLOAD_ERR_INI_SIZE:
$message = "The uploaded file is too large. Please upload a file smaller than " . ini_get("upload_max_filesize") . "";
break;
case UPLOAD_ERR_FORM_SIZE:
$message = "The uploaded file is too large. Please upload a file smaller than " . NEWS_MAX_FILESIZE . "";
break;
case UPLOAD_ERR_PARTIAL:
$message = "The uploaded file was only partially uploaded";
break;
case UPLOAD_ERR_NO_FILE:
$message = "No file was uploaded";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = "Missing a temporary folder";
break;
case UPLOAD_ERR_CANT_WRITE:
$message = "Failed to write file to disk";
break;
case UPLOAD_ERR_EXTENSION:
$message = "File upload stopped by extension";
break;
default:
$message = "Unknown upload error";
break;
}
$errormessage .= "<p>" . $message . "</p>\r\n";
} elseif (empty($_FILES["filename"]["tmp_name"]) || !file_exists($_FILES["filename"]["tmp_name"])) {
$founderror["filename"] = 1;
$errormessage .= "<p>No file was uploaded</p>\r\n";
} elseif (file_exists($_FILES["filename"]["tmp_name"])) {
$pagecontent = file_get_contents($_FILES["filename"]["tmp_name"]);
if ($pagecontent == FALSE) {
$founderror["filename"] = 1;
$errormessage .= "<p>Failed to upload the file " . $_FILES["filename"]["name"] . "</p>\r\n";
} elseif (!preg_match("#^text/#", $_FILES["filename"]["type"])) {
$founderror["filename"] = 1;
$errormessage .= "<p>Please upload a <em>text</em> file</p>\r\n";
} elseif (strpos($pagecontent, "--- Assistant") === FALSE) {
$founderror["filename"] = 1;
$errormessage .= "<p>Please upload a file with visitors data</p>\r\n";
}
}
if (array_sum($founderror)) {
// If errors found, display form with error messages
$stdout .= "<div class='box error padding background'>" . $errormessage . "</div>\r\n";
$showform = 1;
} else {
$pagecontent = preg_replace("%[\r\n]%", "\r<br>", $pagecontent);
$pagecontent = preg_replace("%-\\s*(20\\d\\d)%", "\\1", $pagecontent);
$pagecontent = preg_replace("%\\s+(20\\d\\d)%", "[\\1]", $pagecontent);
$pagecontent = preg_replace("%--- Assistant Professor in theoretical condensed matter physics[^G]*US,US,US,US,ADAM,Shaffique%i", "--- Assistant Professor in Theoretical Condensed Matter Physics [2012]<br>US,US,US,US,ADAM,Shaffique", $pagecontent);
$pagecontent = preg_replace("%--- Assistant Professor in theoretical condensed matter physics[^G]*GB,SE,GB,GB,ABERGEL,David%i", "--- Assistant Professor in Theoretical Condensed Matter Physics [2013]<br>GB,SE,GB,GB,ABERGEL,David", $pagecontent);
$pagecontent = preg_replace("%--- Post-doc on Turbulence in Polymer Solutions[\r\n]%", "Postdoc on Turbulence in Polymer Solutions [2012]", $pagecontent);
$pagecontent = preg_replace("%--- Assistant Professor in Theoretical Astro-Particle Physics or Cosmology[\r\n]%", "--- Assistant Professor in Theoretical Astro-Particle Physics or Cosmology [2013]", $pagecontent);
$pagecontent = preg_replace("%--- Postdoc in theoretical condensed matter physics[\r\n]%", "Postdoc in Theoretical Condensed Matter Physics [2013]", $pagecontent);
$pagecontent = str_ireplace("--- Optimal processes in small systems under thermal noise", "--- PhD in Statistical Physics/Biological Physics [2013]", $pagecontent);
$pagecontent = preg_replace("%--- Assistant professor in theoretical high-energy physics[\r\n]%", "--- Assistant Professor in Theoretical High-Energy Physics [2014]", $pagecontent);
$pagecontent = str_ireplace("--- Visiting PhD Fellowships", "--- Visiting PhD Student Fellowships", $pagecontent);
$pagecontent = str_ireplace("PhD on Topological phases of matter", "PhD in Topological Phases of Matter", $pagecontent);
$pagecontent = str_ireplace("student Fellowships", "Student Fellowships", $pagecontent);
$pagecontent = str_ireplace("theoretical", "Theoretical", $pagecontent);
$pagecontent = str_ireplace("physics", "Physics", $pagecontent);
$pagecontent = str_ireplace("condensed matter", "Condensed Matter", $pagecontent);
$pagecontent = str_ireplace("professor", "Professor", $pagecontent);
$pagecontent = str_ireplace("high-energy", "High-Energy", $pagecontent);
$pagecontent = str_ireplace("post-doc", "Postdoc", $pagecontent);
$pagecontent = str_ireplace("masterclass", "Masterclass", $pagecontent);
$stdout .= "<p class='box padding blackborder'>" . $pagecontent . "</p>\r\n";
$showform = 0;
$fp = fopen($cachefile, "w");
fwrite($fp, $pagecontent);
fclose($fp);
header("X-Robots-Tag: noindex, nofollow");
header("Cache-control: public, no-cache, must-revalidate");
header("Expires: " . gmdate(RFC_TIME_FORMAT, time()));
header("Location: " . $_SERVER["PHP_SELF"] . "?plain=1");
die;
// $GLOBALS["documentClass"]->setConfig("contenttype","plain");
}
//.........这里部分代码省略.........
示例9: outputSlideshow
private static function outputSlideshow()
{
$stdout = "";
// -------------------
// -- Construct configuration parameters
// -------------------
if (preg_match("~.*/" . PHOTO_URI . "/(.*)/index.php\$~U", $_SERVER["PHP_SELF"], $tmp)) {
self::$subdir = PHOTO_URI . "/" . $tmp[1];
} else {
self::$subdir = PHOTO_URI . "/nordita";
}
self::$imgpath = PATH_PHOTOS . "/" . $GLOBALS["documentClass"]->getPageCrumb();
if (!file_exists(INCLEVEL . self::$imgpath)) {
return "<p style='color:#f2bcbc'><strong>»</strong> <em>No images were found!</em></p>\r\n";
}
self::$filenames = self::collectFilenames();
self::$numberOfImages = count(self::$filenames);
if (self::$numberOfImages == 0) {
return "<p style='color:#f2bcbc'><strong>»</strong> <em>No images were found!</em></p>\r\n";
}
if (isset(self::$thumbWidth)) {
self::$thumbsHorizontally = min(self::$thumbsHorizontally, floor(self::$thumbs_table_width / self::$thumbWidth));
} else {
self::$thumbHeight = 64;
self::$thumbWidth = 64;
}
self::$thumbsMaxDisplayed = self::$thumbsVertically * self::$thumbsHorizontally;
self::$copyright = "(c)" . " " . (!empty(self::$copyright) ? self::$copyright : "2001-" . date("Y")) . " " . (!empty(self::$photographer) ? self::$photographer : "Nordita") . "";
functions::gpc_declare_input("tum", "false", true);
self::$showThumbnails = $GLOBALS["tum"];
functions::gpc_declare_input("nr", 1);
self::$nr = $GLOBALS["nr"] < 0 || $GLOBALS["nr"] > self::$numberOfImages ? 1 : $GLOBALS["nr"];
// -------------------
// -- Output slideshow
// -------------------
$stdout .= "<div id='slideshow'>\r\n\r\n";
if (self::$enableVerboseDisplay) {
if (self::$showThumbnails && !empty(self::$eventDate)) {
$stdout .= "<h3>" . self::$eventDate . "</h3>\r\n\r\n";
}
if (self::$showThumbnails && !empty(self::$introText)) {
$stdout .= "<p><strong>" . self::$introText . "</strong></p>\r\n";
}
if (self::$showThumbnails && !empty(self::$photographer)) {
$stdout .= "<p><i>Photos</i>: " . self::$copyright . ".</p>\r\n";
}
}
if (self::$showThumbnails) {
$stdout .= self::outputThumbnails();
} else {
$stdout .= self::outputOneImage();
}
$stdout .= "</div> <!-- end slideshow -->\r\n\r\n";
return $stdout;
}
示例10: OutputWikiCategories
static function OutputWikiCategories()
{
$stdout = "";
$dbWiki = new fromdb_nwwiki();
$data = $dbWiki->get_categories();
ksort($data);
$flera = $ansvarig = array();
foreach ($data as $namn => $sidor) {
if (!in_array($namn, array("Obsolete", "Newsletter"))) {
foreach ($sidor as $key => $sida) {
if (isset($sida["wikititle"])) {
$ansvarig[$namn][$sida["wikititle"]] = $sida;
$flera[$sida["wikititle"]][] = $namn;
}
}
}
}
// ----------------------
$selectform = " <div class='col-content-left2thirds only_online'>\r\n" . functions::OutputWikiPage('0', '2467') . " <ul class='tightlist'><li><a href='http://wiki.nordita.org/index.php/Special:Uncategorizedpages'" . " target='a" . rand(10000, 99999) . "'" . ">List of active wiki pages which <strong>have no responsible assigned</strong></a> <br>[the list should be empty!]</li></ul>\r\n" . " </div>\r\n" . " <div class='col-content-right1third divider only_online'>\r\n" . " <h4>Show pages belonging to these <span class='nowrap'>areas of responsibility:</span></h4>\r\n";
foreach ($ansvarig as $namn => $sidor) {
$selectform .= " <form action='" . $_SERVER["PHP_SELF"] . "' method='post' class='only_online'>" . " <p style='font-size:medium;display:list-item;list-style-type:disc;margin:0.5em 0 0 2em'>" . "<input class='fakelink bold' style='font-size:medium' " . "type='submit' name='ansvarslista_select' value='" . $namn . "'></p>" . " <input type='hidden' name='ansvarslista' value='1'>" . " </form>";
}
/*
$selectform .=
" <form id='selectmenu' action='".$_SERVER["PHP_SELF"]."' method='post' class='only_online'>" .
" <div class='input shadow-whiteinset'><span>Visa:</span>";
foreach ($ansvarig as $namn => $sidor) {
$selectform .=
" <input type='radio' name='ansvarslista_select' value='".$namn."'> " . $namn;
}
$selectform .=
" </div>" .
" <div class=''>" .
" <input type='submit' value='Välj ansvarig'>" .
" <input type='hidden' name='ansvarslista' value='1'>" .
" </div>" .
" </form>";
*/
$selectform .= " </div>\r\n" . " <div style='clear:both'><br></div>\r\n" . functions::gpc_declare_input("ansvarslista", false, true);
functions::gpc_declare_input("ansvarslista_select", "", false, array_keys($ansvarig));
if (isset($GLOBALS["ansvarslista"]) && isset($GLOBALS["ansvarslista_select"]) && isset($ansvarig[$GLOBALS["ansvarslista_select"]])) {
ksort($ansvarig[$GLOBALS["ansvarslista_select"]]);
foreach ($ansvarig[$GLOBALS["ansvarslista_select"]] as $key => $sida) {
$content = $dbWiki->getWikiPage($sida["wikiid"]);
$content = trim(preg_replace("/(\\[?\\[[^\\]]*\\]\\]?)/", "", strip_tags($content)));
$ansvarig[$GLOBALS["ansvarslista_select"]][$key]["antal"] = strlen($content);
}
$stdout .= self::outputWikiCategoriesAux($GLOBALS["ansvarslista_select"], $ansvarig[$GLOBALS["ansvarslista_select"]], $flera);
}
// ----------------------
return $selectform . $stdout . "\r\n";
}
示例11: OutputSubmitPreprints
public static function OutputSubmitPreprints()
{
if (IS_LOCALHOST) {
print_rrr();
debug::rr($_FILES);
}
$stdout = "";
self::loadClass(PREPRINT_DATA_SOURCE_DB);
// --> $GLOBALS["preprintClass"]
// --------------------------------
// -- GPC INDATA
// $vname, $default, $bool, $allowed, $set_session, $strip_tags
// --------------------------------
functions::gpc_declare_input("bt", 0, TRUE, array(), FALSE, TRUE);
// functions::gpc_declare_input("di", 0,TRUE,array(),FALSE,TRUE);
functions::gpc_declare_input("cancel", 0, TRUE, array(), FALSE, TRUE);
functions::gpc_declare_input("pp_authors", "", FALSE, array(), FALSE, TRUE);
functions::gpc_declare_input("pp_field", "", FALSE, array(), FALSE, TRUE);
// functions::gpc_declare_input("pp_file", "", FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_journal", "", FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_location", "", FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_nr", "", FALSE,array(), FALSE,TRUE);
functions::gpc_declare_input("pp_owneruid", 0, FALSE, array(), FALSE, TRUE);
// functions::gpc_declare_input("pp_tm", 0, FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_rowid", 0, FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_status", "", FALSE,array(), FALSE,TRUE);
functions::gpc_declare_input("pp_title", "", FALSE, array(), FALSE, TRUE);
// functions::gpc_declare_input("pp_year", date("Y"), FALSE,array(), FALSE,TRUE);
// functions::gpc_declare_input("pp_confirmed", 0, TRUE, array(), FALSE,TRUE);
if (!$GLOBALS["cancel"] && !empty($GLOBALS["pp_editmode"]) && $GLOBALS["pp_editmode"] != PP_MODE_RESERVE && empty($GLOBALS["pp_rowid"])) {
return $stdout . "<div class='medwide-box'>\r\n" . BLURB_SORRY_PREPRINT_SINGLE . "</div>\r\n";
}
// --------------------------------
// -- OBTAIN DATA
// --------------------------------
// --------------------------------
// -- OUTPUT DATA
// --------------------------------
$stdout .= self::drawReservePreprint();
// ----------------------------
return $stdout;
}
示例12: OutputRoomsEditor
public static function OutputRoomsEditor()
{
return "<div class='box error background bold padding'>UNDER CONSTRUCTION</div>";
$stdout = "";
$showform["list"] = 1;
$showform["edit"] = $showCacheUpdateLink = 0;
$error = $warning = $founderror = array();
functions::gpc_declare_input("edit", false, true);
functions::gpc_declare_input("delete", false, true);
functions::gpc_declare_input("c", "", false);
// $confId
functions::gpc_declare_input("e", false, true);
functions::gpc_declare_input("u", false, true);
functions::gpc_declare_input("d", false, true);
functions::gpc_declare_input("menulookup", false, true);
// ----------------------------------------------------------------
// -- If 'recreate menulookup cache' requested
// ----------------------------------------------------------------
if ($GLOBALS["menulookup"]) {
if (document::recreateMenulookupCache()) {
$stdout .= "\r\n" . functions::boxMessage("confirm", "<strong>Cache 'menulookup'</strong> was successfully recreated.") . "\r\n";
} else {
$stdout .= "\r\n" . functions::boxMessage("error", "<strong>Cache 'menulookup'</strong> could not be recreated") . "\r\n";
}
}
// ----------------------------------------------------------------
// -- If 'edit' requested
// ----------------------------------------------------------------
if ($GLOBALS["edit"]) {
$showform["list"] = 0;
// --------------------------------
// -- GPC handling
// --------------------------------
functions::gpc_declare_input("title", "", false);
functions::gpc_declare_input("eventtype", "0", false);
functions::gpc_declare_input("subpath", "", false);
functions::gpc_declare_input("venue", "", false);
functions::gpc_declare_input("surveyid", "0", false);
functions::gpc_declare_input("surveyresponse", "", false);
functions::gpc_declare_input("youtube", "", false);
functions::gpc_declare_input("blurb", "", false);
// --------------------------------
// -- Check for errors in input
// --------------------------------
///debug::rrr();
if (!in_array($GLOBALS["eventtype"], event::$eventTypeId)) {
$founderror["eventtype"] = 1;
$error[] = "Please select an event type.";
}
if (empty($GLOBALS["subpath"])) {
$founderror["subpath"] = 1;
$error[] = "Please write a non-empty subpath.";
}
// --------------------------------
// -- If errors found, display form with error messages and warnings
// --------------------------------
if (!empty($error)) {
$stdout .= functions::boxMessage("error", $error);
$GLOBALS["e"] = 1;
}
if (!empty($warning)) {
$stdout .= functions::boxMessage("warning", $warning);
$GLOBALS["e"] = 1;
}
// --------------------------------
// -- If no errors, update database with submitted data
// --------------------------------
if (empty($error)) {
$record = array("confid" => $GLOBALS["c"], "title" => $GLOBALS["title"], "eventtype" => $GLOBALS["eventtype"], "subpath" => $GLOBALS["subpath"], "venue" => $GLOBALS["venue"], "surveyid" => $GLOBALS["surveyid"], "surveyresponse" => $GLOBALS["surveyresponse"], "youtube" => $GLOBALS["youtube"], "blurb" => $GLOBALS["blurb"]);
$res = false;
//TODO
/*
$res = $this->updateEventManualData($record);
*/
if (!$res) {
$stdout .= "\r\n" . functions::boxMessage("error", "Could not update the event") . "\r\n";
$GLOBALS["e"] = 1;
$showCacheUpdateLink = 0;
} else {
$stdout .= "\r\n" . functions::boxMessage("confirm", "The event was successfully updated.") . "\r\n";
$GLOBALS["e"] = 1;
$showCacheUpdateLink = 1;
}
}
// end if ($error)
}
// end if
if ($GLOBALS["e"]) {
$showform["list"] = 0;
$stdout .= self::outputRoomsEditorForm($GLOBALS["c"], $founderror, $error, $showCacheUpdateLink);
}
// end if ($GLOBALS["e"])
// ----------------------------------------------------------------
// -- If 'update from Agenda' requested
// ----------------------------------------------------------------
if ($GLOBALS["u"]) {
$showform["list"] = 0;
// --------------------------------
// -- GPC handling
// --------------------------------
//.........这里部分代码省略.........
示例13: analyzeOauthResponse
public static function analyzeOauthResponse($returnUrl, $domain)
{
$_SESSION["oauth_access_token"] = "";
// -- (1) OAuth return values from first call (validation)
// $_REQUEST["state"]
// $_REQUEST["code"]
functions::gpc_declare_input("code", "", false, array(), false);
functions::gpc_declare_input("state", "", false, array(), false);
$GLOBALS["oauth_state"] = $GLOBALS["state"];
functions::gpc_declare_input("error", "", false, array(), false);
functions::gpc_declare_input("error_reason", "", false, array(), false);
functions::gpc_declare_input("error_description", "", false, array(), false);
switch ($domain) {
case "facebook":
$accessTokenUrl = "https://graph.facebook.com/oauth/access_token?" . "redirect_uri=" . urlencode($returnUrl) . "&client_id=" . FACEBBOK_NEWS_APP_ID . "&client_secret=" . FACEBBOK_NEWS_APP_SECRET . "&code=" . $GLOBALS["code"];
$authorizeUrl = "https://graph.facebook.com/me";
break;
case "twitter":
$accessTokenUrl = "https://api.twitter.com/oauth/access_token?" . "redirect_uri=" . urlencode($returnUrl) . "&client_id=" . FACEBBOK_NEWS_APP_ID . "&client_secret=" . FACEBBOK_NEWS_APP_SECRET . "&code=" . $GLOBALS["code"];
$authorizeUrl = "https://api.twitter.com/oauth/authorize";
break;
}
if (OPENIDDEBUG) {
echo "<hr><h4>START OAUTH RESPONSE:</h4>state=";
var_dump($GLOBALS["state"]);
echo "<br><br>SESSION(state)=";
if (isset($_SESSION["oauth_state"])) {
var_dump($_SESSION["oauth_state"]);
} else {
echo "-";
}
echo "<br><br>code=";
var_dump($GLOBALS["code"]);
}
if (!empty($GLOBALS["error"])) {
//TODO:
if (OPENIDDEBUG) {
echo "<br>OAUTH ERROR: ";
var_dump($GLOBALS["error"]);
var_dump($GLOBALS["error_reason"]);
var_dump($GLOBALS["error_description"]);
}
if (OPENIDDEBUG) {
echo "<h4>END OAUTH RESPONSE</h4><hr>";
}
return false;
}
if (isset($_SESSION["oauth_state"]) && $_SESSION["oauth_state"] === $GLOBALS["state"]) {
$response = functions::acurl($accessTokenUrl);
// do NOT use file_get_contents()
$params = null;
parse_str($response, $params);
} else {
//TODO: more user-friendly text
if (OPENIDDEBUG) {
echo "<h4>END OAUTH RESPONSE</h4><hr>";
}
return "The state does not match. You may be a victim of CSRF.";
}
// -- (2) OAuth return values from second call (exchange code for access token)
if (isset($params["access_token"])) {
// User data was returned:
$_SESSION["oauth_access_token"] = $params["access_token"];
//$_SESSION["oauth_expires"] = $params["expires"]; // seconds
$authorizeUrl .= "?access_token=" . $params['access_token'];
$user = json_decode(functions::acurl($authorizeUrl));
if (OPENIDDEBUG) {
debug::rr($user);
}
if (OPENIDDEBUG) {
echo "<h4>END OAUTH RESPONSE</h4><hr>";
}
//echo("Hello " . $user->name);
//$user->id
//$user->name
//$user->first_name
//$user->last_name
//Extended:
// email
// picture->url and picture->is_silhouette
$idData["display_identifyer"] = isset($_SESSION["openid_identifier"]) ? $_SESSION["openid_identifier"] : "";
//TODO: fragile:
if (!empty($idData["display_identifyer"])) {
$_SESSION["openid_last_valid_identifier"] = $idData["display_identifyer"];
}
$idData["data"]["nickname"][] = isset($user->name) ? $user->name : "";
// no nickanme available
$idData["data"]["email"][] = isset($user->email) ? $user->email : "";
$idData["data"]["fullname"][] = isset($user->name) ? $user->name : "";
//TODO:
$idData["data"]["image"] = array();
$idData["data"]["guid"] = array();
$idData["data"]["dob"] = array();
$idData["data"]["gender"] = array();
$idData["data"]["postcode"] = array();
$idData["data"]["country"] = array();
$idData["data"]["language"] = array();
$idData["data"]["timezone"] = array();
// Dummy arrays for compatibility with OpenID output
$idData["sreg"] = array();
//.........这里部分代码省略.........
示例14: range
$this->setConfig("logintype", "");
// ----------------------------------------
// -- ACCORDION BOXES
// ----------------------------------------
// -- make sure that all accordion boxes here are also present for SUBSITE="_admin"
$this->setConfigArray("boxes", "", "functions::callMethod('preprint','lib/preprint','OutputRecentPreprints')");
$this->setConfigArray("boxes", "", "functions::callMethod('event','lib/event','EoutputEventUpcoming','all','sidebar-upcoming')");
$this->setConfigArray("boxes", "", "functions::callMethod('event','lib/event','outputEventCurrent','sidebar-current')");
// ----------------------------------------
// -- STARTPAGE
// ----------------------------------------
if (SHOW_TEST_TABS) {
if (!class_exists("functions", FALSE)) {
require_once PATH_CLASSES . "/lib/functions.php";
}
functions::gpc_declare_input("frontselect", 12, false, range(1, 20), false);
}
if (!SHOW_TEST_TABS || !$GLOBALS["frontselect"]) {
$this->setConfigArray("startpage", "", array("col-content-left" => array("functions::callMethod('startpage','lib/startpage','OutputStartboxResearch','sampler-research','large','','0','imagerow','2')")));
$this->setConfigArray("startpage", "", array("col-content-right" => array("functions::callMethod('startpage','lib/startpage','OutputStartboxEvents','sampler-events','large','')")));
$this->setConfigArray("startpage", "", array("col-content-left" => array("functions::callMethod('startpage','lib/startpage','outputStartboxResearchSampler','Research Sampler','tab sampler','')")));
$this->setConfigArray("startpage", "", array("col-content-right" => array("functions::callMethod('startpage','lib/startpage','outputStartboxEventsSampler','Events Sampler','tab sampler','')")));
} elseif (isset($GLOBALS["frontselect"])) {
switch ($GLOBALS["frontselect"]) {
case 1:
$this->setConfigArray("startpage", "", array("col-content-left" => array("functions::callMethod('startpage','lib/startpage','OutputStartboxEvents','sampler-events','large','box roundcorners grayborder shadow lift')")));
$this->setConfigArray("startpage", "", array("col-content-right" => array("functions::callMethod('startpage','lib/startpage','OutputStartboxResearch','sampler-research','large','box roundcorners grayborder shadow lift','0','imagerow','2')")));
$this->setConfigArray("startpage", "", array("col-content-left" => array("functions::callMethod('startpage','lib/startpage','outputStartboxEventsSamplerPlain')")));
$this->setConfigArray("startpage", "", array("col-content-right" => array("functions::callMethod('preprint','lib/preprint','OutputRecentPreprints','sampler-research-preprint','modest','','1')")));
break;
case 2:
示例15: searchPeople
static function searchPeople($wid = "people-list", $class = "", $addClosingDiv = false)
{
/* DEBUG */
return "</div><div style='clear:both'><br></div>\r\n\r\n";
/* DEBUG */
$stdout = "";
functions::gpc_declare_input("beenthere", false, true);
functions::gpc_declare_input("pqry", "");
if (strpos($GLOBALS["pqry"], "Name, e-mail or phone") !== false) {
$GLOBALS["pqry"] = "";
}
$form = " <form id='peoplesearchform' method='post' action='people/search/index.php'>\r\n" . " <input " . "type='search' " . "name='pqry' id='pqry' " . "" . (!empty($GLOBALS["pqry"]) ? "value='" . $GLOBALS["pqry"] . "' " : "placeholder=' Name, e-mail or phone' ") . "size='25'>" . ($addClosingDiv ? "" : " <br>\r\n") . " <input type='submit' value='Search Nordita Staff'>\r\n" . " <input type='hidden' name='beenthere' value='1'>\r\n" . " <input type='hidden' name='variant' value='peoplesearch'>\r\n" . " <input type='hidden' name='peoplelist_sortby' value='nw_name'>\r\n" . " <input type='hidden' name='peoplelist_displayas' value='list'>\r\n" . " </form>\r\n";
$error = false;
if ($GLOBALS["beenthere"]) {
//echo "<br>qry=".$GLOBALS["pqry"];
if (empty($GLOBALS["pqry"])) {
$error = true;
}
// Further error messages...
}
if (!$error && $GLOBALS["beenthere"]) {
functions::gpc_declare_input("peoplelist_sortby", "nw_firstname", false, array_keys(self::$allowed["peoplelist_sortby"]), false);
functions::gpc_declare_input("peoplelist_displayas", "list", false, array_keys(self::$allowed["peoplelist_displayas"]), false);
$stdout .= self::getSearchAndOutputPeople($GLOBALS["pqry"], $GLOBALS["peoplelist_displayas"], $wid, $class, $doctitle);
/*
$wid = "people-list";
$elementid = array("nw_fullname_reverse_sortable");
$doctitle = "Search Results"; // Staff Currently Present at Nordita";
if (!isset($GLOBALS["peopleClass"])) self::loadClass(PEOPLE_DATA_SOURCE_DB); // --> $GLOBALS["peopleClass"]
$userarray = self::getPeopleArray("search",$GLOBALS["pqry"]);
if (empty($userarray)) return $form . BLURB_SORRY_PEOPLE_SEARCH;
$userarrayMod = self::adaptForOutput($userarray,$wid,$class,$elementid);
$stdout .= self::outputPeopleList('all',$GLOBALS["peoplelist_displayas"],$wid,$class,$doctitle,$elementid,$userarrayMod);
*/
}
// end if
if ($addClosingDiv) {
return "<h3 class='bottommargin'>Search For People at Nordita</h3>\r\n\r\n" . $form . $stdout . "</div><div style='clear:both'><br></div>\r\n\r\n";
} else {
return $form . $stdout;
}
}