Example #1
0
 public function processData(\IRequestObject $requestObject)
 {
     if ($requestObject instanceof \UrlRequestObject) {
         $this->params = $requestObject->getParams();
         isset($this->params[0]) ? $this->id = $this->params[0] : "";
     } else {
         if ($requestObject instanceof \IdRequestObject) {
             $this->id = $requestObject->getId();
         }
     }
     $steam = $GLOBALS["STEAM"];
     //get singleton and portlet path
     $portalInstance = \Portal::getInstance();
     $portalPath = $portalInstance->getExtensionPath();
     //template
     $templateFileName = $portalPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($templateFileName);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $object = $currentUser->get_workroom();
     $objectId = $this->id;
     //get the portal object
     $this->portalObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $type = getObjectType($this->portalObject);
     if (!($type === "portal")) {
         \ExtensionMaster::getInstance()->send404Error();
         die;
     }
     \Portal::getInstance()->setPortalObject($this->portalObject);
     //get the content of the portal object
     $portalColumns = $this->portalObject->get_inventory();
     $htmlBody = "";
     $extensionMaster = \ExtensionMaster::getInstance();
     $count = 0;
     $htmlCollectorColRow[][] = array();
     $col = 0;
     $row = 0;
     $this->rawHtmlWidget = new \Widgets\RawHtml();
     foreach ($portalColumns as $columnObject) {
         $columnObjectId = $columnObject->get_id();
         $widgets = $extensionMaster->getWidgetsByObjectId($columnObjectId, "view");
         $this->rawHtmlWidget->addWidgets($widgets);
         $data = \Widgets\Widget::getData($widgets);
         $htmlBody .= $data["html"];
         $count++;
     }
     $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
     if (isset($this->portalObject) && $this->portalObject->check_access_write($currentUser)) {
         $htmlBody .= "<script>if (readCookie(\"portalEditMode\") === \"{$objectId}\") {portalLockButton({$objectId})}</script>";
     }
     $tmpl->setVariable("BODY", $htmlBody);
     $htmlBodyTemplated = $tmpl->get();
     $this->rawHtmlWidget->setHtml($htmlBodyTemplated);
 }
Example #2
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portal = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $steam = $GLOBALS["STEAM"];
     $portal_name = $portal->get_attribute(OBJ_DESC);
     $portalInstance = \Portal::getInstance();
     $portalPath = $portalInstance->getExtensionPath();
     $htmlBody = "Dummy output for properties command of portal";
     $this->content = $htmlBody;
 }
Example #3
0
 function privateKey()
 {
     global $speaks_for_enabled;
     if ($this->sfcred || isset($speaks_for_enabled) && $speaks_for_enabled) {
         if (is_null($this->portal)) {
             $this->portal = Portal::getInstance();
         }
         return $this->portal->privateKey();
     } else {
         /* Not using speaks for */
         if (is_null($this->private_key)) {
             $this->getInsideKeyPair();
         }
         return $this->private_key;
     }
 }
Example #4
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $portletName = $portlet->get_attribute(OBJ_DESC);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     //old bib
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $portletInstance = \PortletRss::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $num_items = isset($content["num_items"]) ? $content["num_items"] : 0;
     if (isset($content["address"])) {
         $feed = new \SimplePie();
         $feed->set_cache_location(PATH_CACHE);
         $feed->set_feed_url(derive_url($content["address"]));
         $feed->init();
         if ($num_items == 0) {
             $items = $feed->get_items();
         } else {
             $items = array_slice($feed->get_items(), 0, $num_items);
         }
     }
     $desc_length = isset($content["desc_length"]) ? $content["desc_length"] : 0;
     if (isset($content["allow_html"])) {
         $allow_html = $content["allow_html"] == "checked" ? true : false;
     } else {
         $allow_html = false;
     }
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     $tmpl->setVariable("EDIT_BUTTON", "");
     $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
     $tmpl->setVariable("RSS_NAME", $portletName);
     //refernce icon
     if ($portletIsReference) {
         $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
     }
     //popupmenu
     if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("PortletRss");
         $popupmenu->setElementId("portal-overlay");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("Portal");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
         $popupmenu->setCommand("PortletGetPopupMenuReference");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     if (sizeof($content) > 0) {
         if ($feed->error()) {
             $tmpl->setVariable("NOITEMSTEXT", "RSS-Ladefehler");
         } else {
             if (count($items) == 0) {
                 $tmpl->setVariable("NOITEMSTEXT", "RSS-Feed ist leer.");
             } else {
                 foreach ($items as $item) {
                     $tmpl->setCurrentBlock("BLOCK_RSS_ITEM");
                     if ($allow_html) {
                         $itemtitle = $item->get_title();
                         $itemdesc = $item->get_description();
                     } else {
                         $itemtitle = strip_tags($item->get_title());
                         $itemdesc = strip_tags($item->get_description());
                     }
                     if ($desc_length == 0) {
                         $itemdesc = "";
                     } else {
                         if ($desc_length > 0 && strlen($itemdesc) > $desc_length) {
                             $itemdesc = substr($itemdesc, 0, $desc_length) . "...";
                         }
                     }
                     $tmpl->setVariable("ITEMTITLE", $itemtitle);
                     $tmpl->setVariable("ITEMDESC", $itemdesc);
                     $tmpl->setVariable("ITEMURL", derive_url($item->get_permalink()));
                     $tmpl->setVariable("LINK", "");
                     $tmpl->parse("BLOCK_RSS_ITEM");
                 }
             }
         }
     } else {
         $tmpl->setVariable("NOITEMSTEXT", "RSS-Feed nicht konfiguriert.");
     }
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $this->rawHtmlWidget = $outputWidget;
 }
 $message .= "To handle my request, go to the GENI Portal here:\nhttps://{$hostname}/secure/handle-project-request.php?project_id={$project_id}&member_id=" . $user->account_id . "&request_id={$request_id}\n\nRemember that when you approve this request, you agree to take\nresponsibility for my use of GENI resources within the project. \nYou should not approve unsolicited requests to join your project.\n\nThank you,\n" . $user->prettyName() . "\n";
 //  $message = substr_replace($message, "handle-project-request.php?project_id=" . $project_id . "&member_id=" . $user->account_id . "&request_id=" . $request_id, $ind, strlen("handle-project-request.php"));
 // Log the request
 // contexts include project and member
 $project_attributes = get_attribute_for_context(CS_CONTEXT_TYPE::PROJECT, $project_id);
 $member_attributes = get_attribute_for_context(CS_CONTEXT_TYPE::MEMBER, $user->account_id);
 $attributes = array_merge($project_attributes, $member_attributes);
 if (!isset($log_url)) {
     $log_url = get_first_service_of_type(SR_SERVICE_TYPE::LOGGING_SERVICE);
     if (!isset($log_url) || is_null($log_url) || $log_url == '') {
         error_log("Found no Log Service in SR!'");
     }
 }
 $name = $user->prettyName();
 if (isset($log_url)) {
     log_event($log_url, Portal::getInstance(), "{$name} requested to join project {$project_name}", $attributes);
 }
 // Send the email
 $prettyEmail = $user->prettyEmailAddress();
 $email = $user->email();
 if (count($admin_emails) > 0) {
     //error_log("Got admin_emails " . print_r($admin_emails, True));
     $cc = "Cc: " . implode(", ", $admin_emails) . "\r\n";
 } else {
     $cc = "";
     // FIXME: Include portal-dev-admin?
 }
 $headers = "Reply-To: {$email}" . "\r\n" . $cc . "From: \"{$name} (via the GENI Portal)\" <*****@*****.**>\r\nContent-Type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding: 8bit";
 mail($lead->prettyEmailAddress(), "Request to Join GENI project {$project_name}", $message, $headers);
 // We could supply the -f arg to make bounces go back to this portal user,
 // but we probably want to know if the lead's email address is bouncing.
Example #6
0
}
// Get the EPPN now that we know it's there.
$eppn = strtolower($_SERVER['eppn']);
// If no email address and no preasserted email
//    Then redirect to kmnoemail.php
if (!key_exists('mail', $_SERVER)) {
    $asserted_attrs = get_asserted_attributes($eppn);
    if (!key_exists('mail', $asserted_attrs)) {
        relative_redirect('kmnoemail.php');
    }
}
// Avoid double registration by checking if this is a valid
// user before displaying the page. If this user is already
// registered, redirect to the home page.
$ma_url = get_first_service_of_type(SR_SERVICE_TYPE::MEMBER_AUTHORITY);
$member = ma_lookup_member_by_eppn($ma_url, Portal::getInstance(), $eppn);
//$attrs = array('eppn' => $eppn);
//$ma_members = ma_lookup_members($ma_url, Portal::getInstance(), $attrs);
//$count = count($ma_members);
//if ($count !== 0) {
if (!is_null($member)) {
    // Existing account, go to home page or to referer
    redirect_referer("kmhome.php");
}
include "kmheader.php";
print "<h2> GENI Account Activation Page </h2>\n";
include "tool-showmessage.php";
?>

<br/>
In order to activate your GENI account, you must first agree to GENI
Example #7
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portletInstance = \PortletMedia::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     if (sizeof($content) > 0) {
         $portletFileName = $portletPath . "/ui/html/index.html";
         $tmpl = new \HTML_TEMPLATE_IT();
         $tmpl->loadTemplateFile($portletFileName);
         //popupmenu
         if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("PortletMedia");
             $popupmenu->setElementId("portal-overlay");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("Portal");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
             $popupmenu->setCommand("PortletGetPopupMenuReference");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         $tmpl->setVariable("EDIT_BUTTON", "");
         $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
         $tmpl->setVariable("HEADLINE", $content["headline"]);
         //refernce icon
         if ($portletIsReference) {
             $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
         }
         $tmpl->setVariable("URL", $content["url"]);
         $tmpl->setVariable("DESCRIPTION", $content["description"]);
         $media_type = $content["media_type"];
         if ($media_type == "image") {
             $tmpl->setCurrentBlock("image");
             $tmpl->parse("MEDIA_ELEMENT", "image");
             $tmpl->parse("image");
         } else {
             if ($media_type == "movie") {
                 $tmpl->setCurrentBlock("movie");
                 $width = str_replace(array("px", "%"), "", $portlet->get_environment()->get_attribute("bid:portal:column:width")) - 10;
                 $media_player = $portletInstance->getAssetUrl() . 'mediaplayer.swf';
                 $tmpl->setVariable("MEDIA_PLAYER", $media_player);
                 $tmpl->setVariable("MEDIA_PLAYER_WIDTH", $width);
                 $tmpl->setVariable("MEDIA_PLAYER_HEIGHT", round($width * 3 / 4));
                 $tmpl->parse("movie");
             } else {
                 if ($media_type == "audio") {
                     $tmpl->setCurrentBlock("audio");
                     $width = str_replace(array("px", "%"), "", $portlet->get_environment()->get_attribute("bid:portal:column:width")) - 10;
                     $media_player = $portletInstance->getAssetUrl() . 'emff_lila_info.swf';
                     $tmpl->setVariable("MEDIA_PLAYER", $media_player);
                     $tmpl->setVariable("MEDIA_PLAYER_WIDTH", $width);
                     $tmpl->setVariable("MEDIA_PLAYER_HEIGHT", round($width * 11 / 40));
                     $tmpl->parse("audio");
                 }
             }
         }
         if ($portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON");
             $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
             $tmpl->parse("BLOCK_EDIT_BUTTON");
         }
         //output
         $htmlBody = $tmpl->get();
     } else {
         //output for no content
         $htmlBody = "";
     }
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     //popummenu
     $popupmenu = new \Widgets\PopupMenu();
     $popupmenu->setData($portlet);
     $popupmenu->setNamespace("PortletMedia");
     $popupmenu->setElementId("portal-overlay");
     $outputWidget->addWidget($popupmenu);
     $this->rawHtmlWidget = $outputWidget;
 }
Example #8
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $portletName = $portlet->get_attribute(OBJ_DESC);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     $htmlBody = "";
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     //get singleton and portlet path
     $portletInstance = \PortletTermplan::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     //create template
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     if (sizeof($content) > 0) {
         //popupmenu
         if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("PortletTermplan");
             $popupmenu->setElementId("portal-overlay");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("Portal");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
             $popupmenu->setCommand("PortletGetPopupMenuReference");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         $startDate = $content["start_date"];
         $endDate = $content["end_date"];
         if (time() > mktime(0, 0, 0, $startDate["month"], $startDate["day"], $startDate["year"]) && time() < mktime(24, 0, 0, $endDate["month"], $endDate["day"], $endDate["year"])) {
             $pollActive = true;
         } else {
             $pollActive = false;
         }
         $options = $content["options"];
         $optionsVotecount = $content["options_votecount"];
         $max_votecount = 1;
         foreach ($optionsVotecount as $option_votecount) {
             if ($option_votecount > $max_votecount) {
                 $max_votecount = $option_votecount;
             }
         }
         $tmpl->setVariable("POLL_NAME", $portletName);
         //refernce icon
         if ($portletIsReference) {
             $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
         }
         $tmpl->setVariable("POLL_TOPIC", $content["poll_topic"]);
         //advanced result
         //decode content mapping
         $encodedVoteUserMapping = $portlet->get_attribute("termChoices");
         if ($encodedVoteUserMapping == "0") {
             $mapping = array();
         } else {
             $mapping = json_decode($encodedVoteUserMapping, true);
         }
         $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
         $currentUserName = $currentUser->get_full_name();
         $currentUserLogin = $currentUser->get_name();
         //fehler
         //create table
         $userTimeTable = "<br/><table border='0' style='margin:auto;border-color:#C0C0C0;width:98%'>";
         //headline
         $userTimeTable .= "<tr>";
         $userTimeTable .= "<th style='background-color:#E0E0E0;'>Name</th>";
         $optionsCount = 0;
         foreach ($options as $option) {
             if ($option != "") {
                 //show
                 $optionsCount++;
                 $optionText = $this->termplanCutItemLenght($option);
                 $userTimeTable .= "<th style='background-color:#E0E0E0;'>{$optionText}</th>";
             }
         }
         $userTimeTable .= "</tr>";
         $userVoteArray = array();
         foreach ($mapping as $username => $encodedTermChoices) {
             @($voteUserArray = explode("#", $voteXuser));
             //TODO
             $votes = explode(":", substr($encodedTermChoices, 12));
             $user = $username;
             foreach ($votes as $vote) {
                 if (isset($userVoteArray[$user][$vote]) && $userVoteArray[$user][$vote] == "X") {
                     //hier den umschalter
                     $userVoteArray[$user][$vote] = "N";
                 } else {
                     $userVoteArray[$user][$vote] = "X";
                 }
             }
         }
         //initialize votecount
         $voteCount = array();
         $voteCount[0] = 0;
         $voteCount[1] = 0;
         $voteCount[2] = 0;
         $voteCount[3] = 0;
         $voteCount[4] = 0;
         $voteCount[5] = 0;
         if (!("guest" == $GLOBALS["STEAM"]->get_current_steam_user()->get_name())) {
             //its not allowed for guest to vote
             //create first line for current user
             $userTimeTable .= "<tr>";
             $userTimeTable .= "<td style='font-weight: bold;'>{$currentUserName}</td>";
             if (isset($userVoteArray[$currentUserLogin])) {
                 $votingForCurrentUser = $userVoteArray[$currentUserLogin];
             } else {
                 $votingForCurrentUser = array();
             }
             $backGroundGreen = "#99EE99";
             for ($i = 0; $i < $optionsCount; $i++) {
                 //$userTimeTable.= "<td>";
                 $portletId = $portlet->get_id();
                 if (isset($votingForCurrentUser[$i]) && $votingForCurrentUser[$i] == "X") {
                     if (!$pollActive) {
                         $userTimeTable .= "<td style='background-color:{$backGroundGreen};'>";
                     }
                     if ($pollActive) {
                         $userTimeTable .= "<td style='background-color:{$backGroundGreen};'>";
                     }
                     $voteCommand = 'sendRequest("VoteTerm",	{"portletObjectId": "' . $objectId . '", "termId": "' . $i . '"}, "", "popup", "","", "PortletTermplan");return false;';
                     if ($pollActive) {
                         $userTimeTable .= "<input onclick='{$voteCommand};'  type='checkbox' name='termitem' value='{$i}' checked='checked'>";
                     }
                     if (!$pollActive) {
                         $userTimeTable .= "X";
                     }
                     $voteCount[$i]++;
                     $userTimeTable .= "</td>";
                 } else {
                     $userTimeTable .= "<td>";
                     $voteCommand = 'sendRequest("VoteTerm",	{"portletObjectId": "' . $objectId . '", "termId": "' . $i . '"}, "", "popup", "","", "PortletTermplan");return false;';
                     if ($pollActive) {
                         $userTimeTable .= "<input onclick='{$voteCommand};' type='checkbox' name='termitem' value='{$i}'>";
                     }
                     if (!$pollActive) {
                         $userTimeTable .= "";
                     }
                     $userTimeTable .= "</td>";
                 }
             }
             $userTimeTable .= "</tr>";
         }
         //sort the users
         //$userVoteArray
         $sortedNames = array();
         foreach ($userVoteArray as $login => $userElement) {
             $userObject = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $login);
             $userRealName = $userObject->get_full_name();
             $sortedNames[$login] = $userRealName;
         }
         asort($sortedNames, SORT_STRING);
         //resorting the other array
         foreach ($sortedNames as $userName => $realName) {
             $sortedNames[$userName] = $userVoteArray[$userName];
         }
         $userVoteArraySorted = $sortedNames;
         //table for other users
         foreach ($userVoteArraySorted as $user => $userElement) {
             if ($user == $currentUserLogin) {
                 continue;
             }
             //create row
             $userTimeTable .= "<tr>";
             $userObject = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $user);
             $realName = $userObject->get_full_name();
             //create other users
             if ($currentUserName == $realName) {
                 //DO NOTHING
             } else {
                 $userTimeTable .= "<td>{$realName}</td>";
             }
             for ($i = 0; $i < $optionsCount; $i++) {
                 //create field
                 if (isset($userElement[$i]) && $userElement[$i] == "X") {
                     if ($currentUserName == $realName) {
                         $userTimeTable .= "<td></td>";
                         //DO NOTHING
                     } else {
                         $userTimeTable .= "<td style='background-color:{$backGroundGreen};'>X</td>";
                     }
                     $voteCount[$i]++;
                 } else {
                     $userTimeTable .= "<td></td>";
                     if ($currentUserName == $realName) {
                         //DO NOTHING
                     }
                 }
             }
             $userTimeTable .= "</tr>";
         }
         //count and show results
         $userTimeTable .= "<tr>";
         $userTimeTable .= "<td>Summe</td>";
         $portletId = $portlet->get_id();
         for ($i = 0; $i < $optionsCount; $i++) {
             $userTimeTable .= "<td id='" . $portletId . "TermSum{$i}'>{$voteCount[$i]}</td>";
         }
         $userTimeTable .= "</tr>";
         $userTimeTable .= "</table>";
         //table created
         $tmpl->setVariable("USER_VOTE_TABLE", $userTimeTable);
         $htmlBody = $tmpl->get();
         //widgets
         $outputWidget = new \Widgets\RawHtml();
         $outputWidget->setHtml($htmlBody);
         $this->rawHtmlWidget = $outputWidget;
     }
 }
if ($cert_nodes->length !== 1) {
    header('HTTP/1.1 400 Invalid credential: ' . SF_TAG::X509_CERTIFICATE . ' node count = ' . $cert_nodes->length);
}
$certNode = $cert_nodes->item(0);
$pemCert = $certNode->nodeValue;
$beginpem = "-----BEGIN CERTIFICATE-----\n";
$endpem = "-----END CERTIFICATE-----\n";
$signer_urn = pem_cert_geni_urn($beginpem . $pemCert . $endpem);
/* Test if the signer is from the same GENI Authority as the portal.
   We really would like to compare the signer to the authenticated
   user, but in the speaks-for world we have no way of getting the
   user info without the speaks-for credential. This is an attempt to
   weed out obviously bad signers, while not necessarily an indication
   that the speaks-for credential will work.
*/
$tool = Portal::getInstance();
$tool_pem = $tool->certificate();
$tool_urn = pem_cert_geni_urn($tool_pem);
parse_urn($tool_urn, $tool_authority, $tool_type, $tool_name);
parse_urn($signer_urn, $signer_authority, $signer_type, $signer_name);
if ($signer_authority != $tool_authority) {
    header('HTTP/1.1 406 Not Acceptable');
    exit;
}
/* Now put the credential in the database. */
$db_result = store_speaks_for($key_token, $raw_cred, $signer_urn, $expires);
if (!$db_result) {
    header('HTTP/1.1 500 Cannot store uploaded credential');
    exit;
}
// All done. Signal success without passing any content.
Example #10
0
 public function processData(\IRequestObject $requestObject)
 {
     $htmlBody = "";
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $portletName = $portlet->get_attribute(OBJ_DESC);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     //hack
     //include_once("/Users/mjako/koala-development-workspace-next/koala-core/lib/bid/slashes.php");
     include_once PATH_BASE . "/koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     $portletInstance = \PortletTopic::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
     $tmpl->setVariable("PORTLET_NAME", $portletName);
     //refernce icon
     if ($portletIsReference) {
         $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
     }
     //popupmenu main
     if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON_MAIN");
         $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("PortletTopic");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setCommand("GetPopupMenu");
         $popupmenu->setParams(array(array("key" => "menu", "value" => "nerd")));
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         $tmpl->parse("BLOCK_EDIT_BUTTON_MAIN");
     }
     if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("Portal");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
         $popupmenu->setCommand("PortletGetPopupMenuReference");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         $tmpl->parse("BLOCK_EDIT_BUTTON_MAIN");
     }
     if (sizeof($content) > 0) {
         $categoryCount = 0;
         foreach ($content as $category) {
             $tmpl->setCurrentBlock("category");
             //popupmenu category
             if ($portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
                 $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON_CATEGORY");
                 $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
                 $popupmenu = new \Widgets\PopupMenu();
                 $popupmenu->setData($portlet);
                 $popupmenu->setNamespace("PortletTopic");
                 $popupmenu->setElementId("portal-overlay");
                 $popupmenu->setCommand("GetPopupMenuCategory");
                 $popupmenu->setParams(array(array("key" => "category", "value" => $categoryCount)));
                 $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
                 $tmpl->parse("BLOCK_EDIT_BUTTON_CATEGORY");
             }
             $tmpl->setVariable("CATEGORY_TITLE", $UBB->encode($category["title"]));
             $tmpl->setVariable("TOPIC_ENTRY", "");
             if (isset($category["topics"])) {
                 $entryCount = 0;
                 foreach ($category["topics"] as $topic) {
                     $tmpl->setCurrentBlock("topic_entry");
                     //popupmenu topic
                     if ($portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
                         $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON_TOPIC");
                         $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
                         $popupmenu = new \Widgets\PopupMenu();
                         $popupmenu->setData($portlet);
                         $popupmenu->setNamespace("PortletTopic");
                         $popupmenu->setElementId("portal-overlay");
                         $popupmenu->setCommand("GetPopupMenuEntry");
                         $popupmenu->setParams(array(array("key" => "category", "value" => $categoryCount), array("key" => "entry", "value" => $entryCount)));
                         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
                         $tmpl->parse("BLOCK_EDIT_BUTTON_TOPIC");
                     }
                     if (trim($topic["link_url"]) != "") {
                         $tmpl->setCurrentBlock("TOPIC_LINK");
                         $tmpl->setVariable("TOPIC_TITLE", $UBB->encode($topic["title"]));
                         $tmpl->setVariable("TOPIC_LINK_URL", revealPath($topic["link_url"], $portlet->get_path()));
                         $tmpl->setVariable("TOPIC_LINK_TARGET", $topic["link_target"] == "checked" ? "_blank" : "_top");
                         $tmpl->parse("TOPIC_LINK");
                     } else {
                         $tmpl->setCurrentBlock("TOPIC_NOLINK");
                         $tmpl->setVariable("TOPIC_TITLE", $UBB->encode($topic["title"]));
                         $tmpl->parse("TOPIC_NOLINK");
                     }
                     $tmpl->setVariable("TOPIC_DESCRIPTION", $UBB->encode($topic["description"]));
                     //if there is a url parse headline as link
                     if (trim($topic["link_url"]) == "") {
                         //$tmpl->parse("TOPIC_DISPLAY_TITLE", "topic_display_title");
                     } else {
                         //$tmpl->parse("TOPIC_DISPLAY_TITLE", "topic_display_title_link");
                     }
                     //if there is a description parse out
                     $tmpl->setCurrentBlock("topic_display_description");
                     if (trim($topic["description"]) == "") {
                         $tmpl->setVariable("TOPIC_DISPLAY_DESCRIPTION", "");
                     } else {
                         //$tmpl->parse("TOPIC_DISPLAY_DESCRIPTION", "topic_display_description");
                     }
                     $tmpl->parse("topic_display_description");
                     //parse out every topic
                     $tmpl->parse("topic_entry");
                     $entryCount++;
                 }
             }
             //parse out category
             $tmpl->parse("category");
             $categoryCount++;
         }
     } else {
         $tmpl->setVariable("CATEGORY", "");
     }
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     //popummenu
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $this->rawHtmlWidget = $outputWidget;
 }
Example #11
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $portlet_name = $portlet->get_attribute(OBJ_DESC);
     $params = $requestObject->getParams();
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $portletInstance = \PortletAppointment::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
     $tmpl->setVariable("APPOINTMENT_NAME", $portlet_name);
     $tmpl->setVariable("linkurl", "");
     //refernce icon
     if ($portletIsReference) {
         $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
     }
     //main popupmenu
     if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON_MAIN");
         $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("PortletAppointment");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setCommand("GetPopupMenu");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("Portal");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
         $popupmenu->setCommand("PortletGetPopupMenuReference");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     $tmpl->parse("BLOCK_EDIT_BUTTON_MAIN");
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     if (sizeof($content) > 0) {
         $indexCount = 0;
         foreach ($content as $appointment) {
             $tmpl->setCurrentBlock("BLOCK_TERM");
             //term popupmenu
             if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
                 $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON_MAIN");
                 $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
                 $popupmenu = new \Widgets\PopupMenu();
                 $popupmenu->setCommand("GetPopupMenuTerm");
                 $popupmenu->setData($portlet);
                 $popupmenu->setNamespace("PortletAppointment");
                 $popupmenu->setElementId("portal-overlay");
                 $popupmenu->setParams(array(array("key" => "termIndex", "value" => $indexCount)));
                 $tmpl->setVariable("POPUPMENU_ENTRY", $popupmenu->getHtml());
                 $tmpl->parse("BLOCK_EDIT_BUTTON_TERM");
             }
             $indexCount++;
             $tmpl->setVariable("STARTDATE", $appointment["start_date"]["day"] . "." . $appointment["start_date"]["month"] . "." . $appointment["start_date"]["year"]);
             if (trim($appointment["location"]) != "" && trim($appointment["location"]) != "0") {
                 $tmpl->setCurrentBlock("BLOCK_TERM_LOCATION");
                 $tmpl->setVariable("LOCATION", $UBB->encode($appointment["location"]));
                 $tmpl->setVariable("LOCATION_ROW", "");
                 $tmpl->parse("BLOCK_TERM_LOCATION");
             }
             if ($appointment["end_date"]["day"] != "") {
                 $tmpl->setCurrentBlock("BLOCK_TERM_ENDDATE");
                 $tmpl->setVariable("ENDDATE", $appointment["end_date"]["day"] . "." . $appointment["end_date"]["month"] . "." . $appointment["end_date"]["year"]);
                 $tmpl->setVariable("ENDDATE_ROW", "");
                 $tmpl->parse("BLOCK_TERM_ENDDATE");
             }
             if ($appointment["start_time"]["hour"] != "") {
                 $tmpl->setCurrentBlock("BLOCK_TERM_TIME");
                 $tmpl->setVariable("TIME", $appointment["start_time"]["hour"] . "." . $appointment["start_time"]["minutes"] . " Uhr");
                 $tmpl->setVariable("TIME_ROW", "");
                 $tmpl->parse("BLOCK_TERM_TIME");
             }
             if (trim($appointment["description"]) != "" && trim($appointment["description"]) != "0") {
                 $tmpl->setCurrentBlock("BLOCK_TERM_DESCRIPTION");
                 $tmpl->setVariable("DESCRIPTION", $UBB->encode($appointment["description"]));
                 $tmpl->parse("BLOCK_TERM_DESCRIPTION");
             }
             if (trim($appointment["linkurl"]) != "" && trim($appointment["linkurl"]) != "0") {
                 $tmpl->setCurrentBlock("BLOCK_TERM_LINK");
                 $tmpl->setVariable("LINKURL", derive_url($appointment["linkurl"]));
                 $tmpl->setVariable("TOPIC", $UBB->encode($appointment["topic"]));
                 $tmpl->parse("BLOCK_TERM_LINK");
             } else {
                 $tmpl->setCurrentBlock("BLOCK_TERM_NOLINK");
                 $tmpl->setVariable("TOPIC", $UBB->encode($appointment["topic"]));
                 $tmpl->parse("BLOCK_TERM_NOLINK");
             }
             $tmpl->parse("BLOCK_TERM");
         }
     }
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     //popummenu
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $this->rawHtmlWidget = $outputWidget;
 }
            $attributes = array_merge($project_attributes, $member_attributes);
            $log_url = get_first_service_of_type(SR_SERVICE_TYPE::LOGGING_SERVICE);
            log_event($log_url, Portal::getInstance(), "Canceled join request: {$member_name} in project {$project_name}", $attributes);
        } else {
            $_SESSION['lasterror'] = "Failed to cancel request: " . $cancelres['output'];
        }
    } else {
        if ($cancelres == 1) {
            error_log("cancel-p-req canceled add of {$member_name} to project {$project_name}");
            $_SESSION['lastmessage'] = "Canceled add of {$member_name} to project {$project_name}";
            // log this
            $project_attributes = get_attribute_for_context(CS_CONTEXT_TYPE::PROJECT, $project_id);
            $member_attributes = get_attribute_for_context(CS_CONTEXT_TYPE::MEMBER, $member_id);
            $attributes = array_merge($project_attributes, $member_attributes);
            $log_url = get_first_service_of_type(SR_SERVICE_TYPE::LOGGING_SERVICE);
            log_event($log_url, Portal::getInstance(), "Canceled join request: {$member_name} in project {$project_name}", $attributes);
        } else {
            error_log("cancel-p-req: malformed result from resolve_req: " . print_r($request));
            $_SESSION['lasterror'] = "Error cancelling request";
        }
    }
    relative_redirect('home.php');
}
show_header('GENI Portal: Projects');
include "tool-breadcrumbs.php";
print "<h2>Cancel Project Join Request</h2>\n";
print "Cancel Request to join project <b>{$project_name}</b>:<br/>\n";
print "<br/>\n";
print "<b>Project</b>: <br/>\n";
// Show details on the project: name, purpose, lead
print "<table><tr><th>Name</th><th>Purpose</th><th>Lead</th></tr><tr><td>{$project_name}</td><td>" . $project[PA_PROJECT_TABLE_FIELDNAME::PROJECT_PURPOSE] . "</td><td>{$leadname}</td></tr></table>\n";
Example #13
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     //get singleton and portlet path
     $portletInstance = \PortletHeadline::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     if (sizeof($content) > 0) {
         $portletFileName = $portletPath . "/ui/html/index.html";
         $tmpl = new \HTML_TEMPLATE_IT();
         $tmpl->loadTemplateFile($portletFileName);
         //popupmenu
         if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("PortletHeadline");
             $popupmenu->setElementId("portal-overlay");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("Portal");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
             $popupmenu->setCommand("PortletGetPopupMenuReference");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         $UBB = new \UBBCode();
         include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
         $tmpl->setVariable("DUMMY", "");
         $tmpl->setVariable("EDIT_BUTTON", "");
         $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
         $tmpl->setVariable("ALIGNMENT", trim($content["alignment"]));
         $tmpl->setVariable("HEADLINE", $UBB->encode($content["headline"]));
         //refernce icon
         if ($portletIsReference) {
             $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
         }
         $tmpl->setVariable("SIZE", trim($content["size"]));
         if ($portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON");
             $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
             $tmpl->parse("BLOCK_EDIT_BUTTON");
         }
         $htmlBody = $tmpl->get();
     } else {
         $htmlBody = "";
     }
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     //popummenu
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $outputWidget->setHtml($htmlBody);
     $this->rawHtmlWidget = $outputWidget;
 }
Example #14
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $params = $requestObject->getParams();
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     $portletName = $portlet->get_attribute(OBJ_DESC);
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $portletInstance = \PortletMsg::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
     //headline
     $tmpl->setCurrentBlock("BLOCK_MESSAGE_HEADLINE");
     $tmpl->setVariable("HEADLINE", $portletName);
     //refernce icon
     if ($portletIsReference) {
         $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
     }
     if (!$portletIsReference) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("PortletMsg");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "portletObjectId", "value" => $portlet->get_id())));
         $popupmenu->setCommand("GetPopupMenuHeadline");
         $tmpl->setVariable("POPUPMENU_HEADLINE", $popupmenu->getHtml());
     } else {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("Portal");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
         $popupmenu->setCommand("PortletGetPopupMenuReference");
         $tmpl->setVariable("POPUPMENU_HEADLINE", $popupmenu->getHtml());
     }
     //show empty headline in edit mode
     if (trim($portletName) == "") {
         $tmpl->setVariable("HEADLINE_CLASS", "headline editbutton");
     } else {
         $tmpl->setVariable("HEADLINE_CLASS", "headline");
     }
     $tmpl->parse("BLOCK_MESSAGE_HEADLINE");
     if (sizeof($content) > 0) {
         /*  
          * Convert old messages which save its content as UBB code to new messages
          * using a html representation 
          */
         $convertUBB = false;
         $version = $portlet->get_attribute("bid:portlet:version");
         /*			
         if(!$version){
         	$convertUBB = true;
         	require_once("name.php");
         	$portlet->set_attribute("bid:portlet:version", $msg_version);
         }
         */
         $separator = false;
         foreach ($content as $messageId) {
             $tmpl->setCurrentBlock("BLOCK_MESSAGE");
             $message = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $messageId);
             $message->get_attributes(array("OBJ_DESC", "bid:portlet:msg:picture_id", "bid:portlet:msg:picture_alignment", "bid:portlet:msg:link_url", "bid:portlet:msg:link_url_label", "bid:portlet:msg:link_open"));
             //popupmenu
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($message);
             $popupmenu->setNamespace("PortletMsg");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "messageObjectId", "value" => $messageId), array("key" => "portletObjectId", "value" => $portlet->get_id())));
             $popupmenu->setCommand("GetPopupMenuMessage");
             if (!$portletIsReference) {
                 $tmpl->setVariable("POPUPMENU_MESSAGE", $popupmenu->getHtml());
             }
             /* 
              * Convert old messages which save its content as UBB code to new messages
              * using a html representation
              */
             if ($convertUBB) {
                 $message->set_content($UBB->encode($message->get_content()));
             }
             $tmpl->setVariable("MESSAGE_PICTURE", "");
             $tmpl->setVariable("MESSAGE_LINK", "");
             $tmpl->setVariable("MESSAGE_HEADLINE", $UBB->encode($message->get_attribute("OBJ_NAME")));
             if ($UBB->encode($message->get_attribute("OBJ_DESC")) != "") {
                 $tmpl->setVariable("MESSAGE_SUBHEADLINE", $UBB->encode($message->get_attribute("OBJ_DESC")));
             }
             $tmpl->setVariable("MESSAGE_CONTENT", $message->get_content());
             //get column width
             $columnObject = $portletObject->get_environment();
             $column_width = $columnObject->get_attribute("bid:portal:column:width");
             //PICTURE
             // parse in picture if it exists
             if ($message->get_attribute("bid:portlet:msg:picture_id") != "") {
                 $tmpl->setCurrentBlock("BLOCK_MESSAGE_PICTURE");
                 $picture_width = $message->get_attribute("bid:portlet:msg:picture_width") != "" ? trim($message->get_attribute("bid:portlet:msg:picture_width")) : "";
                 if (extract_percentual_length($picture_width) == "") {
                     $bare_picture_width = extract_length($picture_width);
                     if ($bare_picture_width == "") {
                         $picture_width = "";
                     } else {
                         if ($bare_picture_width > $column_width - 25) {
                             $picture_width = $column_width - 25;
                         }
                     }
                 }
                 $tmpl->setVariable("MESSAGE_PICTURE_ID", $message->get_attribute("bid:portlet:msg:picture_id"));
                 //not used anymore
                 $tmpl->setVariable("MESSAGE_PICTURE_URL", getDownloadUrlForObjectId($message->get_attribute("bid:portlet:msg:picture_id")));
                 $tmpl->setVariable("MESSAGE_PICTURE_ALIGNMENT", $message->get_attribute("bid:portlet:msg:picture_alignment"));
                 $tmpl->setVariable("MESSAGE_PICTURE_WIDTH", $picture_width);
                 $tmpl->parse("BLOCK_MESSAGE_PICTURE");
             }
             //LINK
             //parse in link if it exists
             if (trim($message->get_attribute("bid:portlet:msg:link_url")) != "") {
                 $tmpl->setCurrentBlock("BLOCK_MESSAGE_LINK");
                 if (trim($message->get_attribute("bid:portlet:msg:link_open")) != "checked") {
                     $tmpl->setVariable("MESSAGE_LINK_URL_LABEL", $message->get_attribute("bid:portlet:msg:link_url_label") !== "" ? $UBB->encode($message->get_attribute("bid:portlet:msg:link_url_label")) : $message->get_attribute("bid:portlet:msg:link_url"));
                     $tmpl->setVariable("MESSAGE_LINK_URL", revealPath($message->get_attribute("bid:portlet:msg:link_url"), $message->get_path()));
                     $tmpl->setVariable("MESSAGE_LINK_TARGET", "_top");
                 } else {
                     $tmpl->setVariable("MESSAGE_LINK_URL_LABEL", $message->get_attribute("bid:portlet:msg:link_url_label") !== "" ? $UBB->encode($message->get_attribute("bid:portlet:msg:link_url_label")) : $message->get_attribute("bid:portlet:msg:link_url"));
                     $tmpl->setVariable("MESSAGE_LINK_URL", revealPath($message->get_attribute("bid:portlet:msg:link_url"), $message->get_path()));
                     $tmpl->setVariable("MESSAGE_LINK_TARGET", "_blank");
                 }
                 $tmpl->parse("BLOCK_MESSAGE_LINK");
             }
             //SEPARATOR
             if ($separator) {
                 $tmpl->setCurrentBlock("BLOCK_SEPARATOR");
                 $tmpl->parse("BLOCK_SEPARATOR");
             }
             $separator = true;
             $tmpl->parse("BLOCK_MESSAGE");
         }
     } else {
         //NO MESSAGE
         $tmpl->setCurrentBlock("BLOCK_NO_MESSAGE");
         $tmpl->setVariable("NO_MESSAGE_INFO", "Keine Nachrichten vorhanden.");
         $tmpl->parse("BLOCK_NO_MESSAGE");
     }
     $tmpl->setVariable("PATH_URL", PATH_URL);
     $tmpl->parse("BLOCK_PORTLET_MESSAGE");
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $outputWidget->setHtml($htmlBody);
     $this->rawHtmlWidget = $outputWidget;
 }
Example #15
0
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS
// IN THE WORK.
//----------------------------------------------------------------------
/*
 * Request a speaks-for credential from the user.
 */
require_once 'header.php';
require_once 'portal.php';
require_once 'cert_utils.php';
require_once 'user.php';
require_once 'db-util.php';
require_once 'settings.php';
$portal = Portal::getInstance();
$toolcert = $portal->certificate();
$toolurn = pem_cert_geni_urn($toolcert);
$ma_url = 'https://portal.geni.net/secure/loadcert.php';
$ma_name = 'GPO Member Authority';
/* XXX FIXME: put the signing tool host and URL in a config file. */
if (!isset($genilib_trusted_host)) {
    $genilib_trusted_host = 'https://ch.geni.net:8444';
    if (array_key_exists('SERVER_NAME', $_SERVER)) {
        $server_name = $_SERVER['SERVER_NAME'];
        $portal_prefix = 'portal-';
        // Handle development hosts via their naming conventions.
        // Currently named "portal-XX" and "ch-XX" where XX are the
        // developer's initials.
        if (strpos($server_name, $portal_prefix) === 0) {
            // server name starts with 'portal-'. Replace 'portal-' with 'ch-'
Example #16
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portletInstance = \PortletPoll::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     $portletName = $portlet->get_attribute(OBJ_DESC);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     //hack
     include_once PATH_BASE . "/koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     if (sizeof($content) > 0) {
         //popupmenu
         if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("PortletPoll");
             $popupmenu->setElementId("portal-overlay");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("Portal");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
             $popupmenu->setCommand("PortletGetPopupMenuReference");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         $startDate = $content["start_date"];
         $end_date = $content["end_date"];
         if (time() > mktime(0, 0, 0, $startDate["month"], $startDate["day"], $startDate["year"]) && time() < mktime(24, 0, 0, $end_date["month"], $end_date["day"], $end_date["year"])) {
             $pollActive = true;
         } else {
             $pollActive = false;
         }
         $options = $content["options"];
         $options_votecount = $content["options_votecount"];
         $max_votecount = 1;
         foreach ($options_votecount as $option_votecount) {
             if ($option_votecount > $max_votecount) {
                 $max_votecount = $option_votecount;
             }
         }
         $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
         $tmpl->setVariable("POLL_NAME", $portletName);
         //refernce icon
         if ($portletIsReference) {
             $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
         }
         $tmpl->setVariable("POLL_TOPIC", $content["poll_topic"]);
         if ($pollActive) {
             $i = 0;
             foreach ($options as $option) {
                 if ($option != "") {
                     $tmpl->setCurrentBlock("choice");
                     $tmpl->setVariable("OPTION", $option);
                     $tmpl->setVariable("OPTION_NUMBER", $i);
                     //create command params
                     $tmpl->setVariable("portletObjectId", $portlet->get_id());
                     $tmpl->setVariable("voteItemId", $i);
                     $tmpl->parse("choice");
                 }
                 $i++;
             }
         } else {
             $i = 0;
             foreach ($options as $option) {
                 $tmpl->setCurrentBlock("BLOCK_VOTE_RESULT");
                 if ($option != "") {
                     $tmpl->setVariable("OPTION", $option);
                     $tmpl->setVariable("OPTION_VOTECOUNT", $options_votecount[$i]);
                     $tmpl->setVariable("OPTION_NUMBER", $i);
                     $tmpl->setVariable("PATH_COLOR", PATH_URL);
                     $percentage = $options_votecount[$i] / $max_votecount * 100;
                     $percentage = round($percentage);
                     if ($percentage < 1) {
                         $percentage = 1;
                     }
                     $tmpl->setVariable("WIDTH", $percentage);
                     $tmpl->parse("BLOCK_VOTE_RESULT");
                 }
                 $i++;
             }
         }
         // we show the edit button only if the user has write access to the portal
         // because all portal readers need write access in order to vote
         $portalCol = $portlet->get_environment();
         $portal = $portalCol->get_environment();
         if ($portal->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON");
             $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
             $tmpl->parse("BLOCK_EDIT_BUTTON");
         }
     }
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     //popummenu
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $outputWidget->setHtml($htmlBody);
     $this->rawHtmlWidget = $outputWidget;
 }