Пример #1
0
 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="******"usr"] . "#text'><strong>text signature</strong></a></li>\r\n" . "    <li class='bottommargin'>Select a <a href='" . $_SERVER["PHP_SELF"] . "?usr="******"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
0
//   $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
0
 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 &mdash; " . $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
0
 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'>&#187; 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
0
 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
0
 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;
     }
     // end if (authenticate())
     // -----------------------
     // -- Check access rights for user to this page, and return error if no access rights
     // -----------------------
     //TODO...
     // -----------------------
     return isset($GLOBALS["nw_loginerror"]) ? false : true;
 }
Пример #7
0
  $GLOBALS[$theid]["minimenu"] = array(
    "label"   => "Mini Menu",
    "cond"    => isset($_SESSION["minimenu"]) && $_SESSION["minimenu"],
    "default" => array("value" => 0, "label" => "off"),
    "toggled" => array("value" => 1, "label" => "on&nbsp;")
  );
*/
// -----------------------
// -- DEBUG BACKGROUND IMAGE WITH SCREEN RESOLUTION FIELDS
//    Effectuated by adding class 'screenresolution' to <body> tag. This is done
//    in document->OutputPage()
//    Toggling also possible from link in debug menu defined in widget::WdebugMenu()
// -----------------------
$GLOBALS[$theid]["nw_screenresolution"] = array("label" => "Screen Resolution", "cond" => isset($_SESSION["nw_screenresolution"]) && $_SESSION["nw_screenresolution"], "default" => array("value" => 0, "label" => "off"), "toggled" => array("value" => 1, "label" => "on&nbsp;"));
// -----------------------
// -- SHOW BORDERS AROUND <div id='region-*'> BLOCKS
//    Effecutated by including the stylesheet 'debug_regions.css'
// -----------------------
functions::gpc_declare_input("nw_regionborders", false, true, array(), true);
//TODO: it is to late on the loading process for this declaration; perhaps this whole file should be included already in 'layout' or 'document'?
if (isset($_SESSION["nw_regionborders"]) && $_SESSION["nw_regionborders"]) {
    $GLOBALS[SUBSITE]["stylesheets"]["screen"][] = "debug_regions.css";
}
$GLOBALS[$theid]["nw_regionborders"] = array("label" => "Regions", "cond" => isset($_SESSION["nw_regionborders"]) && $_SESSION["nw_regionborders"], "default" => array("value" => 0, "label" => "off"), "toggled" => array("value" => 1, "label" => "on&nbsp;"));
// -----------------------
// -- DEBUG MENU
//    Output by block::BdebugMenu('debugmenu') calling widget::WdebugMenu()
// -----------------------
functions::gpc_declare_input("debugmenu", false, true, array(), true);
$GLOBALS[$theid]["debugmenu"] = array("label" => "Debugmenu", "cond" => isset($_SESSION["debugmenu"]) && $_SESSION["debugmenu"], "default" => array("value" => 0, "label" => "off"), "toggled" => array("value" => 1, "label" => "on&nbsp;"));
Пример #8
0
 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") . "&amp;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'>&#187; " . "Please select at least one area." . "</p>\r\n";
         }
         if (empty($GLOBALS["dateFrom"])) {
             $founderror["dateFrom"] = 1;
             $errormessage .= "          <p class='red bold'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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'>&#187; " . "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();
     }
     // --------------------------
     return $stdout;
 }
Пример #9
0
 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");
         }
     }
     // end if $GLOBALS["beenthere"]
     if ($showform) {
         $stdout .= "<h4>Load data from a file</h4>\r\n" . "<p>Clean up raw data file and present result on screen. [Still needs a lot of manual touch-up]</p>\r\n" . "\r\n" . "<form method='post' action='" . $_SERVER["PHP_SELF"] . "' enctype='multipart/form-data' " . "style='margin-bottom:2em'>\r\n" . "  <p><input type='file' name='filename'" . (isset($founderror["filename"]) ? " class='error'" : "") . (!empty($GLOBALS["filename"]) ? " value='" . $GLOBALS["filename"] . "'" : "") . "></p>\r\n" . "  <p>\r\n" . "    <input type='submit' value='Upload File With Visitors Data'>\r\n" . "    <input type='input' name='" . HONEYTRAP_ID . "' class='osynl'>\r\n" . "    <input type='hidden' name='MAX_FILE_SIZE' value='" . NEWS_MAX_FILESIZE . "'>\r\n" . "    <input type='hidden' name='beenthere' value='1'>\r\n" . "  </p>\r\n" . "</form>\r\n" . "\r\n";
     }
     return $stdout;
 }
Пример #10
0
 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>&#187;</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>&#187;</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;
 }
Пример #11
0
 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."'>&nbsp;" . $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";
 }
Пример #12
0
 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;
 }
Пример #13
0
 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
         // --------------------------------
         // --------------------------------
         // -- Check for errors in input
         // --------------------------------
         if (!is_numeric($GLOBALS["c"]) || $GLOBALS["c"] <= 0) {
             $founderror["confid"] = 1;
             $error[] = "There is some problem with the ID of the event you selected.";
         }
         // --------------------------------
         // -- If errors found, display form with error messages and warnings
         // --------------------------------
         if (!empty($error)) {
             $stdout .= functions::boxMessage("error", $error);
             $GLOBALS["u"] = 1;
         }
         if (!empty($warning)) {
             $stdout .= functions::boxMessage("warning", $warning);
             $GLOBALS["u"] = 1;
         }
         // --------------------------------
         // -- If no errors, update database with submitted data
         // --------------------------------
         if (empty($error)) {
             //TODO: keep 01-01 events when updating from Agenda
             $res = false;
             //TODO:
             /*
                     $res = $this->updateOneEventFromAgenda($GLOBALS["c"],TRUE);
             */
             if (!$res) {
                 $stdout .= "\r\n" . functions::boxMessage("error", "Could not update the event with ID=" . $GLOBALS["c"]) . "\r\n";
                 $GLOBALS["u"] = 1;
             } else {
                 $stdout .= "\r\n" . functions::boxMessage("confirm", "The event with <strong>ID=" . $GLOBALS["c"] . "</strong> was successfully updated.") . "\r\n";
                 $GLOBALS["u"] = 1;
             }
         }
         // end if ($error)
         $showform["list"] = 1;
     }
     // end if ($GLOBALS["u"])
     // ----------------------------------------------------------------
     // -- If 'delete' requested
     // ----------------------------------------------------------------
     if ($GLOBALS["delete"]) {
         $showform["list"] = 0;
         // --------------------------------
         // -- GPC handling
         // --------------------------------
         functions::gpc_declare_input("xxx", "", false);
         // --------------------------------
         // -- Check for errors in input
         // --------------------------------
         // --------------------------------
         // -- If errors found, display form with error messages and warnings
         // --------------------------------
         if (!empty($error)) {
             $stdout .= functions::boxMessage("error", $error);
             $GLOBALS["d"] = 1;
         }
         if (!empty($warning)) {
             $stdout .= functions::boxMessage("warning", $warning);
             $GLOBALS["d"] = 1;
         }
         // --------------------------------
         // -- If no errors, update database with submitted data
         // --------------------------------
         if (empty($error)) {
         }
         // end if ($error)
     }
     // end if
     if ($GLOBALS["d"]) {
         $showform["list"] = 0;
         //      $stdout .= self::outputRoomsEditorForm($GLOBALS["c"],$founderror,$error);
         $stdout .= "DELETE" . "  <p class='largefont'><strong>&#171; <a href='" . $_SERVER["PHP_SELF"] . "'>Edit other events</a></strong></p>\r\n";
     }
     // end if ($GLOBALS["d"])
     // --------------------------------
     // -- Output form, if requested
     // --------------------------------
     if ($showform["list"]) {
         $stdout .= self::outputRoomsEditorList();
     }
     // --------------------------------
     return $stdout;
 }
Пример #14
0
 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();
         $idData["ax"] = array();
         $idData["pape"] = array();
         if (OPENIDDEBUG) {
             debug::rr($idData);
         }
         return $idData;
     } else {
         // An error message was returned:
         if (isset($_SESSION["openid_last_valid_identifier"])) {
             unset($_SESSION["openid_last_valid_identifier"]);
         }
         $errorArr = json_decode(stripslashes(current(array_flip($params))));
         if (OPENIDDEBUG) {
             debug::rr($errorArr->error);
         }
         if (OPENIDDEBUG) {
             echo str_replace("_", " ", $errorArr->error->message);
         }
         if (OPENIDDEBUG) {
             echo "<br>END OAUTH RESPONSE<hr>";
         }
         $error_org = htmlspecialchars(str_replace("_", " ", $errorArr->error->message));
         $error_public = "Please try again";
         if (IS_TESTSERVER) {
             $error = ":<br>" . $error_org . (!empty($error_public) ? " (" . $error_public . ")" : "");
         } else {
             $error = !empty($error_public) ? ":<br>" . $error_public : "";
         }
         return "<strong>OpenID authentication failed</strong>" . $error;
     }
 }
Пример #15
0
$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:
Пример #16
0
 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='&nbsp; 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;
     }
 }
Пример #17
0
 public static function NsendAnnouncement($table = "subscriber")
 {
     //debug::rrr();
     $stdout = "";
     $showform = 1;
     $founderror = array();
     self::initiateNewsClass();
     $dbData = $GLOBALS["newsClass"]->getTemplate($table);
     functions::gpc_declare_input("template_id", "0", false);
     functions::gpc_declare_input("send", 0, true);
     functions::gpc_declare_input("doit", 0, true);
     // Assuming the default template is the first in the result array (see: news->getTemplate())
     $defaulttext = !$GLOBALS["send"] && !$GLOBALS["template_id"] && !empty($dbData) && isset($dbData[0]) && $dbData[0]["isdefault"] ? $dbData[0]["text"] : "";
     $defaultsubject = !$GLOBALS["send"] ? "New Issue of Nordita News" : "";
     functions::gpc_declare_input("text", $defaulttext, false);
     functions::gpc_declare_input("subject", $defaultsubject, false);
     if ($GLOBALS["send"]) {
         if (empty($GLOBALS["subject"])) {
             $founderror["subject"] = "Please write a subject for the announcement e-mail";
         }
         if (empty($GLOBALS["text"])) {
             $founderror["text"] = "The announcement message cannot be empty";
         }
         if (count($founderror)) {
             $showform = 1;
         } else {
             $showform = 0;
             $stdout = "<form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='margin-bottom:2em'>\r\n" . "  <p class='messages warning'>Really send anncoucement e-mail to <strong>" . $GLOBALS["newsClass"]->getNumberOfSubscribers() . " people</strong> " . "on the announcement list?</p>\r\n" . "  <p><input type='submit' value='Do It!' style='margin-left:3em'></p>\r\n" . "  <input type='hidden' name='doit' value='1'>\r\n" . "  <input type='hidden' name='subject' value='" . $GLOBALS["subject"] . "'>\r\n" . "  <input type='hidden' name='text' value='" . $GLOBALS["text"] . "'>\r\n" . "</form>\r\n" . PADDED_HR . self::drawLinkBackto($table) . "\r\n";
         }
         // end if ($noerror)
     }
     // end if "send"
     if ($GLOBALS["doit"]) {
         $record = array("subject" => $GLOBALS["subject"], "text" => $GLOBALS["text"]);
         $res = self::sendAnnouncementMail($record);
         if (!$res) {
             $stdout .= "\r\n" . "<p class='messages error bold'>Could not send the announcement e-mail</p>\r\n" . PADDED_HR . "<p class='largefont'>&#171; <a href='" . $_SERVER["PHP_SELF"] . "'>" . "Back to the Announcement E-Mail Editing Page</a></p>\r\n" . "\r\n";
             $showform = 0;
         } else {
             $stdout .= "\r\n" . self::drawAnnouncementConfirmation($record) . PADDED_HR . "<p class='largefont'>&#171; <a href='" . $_SERVER["PHP_SELF"] . "'>" . "Back to the Announcement E-Mail Editing Page</a></p>\r\n" . "\r\n";
             $showform = 0;
         }
     }
     // end if "send"
     if ($showform) {
         $stdout .= self::sendAnnouncementForm($founderror, $dbData);
     }
     return $stdout;
 }
Пример #18
0
 public static function OutputSeminarsNextweek($w = 0)
 {
     $stdout = "";
     $talks_selection = $events = $colloquium = $visits = $contributions = $seminars = $talks = array();
     functions::gpc_declare_input("w", $w, true);
     $delta = $GLOBALS["w"] == 0 ? 7 : 0;
     $saturday1 = date("Y-m-d", time() - 3600 + ($delta - 1 + date("w", time() - 3600)) * 86400);
     $sunday = date("Y-m-d", time() - 3600 + ($delta - date("w", time() - 3600)) * 86400);
     $saturday2 = date("Y-m-d", time() - 3600 + ($delta + 7 - date("w", time() - 3600)) * 86400);
     $agenda_timespan = $GLOBALS["w"] == 0 ? "nextweek" : "thisweek";
     // ----------------------
     // Obtain data from VM DB: records for visitors outside events
     // ----------------------
     $visits = functions::callMethod('fromdb_vm', 'fromdb/vm', 'getArrivingVisitors', "extweek", $GLOBALS["w"]);
     // 'extweek' = extended week
     // ----------------------
     // Obtain data from Agenda DB: seminars and colloquium
     // ----------------------
     //@@@ -- VERKAR OK -- in OutputSeminarsNextweek() -- calls getTalkRecordsSeminars+getTalkRecordsColloquium
     // ----------------------
     // Obtain data from nw_events DB: programs and other events, and talks inside these events
     // ----------------------
     $events = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventsInPeriod', $agenda_timespan);
     $seminars = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getTalkRecordsSeminars', $agenda_timespan);
     $colloquium = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getTalkRecordsColloquium', $agenda_timespan);
     $contributions = functions::callMethod('fromdb_nwevents', 'fromdb/nwevents', 'getEventContributionsInPeriod', $agenda_timespan);
     // ----------------------
     // Postparsing of seminars data records --> array $talks_selection[]
     // ----------------------
     //    $seminars = self::mergeTalkRecords($seminars,$colloquium);
     //    $talks = self::mergeTalkRecords($seminars,$contributions);
     $talks = self::mergeTalkRecords($colloquium, self::mergeTalkRecords($seminars, $contributions));
     if (isset($talks) && count($talks)) {
         foreach ($talks as $day => $dayevents) {
             if (count($dayevents)) {
                 foreach ($dayevents as $categoryId => $dayevent) {
                     // $dayevent["id"|"end"|"title"]
                     /*
                               if (isset($dayevent["eventtype"])
                                   && in_array(strtolower($dayevent["eventtype"]),
                                      array("nordita program","program","conference","workshop","meeting","school"))
                                  ) {
                     
                                 // -- Nordita event(s)
                     //doesn't seem to work...
                                 $talks_selection[0][] = array(
                                   "title"      => trim($dayevent["title"]),
                                   "eventtype"  => $dayevent["eventtype"],
                                   "startdate"  => $dayevent["startdate"],
                                   "enddate"    => $dayevent["enddate"],
                                   "subpath"    => $dayevent["subpath"],
                                   "id"         => $dayevent["id"],
                                   "categoryid" => $dayevent["categoryid"]
                                 );
                                 unset($talks[$day][$categoryId]);
                     
                               } else {
                     */
                     // -- Seminars
                     unset($sel);
                     if (isset($dayevent["title"])) {
                         $dayevent["title"] = trim($dayevent["title"]);
                     }
                     $sel["heading"] = "";
                     if (isset($dayevent["eventtitle"])) {
                         $sel["heading"] = "Event Talk" . (!empty($dayevent["eventtitle"]) ? " (" . $dayevent["eventtitle"] . ")" : "");
                     }
                     if (isset($dayevent["categoryid"])) {
                         include PATH_DATA . "/agenda_fids.php";
                         // -> $fids[]
                         if (isset($fids)) {
                             if (in_array($dayevent["categoryid"], array_keys($fids["colloquium"]))) {
                                 // -- AN COLLOQUIUM
                                 $sel["heading"] = "The AlbaNova Colloquium";
                             } else {
                                 // -- SEMINARS
                                 foreach ($fids as $group => $farray) {
                                     foreach ($farray as $categoryid => $label) {
                                         if ($categoryid == $dayevent["categoryid"] && (preg_match("/^Seminar\\S*\\s*(.*)\$/i", $label, $res) || preg_match("/^Group meeting\\S*\\s*(.*)\$/i", $label, $res)) && !empty($res[1])) {
                                             $sel["heading"] = $res[1];
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $sel["eventtype"] = isset($dayevent["eventtype"]) ? ucfirst($dayevent["eventtype"]) : "";
                     $sel["period"] = ucfirst($dayevent["period"]);
                     $sel["period"] = $dayevent["starttime"] . (!empty($dayevent["endtime"]) ? "&#8212;" . $dayevent["endtime"] : "");
                     $sel["room"] = isset($dayevent["room"]) ? ucfirst($dayevent["room"]) : "";
                     $sel["title"] = "&quot;" . $dayevent["title"] . "&quot;";
                     $sel["title"] = str_replace("<span class='agenda-programtalk'><span>Event Talk</span></span> ", "", $sel["title"]);
                     //if (isset($dayevent["url"]) && (strpos($dayevent["url"],"contribId")!==false)) $programtalk = "[Program Talk] ";
                     $seltmp = array();
                     if (isset($dayevent["speakers"])) {
                         foreach ($dayevent["speakers"] as $speaker) {
                             $tmp = (!empty($speaker["nw_fullname"]) ? $speaker["nw_fullname"] . " " : "") . (!empty($speaker["av_institute"]) ? "(" . $speaker["av_institute"] . ")" : "");
                             $seltmp[] = trim($tmp);
                         }
                     }
                     $sel["thespeaker"] = implode(", ", $seltmp);
                     $sel["url"] = empty($dayevent["id"]) ? "" : AGENDA_URI . "/" . (isset($dayevent["parent_id"]) ? "contributionDisplay.py?contribId=" . $dayevent["id"] . "&amp;confId=" . $dayevent["parent_id"] : "conferenceDisplay.py?confId=" . $dayevent["id"]);
                     $sel["ical"] = empty($dayevent["id"]) && !isset($dayevent["parent_id"]) ? "" : AGENDA_URI . "/conferenceDisplay.py/ical?confId=" . $dayevent["id"];
                     $talks_selection[$day][$dayevent["starttime"] . ":" . str_pad(rand(0, 999), 3, "0", STR_PAD_LEFT)] = $sel;
                     /*
                               }  // end if
                     */
                 }
                 // end foreach
             }
         }
         // end foreach
     }
     // end if
     ksort($talks_selection);
     foreach (array_keys($talks_selection) as $key) {
         ksort($talks_selection[$key]);
     }
     // ----------------------
     // -- Output data
     // ----------------------
     $stdout .= "            <p class='only_online'>" . "[" . ($GLOBALS["w"] == 0 ? "<a href='" . $_SERVER["PHP_SELF"] . "?w=1' class='bold' rel='nofollow'>This Week</a>" : "This Week") . "]" . "&nbsp;&nbsp;" . "[" . ($GLOBALS["w"] == 1 ? "<a href='" . $_SERVER["PHP_SELF"] . "?w=0' class='bold' rel='nofollow'>Next Week</a>" : "Next Week") . "]" . "</p>\r\n" . "\r\n" . "<pre class='box letter'>\r\n" . "Dear Norditans,\r\n" . "\r\n" . "-------------\r\n\r\n";
     if (count($visits)) {
         $visitortext = "";
         foreach ($visits as $type) {
             if (isset($type["Visitors"])) {
                 foreach ($type["Visitors"] as $v) {
                     $visitortext .= "*" . $v["name"] . "*\r\n" . "  " . $v["affiliation"] . "\r\n" . "  " . $v["dates"] . "\r\n" . "\r\n";
                 }
             }
         }
         $stdout .= ($GLOBALS["w"] == 0 ? "Next" : "This") . " week, Nordita welcomes these guests:\r\n" . "\r\n" . $visitortext . "-------------\r\n\r\n";
     }
     /* "*MONDAY, __________ 2011*
     
        12:30-  Nordita West Seminar Room (122:026)
        ASTRO-PH LUNCH MEETING
        http://wiki.nordita.org/index.php/Astro-ph_Meeting
     
     " . */
     if (empty($talks_selection) && empty($events)) {
         $stdout .= "Nothing of theoretical interest will happen " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week!\r\n" . "-------------\r\n\r\n";
     } else {
         if (!empty($events)) {
             $stdout .= "Major Nordita Events " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n";
             foreach ($events as $key => $ev) {
                 $stdout .= "  During the week, the " . str_replace("nordita", "Nordita", $ev["eventtype"]) . "\r\n" . "  &quot;" . strtoupper($ev["title"]) . "&quot;\r\n" . "  " . ($sunday < $ev["start"] ? "starts on " . functions::readableDateInterval($ev["start"], $ev["start"]) : "continues") . ", and will continue until " . functions::readableDateInterval($ev["end"], $ev["end"]) . ".\r\n";
                 if (!empty($ev["subpath"])) {
                     $stdout .= "  " . URL_PREFIX . "/" . $ev["subpath"] . "\r\n";
                 } elseif (!empty($ev["id"])) {
                     $stdout .= "  http://agenda.albanova.se/conferenceDisplay.py?confId=" . $ev["id"] . "\r\n";
                 }
                 $stdout .= "\r\n";
             }
             $stdout .= "-------------\r\n\r\n";
         }
         if (!empty($talks_selection)) {
             $stdout .= "Here are some of the seminars at Nordita and AlbaNova " . ($GLOBALS["w"] == 0 ? "next" : "this") . " week:\r\n\r\n";
             foreach ($talks_selection as $day => $record) {
                 $stdout .= "*" . strtoupper(date("l, j F Y", strtotime($day))) . "*\r\n\r\n";
                 foreach ($record as $start => $dayevent) {
                     if (count($dayevent)) {
                         if (in_array(strtolower($dayevent["eventtype"]), array("nordita program", "program", "conference", "workshop", "meeting", "school"))) {
                             $stdout .= "    " . ucfirst($dayevent["eventtype"]) . "\r\n" . "    " . $dayevent["period"] . "\r\n" . "\r\n";
                         } else {
                             $stdout .= "   " . (!empty($dayevent["period"]) ? $dayevent["period"] : "") . (!empty($dayevent["room"]) ? "  " . $dayevent["room"] : "") . "\r\n" . (!empty($dayevent["heading"]) ? "     " . strtoupper($dayevent["heading"]) . "\r\n" : "") . (!empty($dayevent["thespeaker"]) ? "     " . $dayevent["thespeaker"] . "\r\n" : "") . (!empty($dayevent["title"]) ? "     " . $dayevent["title"] . "\r\n" : "") . (!empty($dayevent["url"]) ? "     Info: " . $dayevent["url"] . "\r\n" : "") . (!empty($dayevent["ical"]) ? "     Add to calendar: " . $dayevent["ical"] . "\r\n" : "") . "\r\n";
                         }
                     }
                 }
                 // end if
             }
             // end foreach
             $stdout .= "-------------\r\n\r\n";
         }
     }
     // end if (empty($talks_selection))
     // ---------------------- move to suitable class!
     $dbWiki = new fromdb_nwwiki();
     $dbWiki->get_text("Cake");
     $txt = $dbWiki->wikipage_text["text"];
     preg_match_all("~<td>([^<]*)</td>[^<].*<td>([^<]*)</td>~mU", $txt, $res);
     foreach ($res[1] as $ix => $v) {
         $cake[strtotime($v)] = $res[2][$ix];
     }
     $delta = $GLOBALS["w"] == 0 ? 8 : 1;
     $monday = date("Y-m-d", time() - 3600 + ($delta - date("w", time() - 3600)) * 86400);
     $m = strtotime($monday);
     $nextm = $m + 604800;
     $stdout .= "*MONDAY CAKE, " . strtoupper(functions::readableDateInterval($monday, $monday)) . "*\r\n";
     //functions::readableDateInterval($monday,$monday) .
     if (isset($cake[$m]) && strlen($cake[$m]) > 5) {
         $stdout .= "    Cakemaster this week is " . $cake[$m] . ".\r\n";
     } else {
         $stdout .= "    No cakemaster appointed!\r\n";
     }
     if (isset($cake[$nextm]) && strlen($cake[$nextm]) > 5) {
         $stdout .= "    (Cakemaster on " . date("l, F jS", $nextm) . " the following week, will be " . $cake[$nextm] . ".)\r\n";
     }
     $stdout .= "    " . URL_PREFIX . "/cake\r\n";
     // ----------------------
     return str_replace("()", "", $stdout) . "</pre>";
 }
Пример #19
0
 function getDateInterval($confid = 0)
 {
     if (is_array($confid)) {
         return FALSE;
     }
     if (empty($confid)) {
         functions::gpc_declare_input("confid", "", false);
         $confid = $GLOBALS["confid"];
     }
     functions::gpc_declare_input("confid2", "", false);
     $dateinterval = "";
     $datestart = "";
     $dateend = "";
     if (isset($_REQUEST["confid"]) && $_REQUEST["confid"] > 0 || isset($_REQUEST["confid2"])) {
         if (!$_REQUEST["confid"] && isset($_REQUEST["confid2"])) {
             $confid = $GLOBALS["confid2"];
             $GLOBALS["confid"] = $GLOBALS["confid2"];
         }
         $sql = "SELECT\n\t\t   e_start,\n\t\t   e_end\n\t\t FROM\n\t\t   abs_events\n\t\t WHERE\n\t\t   e_code='" . $confid . "'";
         $res = $this->query($sql, IS_TESTSERVER);
         // includes a call to connect
         if ($this->num_rows($res)) {
             while ($r = $this->next_record_assoc($res)) {
                 $dateinterval = functions::readableDateInterval(date("Y-m-d", $r["e_start"]), date("Y-m-d", $r["e_end"]));
                 $datestart = date("Y-m-d", $r["e_start"]);
                 $dateend = date("Y-m-d", $r["e_end"]);
             }
             // end while
         }
     }
     // end if
     return array($dateinterval, $datestart, $dateend);
 }
Пример #20
0
 private static function outputCombinedSearch($queryData, $searchResults, $peopleResult, $wid = "os_main")
 {
     // --------------------------------------------------------------------------
     // -- SETUP VARIABLES
     // --------------------------------------------------------------------------
     // --------------------
     // -- ...
     // --------------------
     $rootUri = "http://" . $_SERVER["HTTP_HOST"] . preg_replace("/\\/[^\\/]*\$/", "/", $_SERVER["PHP_SELF"]);
     // --------------------
     // -- GPC variables, if not already initiated
     // --------------------
     functions::gpc_declare_input("start", 1, false);
     $GLOBALS["start"] = (int) $GLOBALS["start"];
     functions::gpc_declare_input("end", 1, false);
     $GLOBALS["end"] = (int) $GLOBALS["end"];
     // --------------------
     // -- Massage $queryData array
     // --------------------
     $ignoredTerms = "";
     if (isset($queryData["allterms"]) && isset($queryData["terms"])) {
         $ignoredTerms = array_filter(array_diff($queryData["allterms"], $queryData["terms"]));
         $ignoredTerms = ($ignoredTermsCount = count($ignoredTerms)) ? implode(" ", $ignoredTerms) : "";
     }
     if (!isset($queryData["category"]) && isset($GLOBALS["ctg"])) {
         $queryData["category"] = $GLOBALS["ctg"];
     }
     if (!isset($queryData["original"])) {
         $queryData["original"] = "";
     }
     // --------------------
     // -- Massage display page interval
     // --------------------
     if (count($searchResults)) {
         $GLOBALS["start"] = count($searchResults) <= SEARCH_MAX_RESULTS_PER_PAGE ? 1 : $GLOBALS["start"];
         $GLOBALS["end"] = min($GLOBALS["start"] + SEARCH_MAX_RESULTS_PER_PAGE - 1, count($searchResults));
     }
     // --------------------------------------------------------------------------
     // -- PREPARE COMPONENTS OF OUTPUT
     // --------------------------------------------------------------------------
     if (!class_exists("people", FALSE)) {
         require_once PATH_CLASSES . "/lib/people.php";
     }
     $peopleResultList = functions::callMethod('people', 'lib/people', 'OutputPeople', "search", "box", "people-list", "", $peopleResult);
     $peopleResultBlurb = functions::callMethod('people', 'lib/people', 'outputPeopleSearchBlurb', $queryData["original"], count($peopleResult));
     // --------------------
     $pageResultList = self::outputPageSearchResult($searchResults, $rootUri);
     $pageResultBlurb = self::outputPageSearchBlurb($queryData["original"], $queryData["category"], count($searchResults));
     // --------------------
     $searchform = self::searchfieldCombined($queryData["original"], $queryData["category"]);
     $searchtips = "  <ul class='os_searchtips'>\r\n" . (defined(SEARCH_TERMLENGTH) ? "    <li>Search terms with fewer than " . SEARCH_TERMLENGTH . " characters are ignored</li>\r\n" : "") . "    <li>Terms without prefix are treated as optional (logical OR)</li>\r\n" . "    <li>Prefix terms with a plus-sign (+) to make them requred</li>\r\n" . "    <li>Prefix terms with a minus-sign (-) " . "to exclude terms</li>\r\n" . "    <li>Enclose groups of terms in quotes (&quot;&quot;) to search for phrases (only in web page search)</li>\r\n" . "  </ul>\r\n" . "\r\n";
     $messageform = "";
     if ($queryData["category"] != "") {
         $messageform = "  <form action='" . $_SERVER["PHP_SELF"] . "' method='post' class='os_msg'" . " style='margin-top:1em'" . ">\r\n" . "    <strong>&#187;</strong> Try this search in \r\n" . "    <input type='submit' value='all Nordita web subsites' class='fakelink bold'>?\r\n" . "    <input type='hidden' name='qry' " . "value='" . htmlspecialchars($queryData["original"]) . "'>\r\n" . "    <input type='hidden' name='ctg' value=''>\r\n" . "  </form>\r\n" . "\r\n";
         //"<a href='" . $_SERVER["PHP_SELF"] . "?qry=".htmlspecialchars($queryData["original"])."'>all categories</a>" .
     }
     // --------------------
     // -- CREATE
     //      $output1   - top search form, or empty if there are errors
     //      $message[] - instructions if first run, error messages if there are errors, or empty if success
     //      $output2   - search results if success, bottom form if not first run, always instructions
     // --------------------
     $message = array();
     $output1 = $output2 = "";
     /*
         // --------------------
         // Case: No DB Connection
         // --------------------
         if (!$GLOBALS["DDATA"]["online"]) {
     
           $message[] =
             "Could not establish a connection to the database.\r\n" .
             "<br><em>" . $GLOBALS["DDATA"]["errno"] . ": " . $GLOBALS["DDATA"]["error"] . "</em>";
     
         // --------------------
         // Case: DB Locked
         // --------------------
         } else if ($searchResults === NULL) {
     
            $message[] =
              "The search database is currently being updated; " .
              "please try your search again in a few minutes.";
     
         // --------------------
         // Case: Query Success
         // --------------------
     //    } else if (!empty($pageResultList) || !empty($peopleResultList)) {
         } else
     */
     if ($queryData["original"]) {
         if ($ignoredTermsCount) {
             $message[] = "These terms were ignored: <strong>" . htmlspecialchars($ignoredTerms) . "</strong>";
         }
         $output1 = !empty($pageResultList) || !empty($peopleResultList) ? $searchform : "";
         $output2 = "<div class='col-content-left'>\r\n\r\n" . "  <h2>Web Page Results</h2>\r\n" . "\r\n" . ($pageResultList ? $pageResultBlurb . "  " . $pageResultList . (count($searchResults) > 2 ? $pageResultBlurb : "") : "    " . BLURB_SORRY_WEB_SEARCH . $messageform) . "\r\n" . "\r\n" . "</div>\r\n" . "\r\n" . "<div class='col-content-right divider'>\r\n\r\n" . "  <h2>Nordita Staff Results</h2>\r\n" . "\r\n" . ($peopleResultList ? $peopleResultBlurb . "  " . $peopleResultList : "    " . BLURB_SORRY_PEOPLE_SEARCH) . "\r\n" . "</div>\r\n" . "\r\n" . "<div style='clear:both'><br></div>\r\n" . "\r\n" . $searchform . $searchtips;
         // --------------------
         // Case: No Results
         // --------------------
         /*
             } elseif ($queryData["original"]) {
         
               $message[] =
                 "<span class='red'>No matches found for &nbsp; " .
                 "<strong>".trim(htmlspecialchars($queryData["original"]))."</strong></span>" .
                 ( ($queryData["category"]) ? " &nbsp; when searching in Nordita web subsite <strong>" . $queryData["category"] . "</strong>" .
                 " and among <a href='people/index.php'><strong>Nordita staff members</strong></a>" .
                 "." : "" );
         
               if ($ignoredTermsCount) {
                 $message[] =
                   "These terms were ignored: " .
                   "<strong>" . htmlspecialchars($ignoredTerms) . "</strong>";
               }
         
               $messageform = "";
               if ($queryData["category"] != "") {
                 $messageform =
                   "  <form action='" . $_SERVER["PHP_SELF"] . "' method='post' class='os_msg'>\r\n" .
                   "    Try this search in \r\n" .
                   "    <input type='submit' value='all Nordita web subsites' class='fakelink bold'>?\r\n" .
                   "    <input type='hidden' name='qry' " .
                   "value='" . htmlspecialchars($queryData["original"]) . "'>\r\n" .
                   "    <input type='hidden' name='ctg' value=''>\r\n" .
                   "  </form>\r\n" .
                   "\r\n";
                   //"<a href='" . $_SERVER["PHP_SELF"] . "?qry=".htmlspecialchars($queryData["original"])."'>all categories</a>" .
               }
         
               $output2 =
                 $messageform .
                 $searchform .
                 $searchtips;
         */
         // --------------------
         // Case: No Query
         // --------------------
     } else {
         //    $message[] =
         //      "Please enter your search terms in the text field. <br>You may also limit your search to only the main Nordita web site, or to one of the specialized subsites.";
         $output1 = $searchform;
         $output2 = $searchtips;
     }
     // end if
     $messages = "";
     foreach ($message as $mtext) {
         $messages .= "  <p class='os_msg'>" . $mtext . "</p>\r\n";
     }
     if (!empty($messages)) {
         $messages .= "\r\n";
     }
     // --------------------------------------------------------------------------
     // -- OUTPUT
     // --------------------------------------------------------------------------
     $stdout = "<div" . (!empty($wid) ? " id='" . $wid . "'" : "") . ">\r\n" . "\r\n" . "  <!-- Orca Search v2.3a -->\r\n" . "\r\n" . $output1 . $messages . $output2 . "</div>\r\n" . "\r\n";
     return $stdout;
 }
Пример #21
0
 function buildPageHtml()
 {
     $stdout = "";
     /* RESTORE if test tabs needed */
     /*
     if (SHOW_TEST_TABS) {
         // -- GET switches, used in test site
         functions::gpc_declare_input("nostartpageboxes",true, true,array(),true);
         // -- Optionally display startpage boxes
         if (isset($_REQUEST["nostartpageboxes"])) {
           $_SESSION["nostartpageboxes"] = $GLOBALS["nostartpageboxes"];
         }
     } */
     // ---------------------------------------------------------------------------
     // PAGE PREAMBLE
     // ---------------------------------------------------------------------------
     // -- Document Type
     $stdout .= DOCTYPE . "\r\n\r\n";
     // ---------------------------------------------------------------------------
     // <HTML> OPEN TAG
     // ---------------------------------------------------------------------------
     // Conditional IE Classes
     //   An alternative to using separate conditionally loaded IE CSS files
     //     http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
     //   NB: IE9 is here assumed to be standards-compliant
     // HTML5 Cache Manifest (offline reading)
     //   http://en.wikipedia.org/wiki/Cache_manifest_in_HTML5
     //   http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html
     $attributes = "lang='" . LANGUAGE_CODE . "'" . "";
     $stdout .= "<!--[if lt IE 7]>      <html " . $attributes . " class='ie6'> <![endif]-->\r\n" . "<!--[if IE 7]>         <html " . $attributes . " class='ie7'> <![endif]-->\r\n" . "<!--[if IE 8]>         <html " . $attributes . " class='ie8'> <![endif]-->\r\n" . "<!--[if gt IE 8]><!--> <html " . $attributes . ">             <!--<![endif]-->\r\n" . "\r\n";
     // ---------------------------------------------------------------------------
     // <HEAD> ELEMENT
     // ---------------------------------------------------------------------------
     $stdout .= "  <head>\r\n\r\n";
     // ---------------------------------------
     // -- Load <head> elements
     //    Invoke after loading menu array config parameters
     // ---------------------------------------
     if (!isset($GLOBALS[SUBSITE]["head"])) {
         $this->buildPageAuxHead();
     }
     foreach ($GLOBALS[SUBSITE]["head"] as $legend => $cd) {
         if (!empty($cd)) {
             $stdout .= $cd;
         }
     }
     if (count($GLOBALS[SUBSITE]["head"])) {
         $stdout .= "\r\n";
     }
     // ---------------------------------------
     // -- Styles (defined in 'layout.php'; extra in 'data/block_margintabs' and document->buildLayoutUpdate())
     // ---------------------------------------
     $txt = "";
     if (isset($GLOBALS[SUBSITE]["stylesheets"])) {
         foreach ($GLOBALS[SUBSITE]["stylesheets"] as $media => $arr) {
             $txt .= $this->buildPageAuxStylesheets($media, $arr);
         }
     }
     if (isset($GLOBALS[SUBSITE]["stylesheets-conditional"])) {
         foreach ($GLOBALS[SUBSITE]["stylesheets-conditional"] as $iecond => $sarr) {
             foreach ($sarr as $media => $arr) {
                 $txt .= $this->buildPageAuxStylesheets($media, $arr, $iecond);
             }
         }
     }
     if (!empty($txt)) {
         $stdout .= $txt . "\r\n";
     } else {
         // -- Fix for the FOUC problem for MSIE;
         //    See: http://bluerobot.com/web/css/fouc.asp/,
         //    http://www.webkit.org/blog/66/the-fouc-problem/
         //    and http://en.wikipedia.org/wiki/Flash_of_unstyled_content
         $stdout .= "    <script type='text/javascript'> </script>\r\n\r\n";
     }
     // ---------------------------------------
     // -- Scripts (defined in 'config.php')
     //    Moved to end of document
     // ---------------------------------------
     if (isset($GLOBALS[SUBSITE]["scripts-head"])) {
         foreach ($this->getConfig("scripts-head") as $type => $arr) {
             $stdout .= $this->buildPageAuxScripts($type, $arr) . "\r\n";
         }
     }
     if (isset($GLOBALS[SUBSITE]["scripts-head-conditional"])) {
         foreach ($GLOBALS[SUBSITE]["scripts-head-conditional"] as $iecond => $sarr) {
             foreach ($sarr as $type => $arr) {
                 $stdout .= $this->buildPageAuxScripts($type, $arr, $iecond) . "\r\n";
             }
         }
     }
     // ---------------------------------------
     // -- Google Analytics script
     //  http://code.google.com/apis/analytics/
     //  https://www.google.com/analytics/settings/ (old site)
     //
     // Asynchronous tracking (recommended):
     //  http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=174090
     // ---------------------------------------
     if (!IS_TESTSERVER && !in_array(SUBSITECRUMB, array("_admin"))) {
         $stdout .= "    <script type='text/javascript'>\r\n" . "      var _gaq = _gaq || [];\r\n" . "      _gaq.push(['_setAccount', '" . GOOGLE_ANALYTICS_ACCOUNT . "']);\r\n" . "      _gaq.push(['_setDomainName', '" . GOOGLE_ANALYTICS_DOMAIN . "']);\r\n" . "      _gaq.push(['_trackPageview']);\r\n" . "      (function() {\r\n" . "        var ga = document.createElement('script'); " . "ga.type = 'text/javascript'; ga.async = true;\r\n" . "        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') " . "+ '.google-analytics.com/ga.js';\r\n" . "        var s = document.getElementsByTagName('script')[0]; " . "s.parentNode.insertBefore(ga, s);\r\n" . "      })();\r\n" . "    </script>\r\n\r\n";
     } else {
         $stdout .= "    <!-- suppressed Google Analytics code -->\r\n\r\n";
     }
     // ---------------------------------------
     $stdout .= "  </head>\r\n\r\n\r\n";
     // ---------------------------------------------------------------------------
     // FLUSH TO HTTP RESPONSE
     //   See: http://developer.yahoo.com/performance/rules.html#flush
     // ---------------------------------------------------------------------------
     //    flush();
     // ---------------------------------------------------------------------------
     // <BODY> START TAG, POSSIBLY WITH JAVASCRIPT CALLS
     // ---------------------------------------------------------------------------
     $bodyattributes = "";
     // --- ID
     //     bodyid = ["display"|"timetable"|"slideshow"|"search"|...]
     //     Set in 'PATH_MENU/m_*' as $pg[SUBSITE]["bodyid"]
     unset($bodyattributes_id);
     if ($this->getConfig("bodyid")) {
         $bodyattributes_id[] = $this->getConfig("bodyid");
     }
     if (isset($bodyattributes_id)) {
         $bodyattributes .= " id='" . implode(" ", $bodyattributes_id) . "'";
     }
     // --- CLASS
     //     body.wiki
     //     body.nobackground
     //     body.nobanner
     //     body.wide
     $bclasses = array("tabbed", "nobackground", "nobanner", "wide", "medwide", "rightwide", "nopagetitle", "nosearchfocus", "nobanneronprint", "nomenu");
     $bodyattributes_class = array();
     foreach ($bclasses as $bclass) {
         if ($this->getConfig($bclass) && isset($bodyattributes_class) && !in_array($bclass, $bodyattributes_class)) {
             $bodyattributes_class[] = $bclass;
         }
     }
     if ($this->getConfig("theme") != "") {
         $bodyattributes_class[] = $this->getConfig("theme");
     }
     if (IS_TESTSERVER && IS_INDEXPAGE && (isset($_SESSION["nostartpageboxes"]) && $_SESSION["nostartpageboxes"])) {
         $bodyattributes_class[] = "nostartpageboxes";
     }
     // -- Optionally display screen resolution background
     if (IS_TESTSERVER) {
         functions::gpc_declare_input("nw_screenresolution", false, true, array(), true);
         if ($_SESSION["nw_screenresolution"]) {
             $bodyattributes_class[] = "nw_screenresolution";
         }
     }
     if ($this->getConfig("nolist")) {
         $bodyattributes_class[] = "noindex";
     }
     /* RESTORE if test tabs needed */
     /*
     if (SHOW_TEST_TABS && isset($GLOBALS["frontselect"])) {
           $bodyattributes_class[] = "frontselect".$GLOBALS["frontselect"];
     } */
     // --- SCRIPT
     //$bodyattributes_script[] = "";
     // --- TOTAL
     if (isset($bodyattributes_class) && count($bodyattributes_class)) {
         $bodyattributes .= " class='" . implode(" ", $bodyattributes_class) . "'";
     }
     if (isset($bodyattributes_script) && count($bodyattributes_script)) {
         $bodyattributes .= implode(" ", $bodyattributes_script);
     }
     // --- ONLOAD
     unset($bodyattributes_onload);
     // ======================================================================
     //TODO: these should be put in some config file
     // initiate google map in colophon (call before 'focus'):
     if (isInPath("googlemap")) {
         $bodyattributes_onload[] = "initmap(\"googlemap-map-canvas\",12)";
     }
     // ======================================================================
     // ======================================================================
     //TODO: these should be put in some config file
     if (auth::isLoginRequired() && !auth::isAuthenticated()) {
         $bodyattributes_onload[] = "document.getElementById(\"auth_username\").focus()";
     } elseif (SHOW_SEARCH && !$this->getConfig("nosearchfocus")) {
         if (isInPath("/people/search/") && !isset($_REQUEST["pqry"])) {
             $bodyattributes_onload[] = "document.getElementById(\"pqry\").focus()";
         } elseif (SHOW_SEARCH && isInPath("/search/") && !isset($_REQUEST["qry"]) && !isset($_REQUEST["sqry"])) {
             // orca search form
             $bodyattributes_onload[] = "document.getElementById(\"qry\").focus()";
         } else {
             // simple search form
             $bodyattributes_onload[] = "document.getElementById(\"sqry\").focus()";
             // keep but don't use
         }
     } elseif ($this->getConfig("nosearchfocus") && !isset($_REQUEST["qry"]) && !isset($_REQUEST["sqry"]) && !isset($_REQUEST["pqry"])) {
         if ((isInPath("/" . PATH_NEWS . "/") || isInPath("/" . PATH_NEWSTEST . "/")) && isset($_REQUEST["cmt_text"])) {
             $bodyattributes_onload[] = "document.getElementById(\"cmt_text\").focus()";
         } else {
             // mainly captcha form
             $bodyattributes_onload[] = "document.getElementById(\"" . CAPTCHA_ID . "\").focus()";
         }
     }
     // ======================================================================
     // $bodyattributes_onload[] = "window.location.reload(true)"; //NOP
     if (isset($bodyattributes_onload) && !IS_PRINT) {
         $bodyattributes .= " onLoad='" . implode(";", $bodyattributes_onload) . "'";
     }
     // ---
     $stdout .= "  <body" . $bodyattributes . (HIDE_BACKGROUND_IMAGE ? " style='background-image:none!important'" : "") . ">\r\n" . "\r\n";
     //Only during test period:
     $stdout .= TESTSERVER_FLAG;
     //if (IS_TESTSERVER) $stdout.= "<h1 style='position:fixed;width:50%;margin:0;color:red;top:0px;left:0px;opacity:0.2'>[TESTSERVER]</h1>\r\n\r\n";
     //if (IS_ON_KTH_SERVER) $stdout.= "<h1 style='position:fixed;width:50%;margin:0;color:red;top:0px;left:0px;opacity:0.2'>[VIRTUAL SERVER]</h1>\r\n\r\n";
     // ---------------------------------------------------------------------------
     // PAGE CONTENT
     //   containers -> regions -> blocks
     //   [set in 'layout/<nr>/layout' and 'sites/SUBSITE/config_SUBSITE']
     // ---------------------------------------------------------------------------
     // DEBUG --
     $newlayout = false;
     if ($newlayout) {
         // -- DEBUG
         // *** Handling of the "new layout" has not been debugged yet! ***
         $stdout .= "\r\n" . "    <!-- ========================================================= -->\r\n\r\n\r\n";
         $data = "";
         foreach ($GLOBALS[SUBSITE]["layout"] as $containerId => $callback) {
             $data = $this->renderCallback($callback);
             if (!empty($data)) {
                 $stdout .= "    <div id='" . $containerId . "'" . ($this->getConfig("isindex") ? " class='index'" : "") . ">\r\n\r\n" . $data . "    </div> <!-- " . $containerId . " -->\r\n\r\n\r\n" . "    <!-- ========================================================= -->\r\n\r\n\r\n";
             }
         }
         // end foreach
         // DEBUG --
     } else {
         // -- DEBUG
         $stdout .= "\r\n" . "    <!-- ========================================================= -->\r\n\r\n\r\n";
         foreach ($GLOBALS[SUBSITE]["containers"] as $cont => $regs) {
             $data = "";
             foreach ($regs as $r) {
                 if ($r != "colophon" || !$this->getConfig("nocolophon")) {
                     if (count($GLOBALS[SUBSITE]["regions"][$r])) {
                         $txt = "";
                         if (is_array($GLOBALS[SUBSITE]["regions"][$r])) {
                             foreach ($GLOBALS[SUBSITE]["regions"][$r] as $feat) {
                                 if (!empty($feat)) {
                                     $txt .= functions::outputFunctionCall($feat);
                                 }
                             }
                         }
                         if (!empty($txt)) {
                             $data .= "      <div id='region-" . $r . "'" . (isset($GLOBALS[SUBSITE]["classes"]["region-" . $r]) ? " class='" . $GLOBALS[SUBSITE]["classes"]["region-" . $r] . "'" : "") . ">\r\n\r\n" . $txt . "      </div> <!-- " . $r . " -->\r\n\r\n";
                         }
                     }
                 }
             }
             $data = trim($data);
             if (!empty($data)) {
                 $stdout .= "    <div id='container-" . $cont . "'" . ($this->getConfig("isindex") ? " class='index'" : "") . ">\r\n\r\n" . "      " . $data . "\r\n\r\n" . "    </div> <!-- " . $cont . " -->\r\n\r\n\r\n" . "    <!-- ========================================================= -->\r\n\r\n\r\n";
             }
         }
         // end foreach
         // DEBUG --
     }
     // -- DEBUG
     // ---------------------------------------------------------------------------
     // IMAGE PRELOADING
     // ---------------------------------------------------------------------------
     /* this is NOT particularly useful...
         $stdout .=
           "    <div style='display:none'>\r\n" .
           "      <img src='_css/img/_splash/sprite-splash-nordita.png' alt='' style='width:1px;height:1px;'>\r\n" .
           "      <img src='img/backdrop_pentaflakes_1200_win.jpg' alt='' style='width:1px;height:1px;'>\r\n" .
           "    </div>\r\n" .
           "\r\n";
     */
     // ---------------------------------------------------------------------------
     // JAVASCRIPTS AT END OF DOCUMENT
     //   See http://developer.yahoo.com/performance/rules.html#js_bottom
     // ---------------------------------------------------------------------------
     if (isset($GLOBALS[SUBSITE]["scripts"])) {
         foreach ($GLOBALS[SUBSITE]["scripts"] as $type => $arr) {
             $stdout .= $this->buildPageAuxScripts($type, $arr) . "\r\n";
         }
     }
     if (isset($GLOBALS[SUBSITE]["scripts-conditional"])) {
         foreach ($GLOBALS[SUBSITE]["scripts-conditional"] as $iecond => $sarr) {
             foreach ($sarr as $type => $arr) {
                 $stdout .= $this->buildPageAuxScripts($type, $arr, $iecond);
             }
         }
     }
     $stdout .= "\r\n";
     // ---------------------------------------------------------------------------
     // END OF <BODY> AND <HTML> TAGS
     // ---------------------------------------------------------------------------
     $stdout .= "  </body>\r\n\r\n" . "</html>\r\n\r\n\r\n\r\n";
     // ---------------------------------------------------------------------------
     return $stdout;
 }
Пример #22
0
 function getSubscriber($showAll = false, $id = "")
 {
     functions::gpc_declare_input("reload", 0, true);
     if (!$GLOBALS["reload"] && isset($_SESSION[self::$list . "-data"]) && !empty($_SESSION[self::$list . "-data"])) {
         $data = $_SESSION[self::$list . "-data"];
         if (!empty($id)) {
             return isset($data[$id]) ? $data[$id] : false;
         } else {
             return $data;
         }
     }
     if (!isset($GLOBALS["newsClass"])) {
         if (!class_exists("fromdb_nwnews", FALSE)) {
             require_once PATH_CLASSES . "/fromdb/nwnews.php";
         }
         $GLOBALS["newsClass"] = new fromdb_nwnews();
     }
     // ------------------
     $source_array = array("subscribersource_id" => NEWS_MAILMAN);
     $source_array_tmp = $GLOBALS["newsClass"]->getLookup("subscribersource", $source_array);
     $source = array_pop($source_array_tmp);
     $pattern_letters = "<a href=\"https://lists.su.se/mailman/admin/([^/]*)/members\\?letter=([a-z])\">.*</a>[\\&<]";
     $pattern_entry = "<INPUT name=\"([.a-z0-9_-]+)\\%40([.a-z0-9_-]+)_realname\" type=\"TEXT\" value=\"([^\"]*)\".*_nomail\" type=\"CHECKBOX\" value=\"([^\"]*)\"";
     $pattern_chunk = "<li>(.*)/members\\?letter=([a-z])\\&chunk=([0-9]*)\"";
     $pattern_chunk = "members\\?letter=([a-z])&chunk=([^\"]*)\"";
     $curl_cookie = self::getLoginCookie(1);
     $seedurl = self::$url . "members/?letter=a";
     $seedoutput = functions::acurl($seedurl, 0, 1, $curl_cookie);
     if (preg_match_all("~" . $pattern_letters . "~iUs", $seedoutput, $res, PREG_SET_ORDER)) {
         foreach ($res as $data) {
             $theurl = self::$url . "members/?letter=" . $data[2];
             $o = functions::acurl($theurl, 0, 1, $curl_cookie);
             if (preg_match_all("~" . $pattern_chunk . "~iUs", $o, $r, PREG_SET_ORDER)) {
                 foreach ($r as $d) {
                     $turl = self::$url . "members/?letter=" . $d[1] . "&amp;chunk=" . $d[2];
                     $output[] = functions::acurl($turl, 0, 1, $curl_cookie);
                 }
             } else {
                 $output[] = $o;
             }
         }
     }
     $data = array();
     foreach ($output as $o) {
         $new = array();
         if (preg_match_all("/" . $pattern_entry . "/iUs", $o, $res, PREG_SET_ORDER)) {
             foreach ($res as $r) {
                 if (!empty($r[1]) && !empty($r[2])) {
                     $status_id = isset($r[4]) && $r[4] == "on" ? NEWS_NOMAIL : NEWS_ACTIVE;
                     $status_array = array("subscriberstatus_id" => $status_id);
                     $status_array_tmp = $GLOBALS["newsClass"]->getLookup("subscriberstatus", $status_array);
                     $status = array_pop($status_array_tmp);
                     if ($showAll || $status_id == NEWS_ACTIVE) {
                         $new[$r[1] . "@" . $r[2]] = array("email" => $r[1] . "@" . $r[2], "firstname" => "", "lastname" => "", "comment" => isset($r[3]) ? $r[3] : 1, "source" => $source["subscribersource"], "status_id" => $status_id, "status" => $status["subscriberstatus"], "date_lastchange" => date("Y-m-d"), "date_created" => "2012-12-31", "date_invited" => "", "sent" => 0);
                     }
                 }
             }
         }
         if (!empty($new)) {
             $data = array_merge($data, $new);
         }
     }
     // end for
     ksort($data);
     if (empty($data)) {
         return false;
     }
     // save data to session variable, since data takes so long time to obtain
     $_SESSION[self::$list . "-data"] = $data;
     // If specific db record requested, return only that single array
     if (!empty($id)) {
         return isset($data[$id]) ? $data[$id] : false;
     } else {
         return $data;
     }
 }
Пример #23
0
 public static function getEventCalendarData($selectAll = FALSE)
 {
     functions::gpc_declare_input("vert", 0, true);
     $allConfids = self::getAgendaConferenceIdsForNorditaEvents();
     if (!is_array($allConfids) || empty($allConfids)) {
         return array();
     }
     $calendar = array();
     $proglist = array();
     $eventIdToTitle = array();
     $eventIdToPath = array();
     $grid = array();
     foreach ($allConfids as $confId) {
         $oneprogram = functions::callMethod('event', 'lib/event', 'getEventByAgendaid', $confId);
         if (!empty($oneprogram)) {
             $yr = date("Y", $oneprogram["from"]);
             if (substr($oneprogram["startdate"], -5) != "01-01" && ($selectAll || date("Y") <= $yr)) {
                 $calendar[$yr][date("z", $oneprogram["from"])][] = $oneprogram["id"];
                 $calendar[$yr][date("z", $oneprogram["to"])][] = -$oneprogram["id"];
                 $eventIdToTitle[$oneprogram["id"]] = $oneprogram["title"];
                 $eventIdToPath[$oneprogram["id"]] = $oneprogram["subpath"];
                 unset($coord);
                 if (isset($oneprogram["chairs"]) && is_array($oneprogram["chairs"])) {
                     foreach ($oneprogram["chairs"] as $ch) {
                         $coord[] = $ch["av_firstname"] . " " . $ch["av_lastname"];
                     }
                 }
                 $proglist[$oneprogram["startdate"]] = array("title" => $oneprogram["title"], "id" => $oneprogram["id"], "subpath" => $oneprogram["subpath"], "startdate" => $oneprogram["startdate"], "chairlist" => isset($coord) ? implode(", ", $coord) : "", "enddate" => $oneprogram["enddate"], "blurb" => "", "eventtype" => $oneprogram["eventtype"], "period" => $oneprogram["period"]);
             }
         }
     }
     // end foreach
     ksort($calendar);
     foreach ($calendar as $yr => $cal) {
         ksort($cal);
         $calendar[$yr] = $cal;
     }
     ksort($proglist);
     foreach ($calendar as $yr => $cal) {
         $firsttime = mktime(0, 0, 0, 1, 1, $yr);
         $lastday = date("z", mktime(0, 0, 0, 12, 31, $yr));
         $idx = array();
         for ($day = 0; $day <= $lastday; $day++) {
             $thistime = mktime(0, 0, 0, 1, $day + 1, $yr);
             $thisdate = date("j", $thistime);
             $thismonth = date("n", $thistime);
             if (isset($calendar[$yr][$day])) {
                 foreach ($calendar[$yr][$day] as $v) {
                     if ($v < 0) {
                         unset($idx[abs($v)]);
                     } else {
                         $idx[$v] = $v;
                     }
                 }
             }
             if ($GLOBALS["vert"]) {
                 $grid[$yr][$thisdate][$thismonth] = join(" ", $idx);
                 for ($i = $thisdate + 1; $i <= 31; $i++) {
                     // fill to end of month
                     $grid[$yr][$i][$thismonth] = NULL;
                 }
             } else {
                 $grid[$yr][$thismonth][$thisdate] = join(" ", $idx);
                 for ($i = $thisdate + 1; $i <= 31; $i++) {
                     // fill to end of month
                     $grid[$yr][$thismonth][$i] = NULL;
                 }
             }
             // end if
         }
         // end foreach
     }
     return array("proglist" => $proglist, "eventIdToTitle" => $eventIdToTitle, "eventIdToPath" => $eventIdToPath, "grid" => $grid);
 }
Пример #24
0
 public static function AnewseditDropDbCaptcha()
 {
     functions::gpc_declare_input("doit", false, true);
     if ($GLOBALS["doit"]) {
         return admin::AnewseditDropDb();
     } else {
         if (IS_TESTSERVER) {
             return admin::AnewseditDropDb();
         }
         return functions::get_captcha_protected_call("admin::AnewseditDropDb");
     }
 }
Пример #25
0
 function __construct($db = "", $host = "", $user = "", $pwd = "", $debug = FALSE)
 {
     // ----------------------
     // Initiate GPC variables
     // ----------------------
     // -- $GLOBALS["variant"]
     //     @calledby people::OutputPeople()
     //     @calledby people::outputPeopleList()
     //     @calledby people::outputConveniencyLinks()
     functions::gpc_declare_input("variant", "all");
     // -- $GLOBALS["g"]
     //    Group by
     //    @calledby
     functions::gpc_declare_input("g", false);
     //TODO: this seems not to be implemented yet...
     switch ($GLOBALS["g"]) {
         case "e":
             $toplevelid = "employeeType";
             break;
         case "g":
             $toplevelid = "groupid";
             break;
         default:
             $toplevelid = "employeeType";
     }
     // end switch
     // -- $GLOBALS["sort_by"]
     //TODO: this seems not to be implemented yet...
     functions::gpc_declare_input("sort_by", "sn");
     // -- $GLOBALS["u"]
     //    @calledby people::getPeopleData()
     if (!isset($_REQUEST["labelusers"])) {
         functions::gpc_declare_input("u", false);
     }
     // ----------------------
     // DB connect parameters
     // ----------------------
     if (!empty($db) && !empty($host)) {
         parent::__construct($db, $host, $user, $pwd, $debug);
     }
 }
Пример #26
0
 public static function outputMyTravelsCaptcha()
 {
     functions::gpc_declare_input("doit", false, true);
     if ($GLOBALS["doit"]) {
         return travel::outputMyTravels();
     } else {
         return functions::get_captcha_protected_call("travel::outputMyTravels");
     }
 }