/**
 * Populate $portal_objects with objects which aren't private
 *
 * @param Milestone $milestone
 * @param array $portal_objects
 * @param Portal $portal
 * @return null
 */
function discussions_handle_on_portal_milestone_objects(&$milestone, &$portal_objects, &$portal)
{
    if ($portal->getProjectPermissionValue('discussion') >= PROJECT_PERMISSION_ACCESS) {
        $portal_objects[lang('Discussions')] = Discussions::findByMilestone($milestone, STATE_VISIBLE, VISIBILITY_NORMAL);
        // used existing find method
    }
    // if
}
Пример #2
0
/**
 * Return add discussion URL via public portal
 *
 * @param Portal $portal
 * @param Project $project
 * @param array $additional_params
 * @return string
 */
function portal_discussions_module_add_discussion_url($portal, $project, $additional_params = null)
{
    $params = array('portal_name' => $portal->getSlug());
    if ($additional_params !== null) {
        $params = array_merge($params, $additional_params);
    }
    // if
    return assemble_url('portal_discussions_add', $params);
}
Пример #3
0
 /**
  * Executes view action.
  */
 public function executeView()
 {
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         $user = $this->getUser();
         $prefered_cultures = $user->getCulturesForDocuments();
         $associated_parkings = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_parking')), 'elevation');
         if (count($associated_parkings)) {
             $associated_parkings = Association::createHierarchyWithBestName($associated_parkings, $prefered_cultures, array('type' => 'pp'));
             $associated_parkings = Parking::getAssociatedParkingsData($associated_parkings);
         }
         $this->associated_parkings = $associated_parkings;
         $related_portals = array();
         Portal::getLocalPortals($related_portals, $this->associated_areas);
         $this->related_portals = $related_portals;
         $product_type_list = sfConfig::get('mod_products_types_list');
         $product_type_index_list = $this->document->get('product_type');
         $product_type_name_list = array();
         foreach ($product_type_index_list as $product_type_index) {
             $product_type_name_list[] = $this->__($product_type_list[$product_type_index]);
         }
         $product_types = implode(', ', $product_type_name_list);
         $doc_name = $this->document->get('name');
         $title = $doc_name;
         if ($this->document->isArchive()) {
             $version = $this->getRequestParameter('version');
             $title .= ' :: ' . $this->__('revision') . ' ' . $version;
         }
         $title .= ' :: ' . $product_types;
         $this->setPageTitle($title);
         $description = array($product_types . ' :: ' . $doc_name, $this->getAreasList());
         $this->getResponse()->addMeta('description', implode(' - ', $description));
     }
 }
Пример #4
0
 /**
  * Parses $_SERVER['PATH_INFO'] and returns an array.
  * @return array
  */
 public static function path_info()
 {
     if (self::$path_info === null) {
         self::$path_info = empty($_SERVER['PATH_INFO']) ? array() : explode('/', substr($_SERVER['PATH_INFO'], 1));
     }
     return self::$path_info;
 }
Пример #5
0
 public function executeView()
 {
     sfLoader::loadHelpers(array('General', 'MetaLink'));
     parent::executeView();
     // we get the user (id + name) who first uploaded this picture:
     $this->creator = $this->document->getCreator();
     $this->image_type = $this->document['image_type'];
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         // here, we add the summit name to route names :
         $associated_routes = array_filter($this->associated_docs, array('c2cTools', 'is_route'));
         $associated_routes = Route::addBestSummitName($associated_routes, $this->__(' :') . ' ');
         $associated_docs = array_filter($this->associated_docs, array('c2cTools', 'is_not_route'));
         $associated_docs = array_filter($associated_docs, array('c2cTools', 'is_not_image'));
         $associated_docs = array_merge($associated_docs, $associated_routes);
         // sort by document type, name
         if (!empty($associated_docs)) {
             foreach ($associated_docs as $key => $row) {
                 $module[$key] = $row['module'];
                 $name[$key] = remove_accents($row['name']);
             }
             array_multisort($module, SORT_STRING, $name, SORT_STRING, $associated_docs);
         }
         $this->associated_documents = $associated_docs;
         // add linked docs areas (except users and images)
         $parent_ids = array();
         $associated_areas = array();
         foreach ($this->associated_docs as $doc) {
             if (!in_array($doc['module'], array('images', 'users'))) {
                 $parent_ids[] = $doc['id'];
             }
         }
         if (count($parent_ids)) {
             $prefered_cultures = $this->getUser()->getCulturesForDocuments();
             $associated_docs_areas = GeoAssociation::findAreasWithBestName($parent_ids, $prefered_cultures);
             $associated_areas = $this->associated_areas;
             $areas_ids = array();
             foreach ($associated_areas as $area) {
                 $areas_ids[] = $area['id'];
             }
             foreach ($associated_docs_areas as $area) {
                 if (!in_array($area['id'], $areas_ids)) {
                     $associated_areas[] = $area;
                 }
             }
         }
         $this->associated_areas = $associated_areas;
         $related_portals = array();
         $activities = $this->document->get('activities');
         if (in_array(5, $activities)) {
             $related_portals[] = 'ice';
         }
         Portal::getLocalPortals($related_portals, $associated_areas);
         $this->related_portals = $related_portals;
         // link for facebook
         list($image_name, $image_ext) = Images::getFileNameParts($this->document['filename']);
         $image_url = DIRECTORY_SEPARATOR . sfConfig::get('app_upload_dir') . DIRECTORY_SEPARATOR . sfConfig::get('app_images_directory_name') . DIRECTORY_SEPARATOR . $image_name . 'SI' . $image_ext;
         addMetaLink('image_src', $image_url);
     }
 }
Пример #6
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);
 }
 /**
  * The subscribe view and processor
  */
 public function subscribeAction()
 {
     $identity = $this->authenticate();
     $userId = $identity['id'];
     if ($this->getRequest()->getParam('subscribe')) {
         // subscribe with id parameter
         $feedId = $this->getRequest()->getParam('feedId');
         $feed = $this->feeds->get($feedId);
         // if feed exists and user can register
         if ($feed && !$this->portal->get($userId, $feedId)) {
             $row = $this->portal->createRow(array('user_id' => $userId, 'feed_id' => $feedId));
             $row->save();
         }
         if ($this->getRequest()->isXmlHttpRequest()) {
             if ($row) {
                 $this->view->status = "Added";
             } else {
                 // error
                 $this->view->status = "Failed";
             }
             return;
         } else {
             $this->_helper->getHelper('Redirector')->goto('subscribe', null, null, array('feedId' => $feed['group_id'], 'subscribe' => true));
         }
     }
     $groupId = (int) $this->getRequest()->getParam('feedId');
     if (!$groupId) {
         $groupId = Feeds::ROOT_GROUP_ID;
     }
     // get all groups
     $this->view->groups = $this->feeds->listGroups($groupId);
     if ($this->view->groups === null) {
         // TODO: handle error - problems in group
         $this->gotoDefault();
     }
     // get predessecors
     $this->view->parents = $this->feeds->listParents($groupId);
     if ($this->view->parents === null) {
         // TODO: handle error - cyclic parents
         $this->gotoDefault();
     }
     // get feeds
     $this->view->feeds = $this->feeds->listFeeds($groupId);
     // check if already subscribed
     $this->view->subscription = array();
     foreach ($this->view->feeds as $feed) {
         $id = $feed['id'];
         $this->view->subscription[$id] = $this->portal->get($userId, $id) === null;
     }
     // user's identity
     $this->view->user = $identity;
     // the current group
     $this->view->groupId = $groupId;
 }
Пример #8
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;
 }
Пример #9
0
 public function executeView()
 {
     parent::executeView();
     // add editor + code for in map title
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         $related_portals = array();
         Portal::getLocalPortals($related_portals, $this->associated_areas);
         $this->related_portals = $related_portals;
         $map_editors_list = sfConfig::get('mod_maps_editors_list');
         $title = $this->__($map_editors_list[$this->document->get('editor')]) . ' ' . $this->document->get('code') . ' ' . $this->document->get('name') . ' :: ' . $this->__(substr($this->getModuleName(), 0, -1));
         $this->setPageTitle($title);
     }
 }
Пример #10
0
 public function testToArray()
 {
     $expected = ['name' => 'foo', 'key' => 'bar', 'resourceLocator' => ['strategy' => 'hello'], 'localizations' => [['foo']], 'environments' => [['type' => 'd']]];
     $this->environment->toArray()->willReturn($expected['environments'][0]);
     $this->environment->getType()->willReturn('d');
     $this->localization->toArray()->willReturn($expected['localizations'][0]);
     $this->localization->isDefault()->willReturn(true);
     $this->environment->getUrls()->willReturn([]);
     $this->portal->addEnvironment($this->environment->reveal());
     $this->portal->addLocalization($this->localization->reveal());
     $this->portal->setResourceLocatorStrategy($expected['resourceLocator']['strategy']);
     $this->portal->setName($expected['name']);
     $this->portal->setKey($expected['key']);
     $this->assertEquals($expected, $this->portal->toArray());
 }
Пример #11
0
 public static function login($user = '', $password = '')
 {
     if (substr($user, 0, 2) !== 'cc') {
         $user = "******" . $user;
         error_log($user . " , " . substr($user, 0, 2));
     }
     $logindata = array('wu_loginname' => urlencode($user), 'wu_password' => urlencode($password), 'Login' => urlencode('Inloggen'));
     $curl = curl::post('https://leerlingen.candea.nl/Login?passAction=login&path=%2F', $logindata, array(CURLOPT_HEADER => 1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_SSL_VERIFYPEER => false));
     if (strpos($curl, 'Inloggegevens onjuist') != 0) {
         return false;
     }
     preg_match('/^Set-Cookie:\\s*([^;]*)/mi', $curl, $cookies);
     parse_str($cookies[1], $cookies);
     $cookiestr = '';
     foreach ($cookies as $key => $val) {
         $cookiestr .= "{$key}={$val}; ";
     }
     self::$cookiestr = $cookiestr;
     setcookie("portal", $cookiestr, time() + 86400 * 30, "/");
     // 86400 = 1 day
     return true;
 }
Пример #12
0
 /**
  * Executes view action.
  */
 public function executeView()
 {
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         $user = $this->getUser();
         $prefered_cultures = $user->getCulturesForDocuments();
         $this->associated_summits = Summit::getAssociatedSummitsData($this->associated_docs);
         $this->associated_routes = Route::getAssociatedRoutesData($this->associated_docs, $this->__(' :') . ' ');
         $this->associated_huts = Hut::getAssociatedHutsData($this->associated_docs);
         $this->associated_sites = Site::getAssociatedSitesData($this->associated_docs);
         // add linked docs areas
         $parent_ids = array();
         $associated_areas = array();
         if (count($this->associated_docs)) {
             foreach ($this->associated_docs as $doc) {
                 $parent_ids[] = $doc['id'];
             }
             $associated_areas = GeoAssociation::findAreasWithBestName($parent_ids, $prefered_cultures);
         }
         $this->associated_areas = $associated_areas;
         $cas = count($this->associated_summits);
         $car = count($this->associated_routes);
         $cah = count($this->associated_huts);
         $cab = count($this->associated_sites);
         $this->section_list = array('summits' => $cas != 0, 'routes' => $car != 0, 'huts' => $cah != 0, 'sites' => $cab != 0, 'docs' => $cas + $car + $cah + $cab == 0);
         $related_portals = array();
         $activities = $this->document->get('activities');
         $book_types = $this->document->get('book_types');
         Portal::getRelatedPortals($related_portals, $this->associated_areas, $this->associated_routes, $activities);
         if (array_intersect(array(1, 4, 10, 14, 18), $book_types) && in_array(5, $activities) && !in_array('ice', $related_portals)) {
             $related_portals[] = 'ice';
         }
         $this->related_portals = $related_portals;
         $description = array($this->__('book') . ' :: ' . $this->document->get('name'), $this->getActivitiesList());
         $this->getResponse()->addMeta('description', implode(' - ', $description));
     }
 }
Пример #13
0
 public function executeView()
 {
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         // get last geo-associated outings
         $current_doc_id = $this->getRequestParameter('id');
         $latest_outings = array();
         $nb_outings = 0;
         $outing_params = array('areas' => $current_doc_id);
         $nb_outings = sfConfig::get('app_nb_linked_outings_areas');
         $latest_outings = Outing::listLatest($nb_outings + 1, array(), array(), array(), $outing_params, false);
         $latest_outings = Language::getTheBest($latest_outings, 'Outing');
         $this->latest_outings = $latest_outings;
         $this->nb_outings = $nb_outings;
         $related_portals = array();
         $id = $this->getRequestParameter('id');
         $areas = array(array('id' => $id));
         Portal::getLocalPortals($related_portals, $areas);
         $this->related_portals = $related_portals;
         $area_types_list = sfConfig::get('mod_areas_area_types_list');
         $title = $this->document->get('name') . ' :: ' . $this->__($area_types_list[$this->document->get('area_type')]);
         $this->setPageTitle($title);
     }
 }
Пример #14
0
 /**
  * Return portal revision view URL
  *
  * @param Portal $portal
  * @return string
  */
 function getPortalViewUrl($portal)
 {
     return assemble_url('portal_repository_commit', array('portal_name' => $portal->getSlug(), 'repository_id' => $this->getParentId(), 'r' => $this->getRevision()));
 }
Пример #15
0
/**
 * Get the URL of source module
 *
 * @param Portal $portal
 * @return string
 */
function portal_source_module_url($portal)
{
    return assemble_url('portal_repositories', array('portal_name' => $portal->getSlug()));
}
 /**
  * Return all milestones for a given portal project
  *
  * @param Portal $portal
  * @param Project $project
  * @return array
  */
 function findByPortalProject($portal, $project)
 {
     if ($portal->getProjectPermissionValue('milestone') >= PROJECT_PERMISSION_ACCESS) {
         return ProjectObjects::find(array('conditions' => array('project_id = ? AND type = ? AND state >= ? AND visibility >= ?', $project->getId(), 'Milestone', STATE_VISIBLE, VISIBILITY_NORMAL), 'order' => 'name'));
     }
     // if
     return null;
 }
Пример #17
0
 /**
  * Executes view action.
  */
 public function executeView()
 {
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         $user = $this->getUser();
         $prefered_cultures = $user->getCulturesForDocuments();
         $current_doc_id = $this->getRequestParameter('id');
         $parent_ids = array();
         $main_associated_summits = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_summit')), 'elevation');
         if (count($main_associated_summits)) {
             foreach ($main_associated_summits as $summit) {
                 $parent_ids[] = $summit['id'];
             }
         }
         // extract coord of highest summit
         $highest_summit = c2cTools::extractHighest($main_associated_summits);
         $this->lat = $highest_summit['lat'];
         $this->lon = $highest_summit['lon'];
         $this->elevation = $highest_summit['elevation'];
         // routes associated with this route (eg because they share most of the route)
         $associated_routes = Route::getAssociatedRoutesData($this->associated_docs, $this->__(' :') . ' ');
         $this->associated_routes = $associated_routes;
         // We will display the outings linked to associated routes in a separate section
         // but not for the raids
         $route_ids = array();
         if (count($associated_routes)) {
             foreach ($associated_routes as $route) {
                 if ($route['duration'] instanceof Doctrine_Null or $route['duration'] <= 4) {
                     $route_ids[] = $route['id'];
                 }
             }
         }
         // we will also get parkings linked to linked parkings
         $associated_parkings = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_parking')), 'elevation');
         if (count($associated_parkings)) {
             foreach ($associated_parkings as $parking) {
                 $parent_ids[] = $parking['id'];
             }
         }
         // 2-hops summits, parkings, outings, huts
         $parent_ids = array_merge($parent_ids, $route_ids);
         if (count($parent_ids)) {
             $associated_childs = Association::findLinkedDocsWithBestName($parent_ids, $prefered_cultures, array('ss', 'pp', 'ro', 'sh'), true, true);
         } else {
             $associated_childs = array();
         }
         if (count($main_associated_summits)) {
             $associated_summits = Association::createHierarchy($main_associated_summits, array_filter($associated_childs, array('c2cTools', 'is_summit')), array('type' => 'ss', 'show_sub_docs' => false));
         } else {
             $associated_summits = $main_associated_summits;
         }
         // directly and indirectly linked huts
         $associated_huts = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_hut')), 'elevation');
         $associated_summit_huts = array_filter($associated_childs, array('c2cTools', 'is_hut'));
         // remove the summit if it is linked to a hut
         // because in that case it is a ghost summit of the hut, and
         // shouldn't be displayed
         $summit_huts = array();
         foreach ($associated_summit_huts as $summit_hut) {
             foreach ($associated_huts as $key1 => $hut) {
                 if ($summit_hut['id'] == $hut['id']) {
                     $linked = array_keys($summit_hut['parent_relation']);
                     $hut['ghost_id'] = array_shift($linked);
                     $summit_huts[] = $hut;
                     unset($associated_huts[$key1]);
                     foreach ($associated_summits as $key2 => $summit) {
                         if ($summit['id'] == $hut['ghost_id']) {
                             unset($associated_summits[$key2]);
                             break;
                         }
                     }
                     break;
                 }
             }
         }
         $this->associated_huts = Document::fetchAdditionalFieldsFor(array_merge($summit_huts, $associated_huts), 'Hut', array('shelter_type'));
         $this->associated_summits = Document::fetchAdditionalFieldsFor($associated_summits, 'Summit', array('summit_type'));
         // get all the outings from route and associated routes
         $outing_ids = $associated_routes_outings = array();
         if (count($route_ids)) {
             $associated_routes_outings = array_filter($associated_childs, array('c2cTools', 'is_outing'));
             if (count($associated_routes_outings)) {
                 $associated_outings = array_filter($this->associated_docs, array('c2cTools', 'is_outing'));
                 if (count($associated_outings)) {
                     foreach ($associated_outings as $outing) {
                         $outing_ids[] = $outing['id'];
                     }
                     foreach ($associated_routes_outings as $outing) {
                         if (!in_array($outing['id'], $outing_ids)) {
                             $associated_outings[] = $outing;
                         }
                     }
                 } else {
                     $associated_outings = $associated_routes_outings;
                 }
             }
         }
         array_unshift($route_ids, $current_doc_id);
         $this->ids = implode('-', $route_ids);
         if (count($associated_parkings)) {
             $associated_parkings = Association::createHierarchy($associated_parkings, array_filter($associated_childs, array('c2cTools', 'is_parking')), array('type' => 'pp', 'show_sub_docs' => false));
             $associated_parkings = Parking::getAssociatedParkingsData($associated_parkings);
         }
         $this->associated_parkings = $associated_parkings;
         // also get author of books
         $associated_books = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_book')), 'name');
         if (count($associated_books)) {
             $associated_books = Book::getAssociatedBooksData($associated_books);
         }
         $this->associated_books = $associated_books;
         // TODO request will become more and more inefficient as number of linked outings will grow...
         if (!isset($associated_outings)) {
             $associated_outings = array_filter($this->associated_docs, array('c2cTools', 'is_outing'));
         }
         $associated_outings = Outing::fetchAdditionalFields($associated_outings, true, true);
         // sort outings
         usort($associated_outings, array('c2cTools', 'cmpDate'));
         if (count($associated_routes_outings)) {
             $main_outings = $routes_outings = array();
             foreach ($associated_outings as $outing) {
                 if (in_array($outing['id'], $outing_ids)) {
                     $main_outings[] = $outing;
                 } else {
                     $routes_outings[] = $outing;
                 }
             }
         } else {
             $main_outings = $associated_outings;
             $routes_outings = array();
         }
         $nb_outings = count($associated_outings);
         $this->nb_outings = count($associated_outings);
         $this->nb_main_outings = count($main_outings);
         $this->nb_routes_outings = count($routes_outings);
         // group main_outings  by blocks
         $outings_limit = sfConfig::get('app_users_outings_limit');
         $a = array();
         $i = 0;
         while ($i < 9 && count($main_outings) - $i * $outings_limit > $outings_limit) {
             $a[] = array_slice($main_outings, $i * $outings_limit, $outings_limit);
             $i++;
         }
         $a[] = array_slice($main_outings, $i * $outings_limit, $outings_limit);
         $this->associated_outings = $a;
         // group routes_outings  by blocks
         $a = array();
         $i = 0;
         while ($i < 0 && count($routes_outings) - $i * $outings_limit > $outings_limit) {
             $a[] = array_slice($routes_outings, $i * $outings_limit, $outings_limit);
             $i++;
         }
         $a[] = array_slice($routes_outings, $i * $outings_limit, $outings_limit);
         $this->routes_outings = $a;
         // Get related portals
         $related_portals = array();
         $route_data = array();
         $route_data['activities'] = $this->document->get('activities');
         $route_data['ice_rating'] = $this->document->get('ice_rating');
         $route_data['toponeige_technical_rating'] = $this->document->get('toponeige_technical_rating');
         $route_data['global_rating'] = $this->document->get('global_rating');
         $route_data['equipment_rating'] = $this->document->get('equipment_rating');
         $route_data['engagement_rating'] = $this->document->get('engagement_rating');
         $route_data['difficulties_height'] = $this->document->get('difficulties_height');
         $route_data['duration'] = $this->document->get('duration');
         $route_data = array($route_data);
         Portal::getRelatedPortals($related_portals, $this->associated_areas, $route_data);
         $this->related_portals = $related_portals;
         // extract highest associated summit, and prepend its name to display this route's name.
         $this->highest_summit_name = $highest_summit['name'];
         // redefine page title: prepend summit name
         $doc_name = $this->highest_summit_name . $this->__(' :') . ' ' . $this->document->get('name');
         $title = $doc_name;
         if ($this->document->isArchive()) {
             $version = $this->getRequestParameter('version');
             $title .= ' :: ' . $this->__('revision') . ' ' . $version;
         }
         $doc_type = $this->__('route') . ' / topo';
         $title .= ' :: ' . $doc_type;
         $this->setPageTitle($title);
         $description = array($doc_type . ' :: ' . $doc_name, $this->getActivitiesList(), $this->getAreasList());
         $this->getResponse()->addMeta('description', implode(' - ', $description));
     }
 }
Пример #18
0
 public function showError()
 {
     // Calls default error message
     parent::showError();
 }
Пример #19
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;
     }
 }
Пример #20
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
    Topos::deleteTokenFile($jobid);
    Portal_MySQL::real_query(<<<EOS
DELETE FROM `Token`
 WHERE `token_id`={$escjobid}
   AND `user_id`={$escuserid};
EOS
);
    if (!Portal_MySQL::mysql()->affected_rows) {
        REST::fatal(REST::HTTP_NOT_FOUND);
    }
    REST::header(array('status' => REST::HTTP_NO_CONTENT));
    exit;
}
// The user tries to get information about eir jobs
if (file_exists($fullfilename = Portal::JOBRESULTS_DIR . $jobid)) {
    REST::redirect(REST::HTTP_SEE_OTHER, Portal::portalURL() . "jobresults/{$jobid}");
}
$result = Portal_MySQL::query(<<<EOS
SELECT `token_error` 
  FROM `Token`
 WHERE `token_id`={$escjobid}
   AND `user_id`={$escuserid};
EOS
);
if (!($row = $result->fetch_row())) {
    // Can't find what the user is looking for
    REST::fatal(REST::HTTP_GONE);
}
if (empty($row[0])) {
    REST::fatal(REST::HTTP_NOT_FOUND, "<p>Your job hasn't been executed yet. Try again later.</p>");
}
Пример #22
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;
 }
 * a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id: myproxy_renew.php 2378 2009-07-14 14:00:34Z pieterb $
 **************************************************************************/
/**
 * File documentation.
 * @package Portal
 */
require_once 'include/global.php';
if (Portal::user_dn() != @$_SERVER['SSL_SERVER_S_DN']) {
    REST::fatal(REST::HTTP_UNAUTHORIZED);
}
REST::require_method('GET');
foreach (glob(Portal::PROXY_DIR . '*.pem') as $fullfilename) {
    $escfullfilename = escapeshellarg($fullfilename);
    exec("grid-proxy-info -f {$escfullfilename} -exists -valid 1:00", $output, $returnval);
    if (!$returnval) {
        continue;
    }
    // The proxy is valid for at least another hour
    $user_dn_md5 = Portal_MySQL::escape_string(basename($fullfilename, '.pem'));
    $result = Portal_MySQL::query(<<<EOS
SELECT `proxy_server`, `proxy_username`, `proxy_password` FROM `User`
 WHERE `user_dn_md5` = {$user_dn_md5};
EOS
Пример #24
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;
     }
 }
Пример #25
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;
 }
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id: jobresult.php 2471 2009-08-17 20:09:55Z pieterb $
 **************************************************************************/
/**
 * File documentation.
 * @package Portal
 */
require_once 'include/global.php';
REST::require_method('GET', 'HEAD', 'PUT');
$user_id = Portal_User::current()->user_id();
$path_info = Portal::path_info();
$jobid = $path_info[0];
$escjobid = Portal_MySQL::escape_string($jobid);
$escuserid = Portal_MySQL::escape_string($user_id);
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
    if (strpos(@$_SERVER['CONTENT_TYPE'], 'application/x-compressed-tar') !== 0) {
        REST::fatal(REST::HTTP_UNSUPPORTED_MEDIA_TYPE);
    }
    // The job wants to put its results on the portal server
    $tmpfilename = tempnam('/tmp', 'portal_');
    $tmpfile = fopen($tmpfilename, 'w');
    while (($block = fread(REST::inputhandle(), 8192)) !== "") {
        fwrite($tmpfile, $block);
    }
    fclose(REST::inputhandle());
    fclose($tmpfile);
<?php

/*·*************************************************************************
 * Copyright ©2009 SARA Computing and Networking Services
 *                 Amsterdam, the Netherlands
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id: applications_versions.php 2459 2009-08-10 21:20:41Z pieterb $
 **************************************************************************/
/**
 * File documentation.
 * @package Portal
 */
require_once 'include/global.php';
require_once 'portal_app.php';
REST::require_method('GET', 'HEAD');
$directory = RESTDir::factory();
list($appname, $dummy) = Portal::path_info();
foreach (Portal_App::versions($appname) as $version) {
    $directory->line($version, array('Description' => "{$appname} version {$version}"));
}
$directory->end();
Пример #28
0
 $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.
    REST::fatal(REST::HTTP_BAD_REQUEST, 'Missing (one of) required parameters "email" and "password"');
}
$dn = Portal_User::csa_dn();
if (empty($dn)) {
    REST::fatal(REST::HTTP_NOT_FOUND);
}
$escemail = Portal_MySQL::escape_string($_GET['email']);
$md5password = md5($_GET['password']);
$escdn = Portal_MySQL::escape_string($dn);
Portal_MySQL::real_query(<<<EOS
DELETE FROM `User`
WHERE `user_dn` = {$escdn}
  AND `user_email` <> {$escemail};
EOS
);
Portal_MySQL::real_query(<<<EOS
UPDATE `User`
SET `user_dn` = {$escdn}
WHERE `user_email` = {$escemail}
  AND `user_password` = '{$md5password}';
EOS
);
if (!Portal_MySQL::mysql()->affected_rows) {
    Portal_User::unauthorized();
}
$url = REST::htmlspecialchars(Portal::portalURL());
REST::fatal(REST::HTTP_OK, <<<EOS
<p>Registration complete.</p>
<p>You can now start <a href="{$url}">using the GridApps web service</a>.</p>
EOS
);
Пример #30
0
 * a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id: proxy.php 2378 2009-07-14 14:00:34Z pieterb $
 **************************************************************************/
/**
 * File documentation.
 * @package Portal
 */
require_once 'include/global.php';
$userdnmd5 = md5(Portal::user_dn());
$proxy = Portal::PROXY_DIR . $userdnmd5 . '.pem';
$escproxy = str_replace("'", "\\'", $proxy);
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
    $input = REST::inputhandle();
    $output = fopen($proxy, 'w');
    while (!feof($input)) {
        if (($block = fread($input, 8192)) === false) {
            REST::fatal(REST::HTTP_INTERNAL_SERVER_ERROR, 'Error while reading PUT data');
        }
        fwrite($output, $block);
    }
    fclose($output);
    fclose($input);
    REST::header(array('status' => REST::HTTP_NO_CONTENT));
    exit;