/**
  * Up
  **/
 public function up()
 {
     if ($this->db->tableExists('#__extensions')) {
         $query = "SELECT * FROM `#__extensions` WHERE `element` IN ('com_users', 'com_members')";
         $this->db->setQuery($query);
         $objs = $this->db->loadObjectList();
         $users = null;
         $members = null;
         foreach ($objs as $obj) {
             if ($obj->element == 'com_users') {
                 $users = new \Hubzero\Config\Registry($obj->params);
             }
             if ($obj->element == 'com_members') {
                 $members = new \Hubzero\Config\Registry($obj->params);
             }
         }
         if ($users && $members) {
             $params = array('allowUserRegistration' => 1, 'new_usertype' => 2, 'guest_usergroup' => 1, 'sendpassword' => 1, 'useractivation' => 2, 'simple_registration' => 0, 'allow_duplicate_emails' => 0, 'mail_to_admin' => 1, 'captcha' => '', 'frontend_userparams' => 1, 'site_language' => 0, 'change_login_name' => 0, 'reset_count' => 10, 'reset_time' => 1, 'login_attempts_limit' => 10, 'login_attempts_timeframe' => 1);
             foreach ($params as $param => $dflt) {
                 $members->set($param, $users->get('param', $dflt));
             }
             $query = "UPDATE `#__extensions` SET `params`=" . $this->db->quote($members->toString()) . " WHERE `element`='com_members'";
             $this->db->setQuery($query);
             $this->db->query();
         }
     }
 }
示例#2
0
 function display($tpl = null)
 {
     $user = User::getRoot();
     // If this is an auth_link account update, carry on, otherwise raise an error
     if (!is_object($user) || !array_key_exists('auth_link_id', $user) || !is_numeric($user->get('username')) || !$user->get('username') < 0) {
         App::abort('405', 'Method not allowed');
         return;
     }
     // Get and add the js and extra css to the page
     \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'link.css');
     \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'providers.css');
     \Hubzero\Document\Assets::addComponentScript('com_users', 'link');
     // Import a few things
     jimport('joomla.user.helper');
     // Look up a few things
     $hzal = \Hubzero\Auth\Link::find_by_id($user->get("auth_link_id"));
     $hzad = \Hubzero\Auth\Domain::find_by_id($hzal->auth_domain_id);
     $plugins = Plugin::byType('authentication');
     // Get the display name for the current plugin being used
     Plugin::import('authentication', $hzad->authenticator);
     $plugin = Plugin::byType('authentication', $hzad->authenticator);
     $pparams = new \Hubzero\Config\Registry($plugin->params);
     $refl = new ReflectionClass("plgAuthentication{$plugin->name}");
     $display_name = $pparams->get('display_name', $refl->hasMethod('onGetLinkDescription') ? $refl->getMethod('onGetLinkDescription')->invoke(NULL) : ucfirst($plugin->name));
     // Look for conflicts - first check in the hub accounts
     $profile_conflicts = \Hubzero\User\Profile\Helper::find_by_email($hzal->email);
     // Now check the auth_link table
     $link_conflicts = \Hubzero\Auth\Link::find_by_email($hzal->email, array($hzad->id));
     $conflict = array();
     if ($profile_conflicts) {
         foreach ($profile_conflicts as $p) {
             $user_id = JUserHelper::getUserId($p);
             $juser = User::getInstance($user_id);
             $auth_link = \Hubzero\Auth\Link::find_by_user_id($juser->id);
             $dname = is_object($auth_link) && $auth_link->auth_domain_name ? $auth_link->auth_domain_name : 'hubzero';
             $conflict[] = array("auth_domain_name" => $dname, "name" => $juser->name, "email" => $juser->email);
         }
     }
     if ($link_conflicts) {
         foreach ($link_conflicts as $l) {
             $juser = User::getInstance($l['user_id']);
             $conflict[] = array("auth_domain_name" => $l['auth_domain_name'], "name" => $juser->name, "email" => $l['email']);
         }
     }
     // Make sure we don't somehow have any duplicate conflicts
     $conflict = array_map("unserialize", array_unique(array_map("serialize", $conflict)));
     // @TODO: Could also check for high probability of name matches???
     // Get the site name
     $sitename = Config::get('sitename');
     // Assign variables to the view
     $this->assign('hzal', $hzal);
     $this->assign('hzad', $hzad);
     $this->assign('plugins', $plugins);
     $this->assign('display_name', $display_name);
     $this->assign('conflict', $conflict);
     $this->assign('sitename', $sitename);
     $this->assignref('juser', $user);
     parent::display($tpl);
 }
示例#3
0
 /**
  * Utility method to act on a user after it has been saved.
  *
  * This method sends a registration email to new users created in the backend.
  *
  * @param   array    $user     Holds the new user data.
  * @param   boolean  $isnew    True if a new user is stored.
  * @param   boolean  $success  True if user was succesfully stored in the database.
  * @param   string   $msg      Message.
  * @return  void
  */
 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     // Initialise variables.
     $config = App::get('config');
     $mail_to_user = $this->params->get('mail_to_user', 0);
     // [!] HUBzero - changed default value
     if ($isnew) {
         // TODO: Suck in the frontend registration emails here as well. Job for a rainy day.
         if (App::isAdmin()) {
             if ($mail_to_user) {
                 $lang = App::get('language');
                 $defaultLocale = $lang->getTag();
                 // Look for user language. Priority:
                 //  1. User frontend language
                 //  2. User backend language
                 $userParams = new \Hubzero\Config\Registry($user['params']);
                 $userLocale = $userParams->get('language', $userParams->get('admin_language', $defaultLocale));
                 if ($userLocale != $defaultLocale) {
                     $lang->setLanguage($userLocale);
                 }
                 $lang->load('plg_user_joomla', PATH_APP . DS . 'bootstrap' . DS . 'site') || $lang->load('plg_user_joomla', PATH_APP . DS . 'bootstrap' . DS . 'administrator') || $lang->load('plg_user_joomla', __DIR__);
                 // Compute the mail subject.
                 $emailSubject = Lang::txt('PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', $user['name'], $config->get('sitename'));
                 // Compute the mail body.
                 $emailBody = Lang::txt('PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', $user['name'], $config->get('sitename'), Request::root(), $user['username'], $user['password_clear']);
                 // Assemble the email data...the sexy way!
                 $mail = JFactory::getMailer()->setSender(array($config->get('mailfrom'), $config->get('fromname')))->addRecipient($user['email'])->setSubject($emailSubject)->setBody($emailBody);
                 // Set application language back to default if we changed it
                 if ($userLocale != $defaultLocale) {
                     $lang->setLanguage($defaultLocale);
                 }
                 if (!$mail->Send()) {
                     // TODO: Probably should raise a plugin error but this event is not error checked.
                     throw new Exception(Lang::txt('ERROR_SENDING_EMAIL'), 500);
                 }
             }
         }
     } else {
         // Existing user - nothing to do...yet.
     }
 }
示例#4
0
 /**
  * Short description for 'display'
  *
  * Long description (if any) ...
  *
  * @param      unknown $tpl Parameter description (if any) ...
  * @return     void
  */
 function display($tpl = null)
 {
     // Initialize variables
     $image = '';
     $menu = \App::get('menu');
     $item = $menu->getActive();
     if ($item) {
         $params = $menu->getParams($item->id);
     } else {
         $params = new \Hubzero\Config\Registry('');
         $template = App::get('template')->template;
         $inifile = App::get('template')->path . DS . 'html' . DS . 'com_user' . DS . 'logout' . DS . 'config.ini';
         if (file_exists($inifile)) {
             $params->parse(file_get_contents($inifile));
         }
         $params->def('page_title', Lang::txt('Logout'));
     }
     $type = 'logout';
     // Set some default page parameters if not set
     $params->def('show_page_title', 1);
     if (!$params->get('page_title')) {
         $params->set('page_title', Lang::txt('Logout'));
     }
     if (!$item) {
         $params->def('header_logout', '');
     }
     $params->def('pageclass_sfx', '');
     $params->def('logout', '/');
     $params->def('description_logout', 1);
     $params->def('description_logout_text', Lang::txt('LOGOUT_DESCRIPTION'));
     $params->def('image_logout', 'key.jpg');
     $params->def('image_logout_align', 'right');
     $usersConfig = Component::params('com_users');
     $params->def('registration', $usersConfig->get('allowUserRegistration'));
     $title = Lang::txt('Logout');
     // Set page title
     Document::setTitle($title);
     // Build logout image if enabled
     if ($params->get('image_' . $type) != -1) {
         $image = '/images/stories/' . $params->get('image_' . $type);
         $image = '<img src="' . $image . '" align="' . $params->get('image_' . $type . '_align') . '" hspace="10" alt="" />';
     }
     // Get the return URL
     if (!($url = Request::getVar('return', '', 'method', 'base64'))) {
         $url = base64_encode($params->get($type));
     }
     $this->assign('image', $image);
     $this->assign('type', $type);
     $this->assign('return', $url);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
示例#5
0
 function display($tpl = null)
 {
     // Assign variables to the view
     $authenticator = \Request::getWord('authenticator', false);
     \Hubzero\Document\Assets::addComponentStylesheet('com_user', 'login.css');
     // Get the site name
     $sitename = \Config::get('sitename');
     // Get the display name for the current plugin being used
     $plugin = Plugin::byType('authentication', $authenticator);
     $pparams = new \Hubzero\Config\Registry($plugin->params);
     $display_name = $pparams->get('display_name', ucfirst($plugin->name));
     $this->assign('authenticator', $authenticator);
     $this->assign('sitename', $sitename);
     $this->assign('display_name', $display_name);
     parent::display($tpl);
 }
示例#6
0
 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', JText::_('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', 'f0ae');
     if ($describe) {
         return $response;
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     // Check to see if user is member and plugin access requires members
     $sparams = new \Hubzero\Config\Registry($course->offering()->section()->get('params'));
     if (!$course->offering()->section()->access('view') && !$sparams->get('preview', 0)) {
         $response->set('html', '<p class="info">' . Lang::txt('COURSES_PLUGIN_REQUIRES_MEMBER', ucfirst($active)) . '</p>');
         return $response;
     }
     // Determine if we need to return any HTML (meaning this is the active plugin)
     if ($response->get('name') == $active) {
         $this->css();
         // Course and action
         $this->course = $course;
         $action = strtolower(Request::getWord('action', ''));
         $this->view = $this->view('default', 'outline');
         $this->view->option = Request::getCmd('option', 'com_courses');
         $this->view->controller = Request::getWord('controller', 'course');
         $this->view->course = $course;
         $this->view->offering = $offering;
         $this->view->config = $course->config();
         switch ($action) {
             case 'build':
                 $this->_build();
                 break;
             default:
                 $this->js();
                 $this->_display();
                 break;
         }
         $response->set('html', $this->view->loadTemplate());
     }
     // Return the output
     return $response;
 }
 /**
  * Up
  **/
 public function up()
 {
     //create new format table
     $query = "CREATE TABLE IF NOT EXISTS `#__citations_format` (\n\t\t\t\t\t`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`typeid` int(11) DEFAULT NULL,\n\t\t\t\t\t`style` varchar(50) DEFAULT NULL,\n\t\t\t\t\t`format` text,\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
     $this->db->setQuery($query);
     $this->db->query();
     // get citation params
     if ($this->db->tableExists('#__extensions')) {
         $sql = "SELECT params FROM `#__extensions` WHERE `type`='component' AND `element`='com_citations';";
     } else {
         $sql = "SELECT params FROM `#__components` WHERE `option`='com_citations';";
     }
     $this->db->setQuery($sql);
     $rawCitationParams = $this->db->loadResult();
     $citationParams = new \Hubzero\Config\Registry($rawCitationParams);
     //insert default format
     $query = "INSERT INTO `#__citations_format` (`typeid`, `style`, `format`)\n\t\t\tSELECT NULL,'custom'," . $this->db->quote($citationParams->get('citation_format', '')) . "\n\t\t\tFROM DUAL WHERE NOT EXISTS (SELECT `typeid` FROM `#__citations_format` WHERE `typeid` IS NULL);";
     if (!empty($query)) {
         $this->db->setQuery($query);
         $this->db->query();
     }
 }
示例#8
0
             $breeze .= !$breeze ? '<a title="View Presentation - Flash Version" class="breeze flash" href="' . $grandchild->path . '&amp;no_html=1" title="' . $this->escape(stripslashes($grandchild->title)) . '">' . Lang::txt('View Flash') . '</a>' : '';
             break;
         case "hubpresenter":
             $hubpresenter .= !$hubpresenter ? '<a title="View Presentation - HTML5 Version" class="hubpresenter html5" href="' . $grandchild->path . '" title="' . $this->escape(stripslashes($grandchild->title)) . '">' . Lang::txt('View HTML') . '</a>' : '';
             break;
         case "pdf":
         default:
             if ($grandchild->logicaltype == 14) {
                 $pdf .= '<a href="' . $grandchild->path . '">' . Lang::txt('Notes') . '</a>' . "\n";
             } elseif ($grandchild->logicaltype == 51) {
                 $exercises .= '<a href="' . $grandchild->path . '">' . stripslashes($grandchild->title) . '</a>' . "\n";
             } else {
                 $grandchildParams = new \Hubzero\Config\Registry($grandchild->params);
                 $grandchildAttribs = new \Hubzero\Config\Registry($grandchild->attribs);
                 $linkAction = $grandchildParams->get('link_action', 0);
                 $width = $grandchildAttribs->get('width', 640) + 20;
                 $height = $grandchildAttribs->get('height', 360) + 60;
                 if ($linkAction == 1) {
                     $supp .= '<a rel="external" href="' . $grandchild->path . '">' . stripslashes($grandchild->title) . '</a><br />' . "\n";
                 } elseif ($linkAction == 2) {
                     $url = Route::url('index.php?option=com_resources&id=' . $child->id . '&resid=' . $grandchild->id . '&task=play');
                     $supp .= '<a class="play ' . $width . 'x' . $height . '" href="' . $url . '">' . stripslashes($grandchild->title) . '</a><br />' . "\n";
                 } else {
                     $supp .= '<a href="' . $grandchild->path . '">' . stripslashes($grandchild->title) . '</a><br />' . "\n";
                 }
             }
             break;
     }
 }
 if ($hubpresenter) {
     $html .= "\t\t\t" . '<td>' . $hubpresenter . '<br>' . $breeze . '</td>' . "\n";
示例#9
0
 /**
  * Get a list of events for a group
  *
  * @param      object $group
  * @param      array  $filters
  * @return     array
  */
 private function getGroupMembers($group, $filters = array())
 {
     // get members from group
     $members = $group->get('members');
     // get group params
     $params = \Component::params("com_groups");
     $displaySystemUsers = $params->get('display_system_users', 'no');
     //get this groups params
     $gparams = new \Hubzero\Config\Registry($group->get('params'));
     $displaySystemUsers = $gparams->get('display_system_users', $displaySystemUsers);
     // filter is system users
     if ($displaySystemUsers == 'no') {
         $members = array_map(function ($userid) {
             return $userid < 1000 ? null : $userid;
         }, $members);
         $members = array_values(array_filter($members));
     }
     // shuffle order
     shuffle($members);
     // limit members based on the filter
     $members = array_slice($members, 0, $filters['limit']);
     //return members
     return $members;
 }
示例#10
0
 /**
  * Actions to perform after deleting a course
  *
  * @param      object  $model \Components\Courses\Models\Course
  * @return     void
  */
 public function onOfferingDelete($model)
 {
     if (!$model->exists()) {
         return;
     }
     $params = new \Hubzero\Config\Registry($model->get('params'));
     if ($product = $params->get('store_product_id', 0)) {
         $warehouse = new StorefrontModelWarehouse();
         // Delete by existing course ID (pID returned with $course->add() when the course was created)
         $warehouse->deleteProduct($product);
     }
 }
示例#11
0
    ?>

					<?php 
    foreach ($fieldSet as $field) {
        ?>
						<?php 
        if (!$field->hidden) {
            ?>
							<div class="input-wrap <?php 
            if ($field->type == 'Spacer') {
                echo ' input-spacer';
            }
            ?>
">
								<?php 
            $field->setValue($data->get($field->fieldname));
            ?>
								<?php 
            echo $field->label;
            ?>
								<?php 
            echo $field->input;
            ?>
							</div>
						<?php 
        } else {
            $hidden_fields .= $field->input;
            ?>
						<?php 
        }
        ?>
示例#12
0
 /**
  * Special formatting for results
  *
  * @param      object $row    Database row
  * @param      string $period Time period
  * @return     string
  */
 public static function out($row, $period)
 {
     $database = App::get('db');
     $helper = new \Components\Resources\Helpers\Helper($row->id, $database);
     // Instantiate a helper object
     if (!isset($row->authors)) {
         $helper->getContributors();
         $row->authors = $helper->contributors;
     }
     // Get the component params and merge with resource params
     $config = Component::params('com_resources');
     $rparams = new \Hubzero\Config\Registry($row->params);
     // Set the display date
     switch ($rparams->get('show_date', $config->get('show_date'))) {
         case 0:
             $thedate = '';
             break;
         case 1:
             $thedate = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 2:
             $thedate = Date::of($row->modified)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 3:
             $thedate = Date::of($row->publish_up)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
     }
     // Start building HTML
     $html = "\t" . '<li class="resource">' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     if ($rparams->get('show_ranking', $config->get('show_ranking'))) {
         $helper->getCitationsCount();
         $helper->getLastCitationDate();
         if ($row->area == 'Tools') {
             $stats = new \Components\Resources\Helpers\Usage\Stats($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         } else {
             $stats = new \Components\Resources\Helpers\Usage\Andmore($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         }
         $statshtml = $stats->display();
         $row->ranking = round($row->ranking, 1);
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $r = 10 * $row->ranking;
         if (intval($r) < 10) {
             $r = '0' . $r;
         }
         $html .= "\t\t\t" . '<dl class="rankinfo">' . "\n";
         $html .= "\t\t\t\t" . '<dt class="ranking"><span class="rank-' . $r . '">' . Lang::txt('PLG_WHATSNEW_RESOURCES_THIS_HAS') . '</span> ' . number_format($row->ranking, 1) . ' ' . Lang::txt('PLG_WHATSNEW_RESOURCES_RANKING') . '</dt>' . "\n";
         $html .= "\t\t\t\t" . '<dd>' . "\n";
         $html .= "\t\t\t\t\t" . '<p>' . Lang::txt('PLG_WHATSNEW_RESOURCES_RANKING_EXPLANATION') . '</p>' . "\n";
         $html .= "\t\t\t\t\t" . '<div>' . "\n";
         $html .= $statshtml;
         $html .= "\t\t\t\t\t" . '</div>' . "\n";
         $html .= "\t\t\t\t" . '</dd>' . "\n";
         $html .= "\t\t\t" . '</dl>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     } elseif ($rparams->get('show_rating', $config->get('show_rating'))) {
         switch ($row->rating) {
             case 0.5:
                 $class = ' half-stars';
                 break;
             case 1:
                 $class = ' one-stars';
                 break;
             case 1.5:
                 $class = ' onehalf-stars';
                 break;
             case 2:
                 $class = ' two-stars';
                 break;
             case 2.5:
                 $class = ' twohalf-stars';
                 break;
             case 3:
                 $class = ' three-stars';
                 break;
             case 3.5:
                 $class = ' threehalf-stars';
                 break;
             case 4:
                 $class = ' four-stars';
                 break;
             case 4.5:
                 $class = ' fourhalf-stars';
                 break;
             case 5:
                 $class = ' five-stars';
                 break;
             case 0:
             default:
                 $class = ' no-stars';
                 break;
         }
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $html .= "\t\t\t" . '<p class="rating"><span class="avgrating' . $class . '"><span>' . Lang::txt('PLG_WHATSNEW_RESOURCES_OUT_OF_5_STARS', $row->rating) . '</span>&nbsp;</span></p>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     }
     $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area;
     if ($row->authors) {
         $html .= ' <span>|</span> ' . Lang::txt('PLG_WHATSNEW_RESOURCES_CONTRIBUTORS') . ' ' . $row->authors;
     }
     $html .= '</p>' . "\n";
     if ($row->itext) {
         $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->itext)), 200) . '</p>' . "\n";
     } else {
         if ($row->ftext) {
             $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->ftext)), 200) . '</p>' . "\n";
         }
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
示例#13
0
 /**
  * Short description for 'buildToolStatus'
  *
  * Long description (if any) ...
  *
  * @param      array $toolinfo Parameter description (if any) ...
  * @param      array $developers Parameter description (if any) ...
  * @param      array $authors Parameter description (if any) ...
  * @param      array $version Parameter description (if any) ...
  * @param      array &$status Parameter description (if any) ...
  * @param      unknown $option Parameter description (if any) ...
  * @return     array Return description (if any) ...
  */
 public function buildToolStatus($toolinfo, $developers = array(), $authors = array(), $version, &$status, $option)
 {
     // Create a Version object
     $objV = new Version($this->_db);
     // Get the component parameters
     $this->config = Component::params($option);
     $invokedir = $this->config->get('invokescript_dir', DS . 'apps');
     $dev_suffix = $this->config->get('dev_suffix', '_dev');
     $vnc = $this->config->get('default_vnc', '780x600');
     $mw = $this->config->get('default_mw', 'narwhal');
     $hostreq = $this->config->get('default_hostreq', 'sessions');
     // Load version params
     $params = new \Hubzero\Config\Registry($version[0]->params);
     // build status array
     $status = array('resourceid' => isset($toolinfo[0]->rid) ? $toolinfo[0]->rid : 0, 'resource_created' => isset($toolinfo[0]->rcreated) ? $toolinfo[0]->rcreated : '', 'resource_modified' => isset($toolinfo[0]) && isset($toolinfo[0]->rmodified) && $toolinfo[0]->rmodified != '0000-00-00 00:00:00' && isset($version[0]) && $version[0]->fulltxt != '' ? 1 : 0, 'fulltxt' => isset($version[0]->fulltxt) ? $version[0]->fulltxt : $toolinfo[0]->rfulltxt, 'toolname' => isset($toolinfo[0]->toolname) ? $toolinfo[0]->toolname : '', 'toolid' => isset($toolinfo[0]->id) ? $toolinfo[0]->id : 0, 'title' => isset($version[0]->title) ? $version[0]->title : '', 'version' => isset($version[0]->version) ? $version[0]->version : '1.0', 'revision' => isset($version[0]->revision) ? $version[0]->revision : 0, 'description' => isset($version[0]->description) ? $version[0]->description : '', 'exec' => isset($version[0]->toolaccess) ? $version[0]->toolaccess : '@OPEN', 'code' => isset($version[0]->codeaccess) ? $version[0]->codeaccess : '@OPEN', 'wiki' => isset($version[0]->wikiaccess) ? $version[0]->wikiaccess : '@OPEN', 'published' => isset($toolinfo[0]->published) ? $toolinfo[0]->published : 0, 'state' => isset($toolinfo[0]->state) ? $toolinfo[0]->state : 0, 'version_state' => isset($version[0]->state) ? $version[0]->state : 3, 'version_id' => isset($version[0]->id) ? $version[0]->id : 0, 'priority' => isset($toolinfo[0]->priority) ? $toolinfo[0]->priority : 3, 'doi' => isset($version[0]->doi) ? $version[0]->doi : 0, 'authors' => $authors, 'developers' => $developers, 'devgroup' => isset($toolinfo[0]->devgroup) ? $toolinfo[0]->devgroup : '', 'membergroups' => isset($version[0]->toolaccess) && $version[0]->toolaccess == '@GROUP' ? $this->getToolGroups($toolinfo[0]->id) : array(), 'ntools' => isset($toolinfo[0]->ntools) ? $toolinfo[0]->ntools : 0, 'ntoolsdev' => isset($toolinfo[0]->ntoolsdev) ? $toolinfo[0]->ntoolsdev : 0, 'ntools_published' => isset($toolinfo[0]->ntoolspublished) ? $toolinfo[0]->ntoolspublished : 0, 'newmessages' => isset($toolinfo[0]->comments) ? $toolinfo[0]->comments : 0, 'changed' => isset($toolinfo[0]->state_changed) && $toolinfo[0]->state_changed != '0000-00-00 00:00:00' ? $toolinfo[0]->state_changed : $toolinfo[0]->registered, 'registered_by' => isset($toolinfo[0]->registered_by) ? $toolinfo[0]->registered_by : '', 'registered' => isset($toolinfo[0]->registered) ? $toolinfo[0]->registered : '', 'ticketid' => isset($toolinfo[0]->ticketid) ? $toolinfo[0]->ticketid : '', 'mw' => isset($version[0]->mw) ? $version[0]->mw : $mw, 'vncCommand' => isset($version[0]->vnc_command) ? $version[0]->vnc_command : $invokedir . DS . $toolinfo[0]->toolname . DS . 'invoke', 'vncGeometry' => isset($version[0]->vnc_geometry) && $version[0]->vnc_geometry != '' ? $version[0]->vnc_geometry : $vnc, 'license' => isset($version[0]->license) ? $version[0]->license : '', 'hostreq' => isset($version[0]->hostreq) ? implode(', ', $version[0]->hostreq) : $hostreq, 'params' => isset($version[0]->params) ? $version[0]->params : '', 'github' => $params->get('github'), 'publishType' => $params->get('publishType') == 'weber=' ? 'jupyter' : 'standard');
     list($status['vncGeometryX'], $status['vncGeometryY']) = preg_split('#[x]#', $status['vncGeometry']);
     // get latest version information
     if ($status['published']) {
         $current = $objV->getVersionInfo('', 'current', $toolinfo[0]->toolname);
     }
     $status['currenttool'] = isset($current[0]->instance) ? $current[0]->instance : $status['toolname'] . $dev_suffix;
     $status['currentrevision'] = isset($current[0]->revision) ? $current[0]->revision : $status['revision'];
     $status['currentversion'] = isset($current[0]->version) ? $current[0]->version : $status['version'];
     return $status;
 }
示例#14
0
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Christopher Smoak <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
// get group params
$params = new \Hubzero\Config\Registry($this->group->get('params'));
//is membership control managed on group?
$membership_control = $params->get('membership_control', 1);
// build urls
$currentUrl = Request::current(true);
$groupUrl = 'index.php?option=com_groups&cn=' . $this->group->get('cn');
// build login and logout links
$loginReturn = base64_encode($currentUrl);
$logoutReturn = base64_encode(Route::url($groupUrl));
$loginLink = Route::url('index.php?option=com_users&view=login&return=' . $loginReturn);
$logoutLink = Route::url('index.php?option=com_users&view=logout&return=' . $logoutReturn);
// super group login link
if ($this->group->isSuperGroup()) {
    $loginLink = Route::url($groupUrl . '&active=login&return=' . base64_encode(Route::url($currentUrl)));
}
?>

<ul <?php 
示例#15
0
 /**
  * Method is called after user data is stored in the database
  *
  * @param   array    $user     holds the new user data
  * @param   boolean  $isnew    true if a new user is stored
  * @param   boolean  $success  true if user was succesfully stored in the database
  * @param   string   $msg      message
  * @return  void
  */
 public function onAfterStoreUser($user, $isnew, $succes, $msg)
 {
     $xprofile = \Hubzero\User\Profile::getInstance($user['id']);
     if (!is_object($xprofile)) {
         $params = Component::params('com_members');
         $hubHomeDir = rtrim($params->get('homedir'), '/');
         if (empty($hubHomeDir)) {
             // try to deduce a viable home directory based on sitename or live_site
             $sitename = strtolower(Config::get('sitename'));
             $sitename = preg_replace('/^http[s]{0,1}:\\/\\//', '', $sitename, 1);
             $sitename = trim($sitename, '/ ');
             $sitename_e = explode('.', $sitename, 2);
             if (isset($sitename_e[1])) {
                 $sitename = $sitename_e[0];
             }
             if (!preg_match("/^[a-zA-Z]+[\\-_0-9a-zA-Z\\.]+\$/i", $sitename)) {
                 $sitename = '';
             }
             if (empty($sitename)) {
                 $sitename = strtolower(Request::base());
                 $sitename = preg_replace('/^http[s]{0,1}:\\/\\//', '', $sitename, 1);
                 $sitename = trim($sitename, '/ ');
                 $sitename_e = explode('.', $sitename, 2);
                 if (isset($sitename_e[1])) {
                     $sitename = $sitename_e[0];
                 }
                 if (!preg_match("/^[a-zA-Z]+[\\-_0-9a-zA-Z\\.]+\$/i", $sitename)) {
                     $sitename = '';
                 }
             }
             $hubHomeDir = DS . 'home';
             if (!empty($sitename)) {
                 $hubHomeDir .= DS . $sitename;
             }
             if (!empty($hubHomeDir)) {
                 $db = App::get('db');
                 $component = new JTableExtension($this->database);
                 $component->load($component->find(array('element' => 'com_members', 'type' => 'component')));
                 $params = new \Hubzero\Config\Registry($component->params);
                 $params->set('homedir', $hubHomeDir);
                 $component->params = $params->toString();
                 $component->store();
             }
         }
         $xprofile = new \Hubzero\User\Profile();
         $xprofile->set('gidNumber', $params->get('gidNumber', '100'));
         $xprofile->set('gid', $params->get('gid', 'users'));
         $xprofile->set('uidNumber', $user['id']);
         $xprofile->set('homeDirectory', $hubHomeDir . DS . $user['username']);
         $xprofile->set('loginShell', '/bin/bash');
         $xprofile->set('ftpShell', '/usr/lib/sftp-server');
         $xprofile->set('name', $user['name']);
         $xprofile->set('email', $user['email']);
         $xprofile->set('emailConfirmed', '3');
         $xprofile->set('username', $user['username']);
         $xprofile->set('regIP', $_SERVER['REMOTE_ADDR']);
         $xprofile->set('emailConfirmed', -rand(1, pow(2, 31) - 1));
         $xprofile->set('public', $params->get('privacy', 0));
         if (isset($_SERVER['REMOTE_HOST'])) {
             $xprofile->set('regHost', $_SERVER['REMOTE_HOST']);
         }
         $xprofile->set('registerDate', Date::toSql());
         $result = $xprofile->create();
         if (!$result) {
             return new Exception('Unable to create \\Hubzero\\User\\Profile record', 500);
         }
     } else {
         $update = false;
         $params = Component::params('com_members');
         if ($xprofile->get('username') != $user['username']) {
             $xprofile->set('username', $user['username']);
             $update = true;
         }
         if ($xprofile->get('name') != $user['name']) {
             $xprofile->set('name', $user['name']);
             $update = true;
         }
         if ($xprofile->get('email') != $user['email']) {
             $xprofile->set('email', $user['email']);
             $xprofile->set('emailConfirmed', 0);
             $update = true;
         }
         if ($xprofile->get('emailConfirmed') == '') {
             $xprofile->set('emailConfirmed', '3');
             $update = true;
         }
         if ($xprofile->get('gid') == '') {
             $xprofile->set('gid', $params->get('gid', 'users'));
             $update = true;
         }
         if ($xprofile->get('gidNumber') == '') {
             $xprofile->set('gidNumber', $params->get('gidNumber', '100'));
             $update = true;
         }
         if ($xprofile->get('loginShell') == '') {
             $xprofile->set('loginShell', '/bin/bash');
             $update = true;
         }
         if ($xprofile->get('ftpShell') == '') {
             $xprofile->set('ftpShell', '/usr/lib/sftp-server');
             // This isn't right, but we're using an empty shell as an indicator that we should also update default privacy
             $xprofile->set('public', $params->get('privacy', 0));
             $update = true;
         }
         if ($update) {
             $xprofile->update();
         }
     }
     // Check if quota exists for the user
     $params = Component::params('com_members');
     if ($params->get('manage_quotas', false)) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'users_quotas.php';
         require_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'quotas_classes.php';
         $quota = new \Components\Members\Tables\UsersQuotas($this->database);
         $quota->load(array('user_id' => $user['id']));
         if (!$quota->id) {
             $class = new \Components\Members\Tables\QuotasClasses($this->database);
             $class->load(array('alias' => 'default'));
             if ($class->id) {
                 $quota->set('user_id', $user['id']);
                 $quota->set('class_id', $class->id);
                 $quota->set('soft_blocks', $class->soft_blocks);
                 $quota->set('hard_blocks', $class->hard_blocks);
                 $quota->set('soft_files', $class->soft_files);
                 $quota->set('hard_files', $class->hard_files);
                 $quota->store();
             }
         }
     }
 }
示例#16
0
                    $customUrl = str_replace($replace, $replaceWith, $citationUrlFormatString);
                }
            }
        }
    }
}
//do we want to use our custom url string with placeholders
$citationURL = $citationUrlFormat == 'custom' && $customUrl != '' ? $customUrl : $url;
//if we have an eprint use that
$citationURL = $eprintUrl && $eprintUrl != '' ? $eprintUrl : $citationURL;
//are we showing abstracts hub wide
$showAbstract = $config->get('citation_rollover', 'no');
$showAbstract = $showAbstract == "yes" ? 1 : 0;
//are we showing this citations abstract
$params = new \Hubzero\Config\Registry($citation->params);
$showThisAbstract = $params->get('rollover', $showAbstract);
//get tags and badges
$tags = \Components\Citations\Helpers\Format::citationTags($citation, $database, false);
$badges = \Components\Citations\Helpers\Format::citationBadges($citation, $database, false);
//are we allowed to show tags and badges
$showTags = $config->get('citation_show_tags', 'yes');
$showBadges = $config->get('citation_show_badges', 'yes');
//get internal associations
$associationLinks = array();
foreach ($this->associations as $a) {
    if ($a->tbl == 'resource') {
        $sql = "SELECT * FROM `#__resources` WHERE id=" . $a->oid;
        $database->setQuery($sql);
        $resource = $database->loadObject();
        if (is_object($resource)) {
            $associationLinks[] = '<a href="' . Route::url('index.php?option=com_resources&id=' . $a->oid) . '">' . $resource->title . '</a>';
示例#17
0
 /**
  * after store user method
  *
  * Method is called after user data is stored in the database
  *
  * @param	array		$user		Holds the new user data.
  * @param	boolean		$isnew		True if a new user is stored.
  * @param	boolean		$success	True if user was succesfully stored in the database.
  * @param	string		$msg		Message.
  *
  * @return	void
  * @since	1.6
  */
 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     if ($this->params->get('automatic_change', '1') == '1' && key_exists('params', $user) && $success) {
         $registry = new \Hubzero\Config\Registry($user['params']);
         $lang_code = $registry->get('language');
         if (empty($lang_code)) {
             $lang_code = self::$default_lang;
         }
         if ($lang_code == self::$_user_lang_code || !isset(self::$lang_codes[$lang_code])) {
             if (App::isSite()) {
                 User::setState('com_users.edit.profile.redirect', null);
             }
         } else {
             if (App::isSite()) {
                 User::setState('com_users.edit.profile.redirect', 'index.php?Itemid=' . App::get('menu')->getDefault($lang_code)->id . '&lang=' . self::$lang_codes[$lang_code]->sef);
                 self::$tag = $lang_code;
                 // Create a cookie
                 $cookie_domain = Config::get('cookie_domain', '');
                 $cookie_path = Config::get('cookie_path', '/');
                 setcookie(App::hash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain);
             }
         }
     }
 }
示例#18
0
 /**
  * Process Registration
  *
  * @return     string
  */
 private function doRegister()
 {
     //get request vars
     $register = Request::getVar('register', NULL, 'post');
     $arrival = Request::getVar('arrival', NULL, 'post');
     $departure = Request::getVar('departure', NULL, 'post');
     $dietary = Request::getVar('dietary', NULL, 'post');
     $dinner = Request::getVar('dinner', NULL, 'post');
     $disability = Request::getVar('disability', NULL, 'post');
     $race = Request::getVar('race', NULL, 'post');
     $event_id = Request::getInt('event_id', NULL, 'post');
     //load event data
     $event = new \Components\Events\Models\Event($event_id);
     // get event params
     $params = new \Hubzero\Config\Registry($event->get('params'));
     //array to hold any errors
     $errors = array();
     //check for first name
     if (!isset($register['first_name']) || $register['first_name'] == '') {
         $errors[] = Lang::txt('Missing first name.');
     }
     //check for last name
     if (!isset($register['last_name']) || $register['last_name'] == '') {
         $errors[] = Lang::txt('Missing last name.');
     }
     //check for affiliation
     if (isset($register['affiliation']) && $register['affiliation'] == '') {
         $errors[] = Lang::txt('Missing affiliation.');
     }
     //check for email if email is supposed to be on
     if ($params->get('show_email', 1) == 1) {
         if (!isset($register['email']) || $register['email'] == '' || !filter_var($register['email'], FILTER_VALIDATE_EMAIL)) {
             $errors[] = Lang::txt('Missing email address or email is not valid.');
         }
         // check to make sure this is the only time registering
         if (\Components\Events\Tables\Respondent::checkUniqueEmailForEvent($register['email'], $event_id) > 0) {
             $errors[] = Lang::txt('You have previously registered for this event.');
         }
     }
     //if we have any errors we must return
     if (count($errors) > 0) {
         $this->register = $register;
         $this->arrival = $arrival;
         $this->departure = $departure;
         $this->dietary = $dietary;
         $this->dinner = $dinner;
         $this->disability = $disability;
         $this->race = $race;
         $this->setError(implode('<br />', $errors));
         return $this->register();
     }
     //set data for saving
     $eventsRespondent = new \Components\Events\Tables\Respondent(array());
     $eventsRespondent->event_id = $event_id;
     $eventsRespondent->registered = Date::toSql();
     $eventsRespondent->arrival = $arrival['day'] . ' ' . $arrival['time'];
     $eventsRespondent->departure = $departure['day'] . ' ' . $departure['time'];
     $eventsRespondent->position_description = '';
     if (isset($register['position_other']) && $register['position_other'] != '') {
         $eventsRespondent->position_description = $register['position_other'];
     } else {
         if (isset($register['position'])) {
             $eventsRespondent->position_description = $register['position'];
         }
     }
     $eventsRespondent->highest_degree = isset($register['degree']) ? $register['degree'] : '';
     $eventsRespondent->gender = isset($register['sex']) ? $register['sex'] : '';
     $eventsRespondent->disability_needs = isset($disability) && strtolower($disability) == 'yes' ? 1 : null;
     $eventsRespondent->dietary_needs = isset($dietary['needs']) && strtolower($dietary['needs']) == 'yes' ? $dietary['specific'] : null;
     $eventsRespondent->attending_dinner = isset($dinner) && $dinner == 'yes' ? 1 : 0;
     $eventsRespondent->bind($register);
     //did we save properly
     if (!$eventsRespondent->save($eventsRespondent)) {
         $this->setError($eventsRespondent->getError());
         return $this->register();
     }
     $r = $race;
     unset($r['nativetribe']);
     $r = empty($r) ? array() : $r;
     $sql = "INSERT INTO `#__events_respondent_race_rel` (respondent_id, race, tribal_affiliation)\n\t\t        VALUES (" . $this->database->quote($eventsRespondent->id) . ", " . $this->database->quote(implode(',', $r)) . ", " . $this->database->quote($race['nativetribe']) . ")";
     $this->database->setQuery($sql);
     $this->database->query();
     //load event we are registering for
     $eventsEvent = new \Components\Events\Tables\Event($this->database);
     $eventsEvent->load($event_id);
     // send a copy to event admin
     if ($eventsEvent->email != '') {
         //build message to send to event admin
         $email = new \Hubzero\Plugin\View(array('folder' => 'groups', 'element' => 'calendar', 'name' => 'calendar', 'layout' => 'register_email_admin'));
         $email->option = $this->option;
         $email->group = $this->group;
         $email->params = $params;
         $email->event = $eventsEvent;
         $email->sitename = Config::get('sitename');
         $email->register = $register;
         $email->race = $race;
         $email->dietary = $dietary;
         $email->disability = $disability;
         $email->arrival = $arrival;
         $email->departure = $departure;
         $email->dinner = $dinner;
         $message = str_replace("\n", "\r\n", $email->loadTemplate());
         //declare subject
         $subject = Lang::txt("[" . $email->sitename . "] Group \"{$this->group->get('description')}\" Event Registration: " . $eventsEvent->title);
         //make from array
         $from = array('email' => 'group-event-registration@' . $_SERVER['HTTP_HOST'], 'name' => $register['first_name'] . ' ' . $register['last_name']);
         // email from person
         if ($params->get('show_email', 1) == 1) {
             $from['email'] = $register['email'];
         }
         //send email
         $this->_sendEmail($eventsEvent->email, $from, $subject, $message);
     }
     // build message to send to event registerer
     // only send if show email is on
     if ($params->get('show_email', 1) == 1) {
         $email = $this->view('register_email_user', 'calendar');
         $email->option = $this->option;
         $email->group = $this->group;
         $email->params = $params;
         $email->event = $eventsEvent;
         $email->sitename = Config::get('sitename');
         $email->siteurl = Config::get('live_site');
         $email->register = $register;
         $email->race = $race;
         $email->dietary = $dietary;
         $email->disability = $disability;
         $email->arrival = $arrival;
         $email->departure = $departure;
         $email->dinner = $dinner;
         $message = str_replace("\n", "\r\n", $email->loadTemplate());
         // build to, from, & subject
         $to = User::get('email');
         $from = array('email' => 'groups@' . $_SERVER['HTTP_HOST'], 'name' => $email->sitename . ' Group Calendar: ' . $this->group->get('description'));
         $subject = Lang::txt('Thank you for Registering for the "%s" event', $eventsEvent->title);
         // send mail to user registering
         $this->_sendEmail($to, $from, $subject, $message);
     }
     // redirect back to the event
     App::redirect(Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn') . '&active=calendar&action=details&event_id=' . $event_id), Lang::txt('You have successfully registered for the event.'), 'passed');
 }
示例#19
0
			<span>
				<?php 
    echo $this->escape(stripslashes($this->course->offering()->section()->get('title')));
    ?>
			</span>
		</p>
	</header><!-- / #content-header -->

	<div class="innerwrap">
		<div id="page_container">
<?php 
}
?>

<?php 
if (!$this->course->offering()->access('view') && !$sparams->get('preview', 0)) {
    $view = new \Hubzero\Plugin\View(array('folder' => 'courses', 'element' => 'outline', 'name' => 'shared', 'layout' => '_not_enrolled'));
    $view->set('course', $this->course)->set('option', 'com_courses')->set('message', Lang::txt('COM_COURSES_ENROLLMENT_REQUIRED'));
    echo $view;
} else {
    if ($this->course->offering()->section()->expired() && !$sparams->get('preview', 0)) {
        ?>
			<div id="offering-introduction">
				<div class="instructions">
					<p class="warning"><?php 
        echo Lang::txt('COM_COURSES_SECTION_EXPIRED');
        ?>
</p>
				</div><!-- / .instructions -->
				<div class="questions">
					<p><strong><?php 
示例#20
0
 /**
  * Method to get a list of articles.
  *
  * Overriden to inject convert the attribs field into a JParameter object.
  *
  * @return	mixed	An array of objects on success, false on failure.
  * @since	1.6
  */
 public function getItems()
 {
     $items = parent::getItems();
     $userId = User::get('id');
     $guest = User::get('guest');
     $groups = User::getAuthorisedViewLevels();
     // Get the global params
     $globalParams = Component::params('com_content', true);
     // Convert the parameter fields into objects.
     foreach ($items as &$item) {
         $articleParams = new \Hubzero\Config\Registry($item->attribs);
         // Unpack readmore and layout params
         $item->alternative_readmore = $articleParams->get('alternative_readmore');
         $item->layout = $articleParams->get('layout');
         $item->params = clone $this->getState('params');
         // For blogs, article params override menu item params only if menu param = 'use_article'
         // Otherwise, menu item params control the layout
         // If menu item is 'use_article' and there is no article param, use global
         if (Request::getString('layout') == 'blog' || Request::getString('view') == 'featured' || $this->getState('params')->get('layout_type') == 'blog') {
             // create an array of just the params set to 'use_article'
             $menuParamsArray = $this->getState('params')->toArray();
             $articleArray = array();
             foreach ($menuParamsArray as $key => $value) {
                 if ($value === 'use_article') {
                     // if the article has a value, use it
                     if ($articleParams->get($key) != '') {
                         // get the value from the article
                         $articleArray[$key] = $articleParams->get($key);
                     } else {
                         // otherwise, use the global value
                         $articleArray[$key] = $globalParams->get($key);
                     }
                 }
             }
             // merge the selected article params
             if (count($articleArray) > 0) {
                 $articleParams = new \Hubzero\Config\Registry($articleArray);
                 $item->params->merge($articleParams);
             }
         } else {
             // For non-blog layouts, merge all of the article params
             $item->params->merge($articleParams);
         }
         // get display date
         switch ($item->params->get('list_show_date')) {
             case 'modified':
                 $item->displayDate = $item->modified;
                 break;
             case 'published':
                 $item->displayDate = $item->publish_up == 0 ? $item->created : $item->publish_up;
                 break;
             default:
             case 'created':
                 $item->displayDate = $item->created;
                 break;
         }
         // Compute the asset access permissions.
         // Technically guest could edit an article, but lets not check that to improve performance a little.
         if (!$guest) {
             $asset = 'com_content.article.' . $item->id;
             // Check general edit permission first.
             if (User::authorise('core.edit', $asset)) {
                 $item->params->set('access-edit', true);
             } elseif (!empty($userId) && User::authorise('core.edit.own', $asset)) {
                 // Check for a valid user and that they are the owner.
                 if ($userId == $item->created_by) {
                     $item->params->set('access-edit', true);
                 }
             }
         }
         $access = $this->getState('filter.access');
         if ($access) {
             // If the access filter has been set, we already have only the articles this user can view.
             $item->params->set('access-view', true);
         } else {
             // If no access filter is set, the layout takes some responsibility for display of limited information.
             if ($item->catid == 0 || $item->category_access === null) {
                 $item->params->set('access-view', in_array($item->access, $groups));
             } else {
                 $item->params->set('access-view', in_array($item->access, $groups) && in_array($item->category_access, $groups));
             }
         }
     }
     return $items;
 }
示例#21
0
 /**
  * Get params of owners connected to external service
  *
  * @param      integer 	$projectid
  * @param      string 	$service
  * @param      array 	$exclude
  *
  * @return     object
  */
 public function getConnected($projectid = NULL, $service = 'google', $exclude = array())
 {
     if ($projectid === NULL) {
         return false;
     }
     $query = "SELECT o.* FROM {$this->_tbl} AS o ";
     $query .= " JOIN #__projects as p ON o.projectid=p.id";
     $query .= " WHERE o.userid > 0";
     $query .= " AND p.id=" . $this->_db->quote($projectid);
     $query .= " AND o.params LIKE '%google_token=%' AND o.params NOT LIKE '%google_token=\n%'";
     if (!empty($exclude)) {
         $query .= " AND o.userid NOT IN (";
         $k = 1;
         foreach ($exclude as $ex) {
             $query .= $ex;
             $query .= $k < count($exclude) ? ',' : '';
             $k++;
         }
         $query .= ")";
     }
     $this->_db->setQuery($query);
     $results = $this->_db->loadObjectList();
     $connected = array();
     foreach ($results as $result) {
         $params = new \Hubzero\Config\Registry($result->params);
         $name = utf8_decode($params->get($service . '_name', ''));
         $email = $params->get($service . '_email', '');
         if ($name && $email) {
             $connected[$name] = $email;
         }
     }
     return $connected;
 }
示例#22
0
array_unshift($group_plugins, array('name' => 'overview', 'title' => 'Overview', 'default_access' => 'anyone', 'display_menu_tab' => true));
$access = \Hubzero\User\Group\Helper::getPluginAccess($this->group);
foreach ($group_plugins as $plugin) {
    if ($plugin['display_menu_tab'] == 1) {
        $title = $plugin['title'];
        $perm = $access[$plugin['name']];
        $message .= "\t\t" . $title . ' => ' . $levels[$perm] . "\n";
    }
}
$message .= "\n";
$params = Component::params('com_groups');
if ($params->get('email_comment_processing')) {
    $message .= "\t" . Lang::txt('Discussion Group Emails Autosubscribe:') . ' ' . ($this->group->get('discussion_email_autosubscribe') ? Lang::txt('On') : Lang::txt('Off')) . "\n\n";
}
$message .= "\t" . Lang::txt('Page Comments:') . ' ';
if ($gparams->get('page_comments') == 2) {
    $message .= Lang::txt('COM_GROUPS_PAGES_PAGE_COMMENTS_LOCK');
} elseif ($gparams->get('page_comments') == 1) {
    $message .= Lang::txt('COM_GROUPS_PAGES_PAGE_COMMENTS_YES');
} else {
    $message .= Lang::txt('COM_GROUPS_PAGES_PAGE_COMMENTS_NO');
}
$message .= "\n";
$message .= "\t" . Lang::txt('Page Author Details:') . ' ';
if ($gparams->get('page_author') == 1) {
    $message .= Lang::txt('COM_GROUPS_PAGES_SETTING_AUTHOR_YES');
} else {
    $message .= Lang::txt('COM_GROUPS_PAGES_SETTING_AUTHOR_NO');
}
$message .= "\n";
$message .= "\n\n";
示例#23
0
 /**
  * Redefine the function an add some properties to make the styling more easy
  *
  * @param	bool	$recursive	True if you want to return children recursively.
  *
  * @return	mixed	An array of data items on success, false on failure.
  * @since	1.6
  */
 public function getItems($recursive = false)
 {
     if (!count($this->_items)) {
         $app = JFactory::getApplication();
         $menu = \App::get('menu');
         $active = $menu->getActive();
         $params = new \Hubzero\Config\Registry();
         if ($active) {
             $params->parse($active->params);
         }
         $options = array();
         $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0);
         $categories = JCategories::getInstance('Content', $options);
         $this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
         if (is_object($this->_parent)) {
             $this->_items = $this->_parent->getChildren($recursive);
         } else {
             $this->_items = false;
         }
     }
     return $this->_items;
 }
示例#24
0
										</td>
									<?php 
        }
        ?>
									<td class="citation-container">
										<?php 
        $formatted = $cite->formatted ? $cite->formatted : $formatter->formatCitation($cite, $this->filters['search'], $coins, $this->config);
        if ($cite->doi) {
            $formatted = str_replace('doi:' . $cite->doi, '<a href="' . $cite->url . '" rel="external">' . 'doi:' . $cite->doi . '</a>', $formatted);
        }
        echo $formatted;
        ?>
										<?php 
        //get this citations rollover param
        $params = new \Hubzero\Config\Registry($cite->params);
        $citation_rollover = $params->get('rollover', $rollover);
        ?>
										<?php 
        if ($citation_rollover && $cite->abstract != "") {
            ?>
											<div class="citation-notes">
												<?php 
            $cs = new \Components\Citations\Tables\Sponsor($this->database);
            $sponsors = $cs->getCitationSponsor($cite->id);
            $final = "";
            if ($sponsors) {
                foreach ($sponsors as $s) {
                    $sp = $cs->getSponsor($s);
                    if ($sp) {
                        $final .= '<a rel="external" href="' . $sp[0]['link'] . '">' . $sp[0]['sponsor'] . '</a>, ';
                    }
示例#25
0
 /**
  * Send a message to one or more users
  *
  * @param      string  $type        Message type (maps to #__xmessage_component table)
  * @param      string  $subject     Message subject
  * @param      string  $message     Message to send
  * @param      array   $from        Message 'from' data (e.g., name, address)
  * @param      array   $to          List of user IDs
  * @param      string  $component   Component name
  * @param      integer $element     ID of object that needs an action item
  * @param      string  $description Action item description
  * @param      integer $group_id    Parameter description (if any) ...
  * @return     mixed   True if no errors else error message
  */
 public function onSendMessage($type, $subject, $message, $from = array(), $to = array(), $component = '', $element = null, $description = '', $group_id = 0, $bypassGroupsCheck = false)
 {
     // Do we have a message?
     if (!$message) {
         return false;
     }
     $database = App::get('db');
     // Create the message object
     $xmessage = Hubzero\Message\Message::blank();
     if ($type == 'member_message') {
         $time_limit = intval($this->params->get('time_limit', 30));
         $daily_limit = intval($this->params->get('daily_limit', 100));
         // First, let's see if they've surpassed their daily limit for sending messages
         $filters = array('created_by' => User::get('id'), 'daily_limit' => $daily_limit);
         $number_sent = $xmessage->getSentMessagesCount($filters);
         if ($number_sent >= $daily_limit) {
             return false;
         }
         // Next, we see if they've passed the time limit for sending consecutive messages
         $filters['limit'] = 1;
         $filters['start'] = 0;
         $sent = $xmessage->getSentMessages($filters);
         if ($sent->count() > 0) {
             $last_sent = $sent->first();
             $last_time = 0;
             if ($last_sent->created) {
                 $last_time = Date::of($last_sent->created)->toUnix();
             }
             $time_difference = Date::toUnix() + $time_limit - $last_time;
             if ($time_difference < $time_limit) {
                 return false;
             }
         }
     }
     // Store the message in the database
     $xmessage->set('message', is_array($message) && isset($message['plaintext']) ? $message['plaintext'] : $message);
     // Do we have a subject line? If not, create it from the message
     if (!$subject && $xmessage->get('message')) {
         $subject = substr($xmessage->get('message'), 0, 70);
         if (strlen($subject) >= 70) {
             $subject .= '...';
         }
     }
     $xmessage->set('subject', $subject);
     $xmessage->set('created', Date::toSql());
     $xmessage->set('created_by', User::get('id'));
     $xmessage->set('component', $component);
     $xmessage->set('type', $type);
     $xmessage->set('group_id', $group_id);
     if (!$xmessage->save()) {
         return $xmessage->getError();
     }
     if (is_array($message)) {
         $xmessage->set('message', $message);
     }
     // Do we have any recipients?
     if (count($to) > 0) {
         $mconfig = Component::params('com_members');
         // Get all the sender's groups
         if ($mconfig->get('user_messaging', 1) == 1 && !$bypassGroupsCheck) {
             $xgroups = User::groups('all');
             $usersgroups = array();
             if (!empty($xgroups)) {
                 foreach ($xgroups as $group) {
                     if ($group->regconfirmed) {
                         $usersgroups[] = $group->cn;
                     }
                 }
             }
         }
         // Loop through each recipient
         foreach ($to as $uid) {
             // Create a recipient object that ties a user to a message
             $recipient = Hubzero\Message\Recipient::blank();
             $recipient->set('uid', $uid);
             $recipient->set('mid', $xmessage->get('id'));
             $recipient->set('created', Date::toSql());
             $recipient->set('expires', Date::of(time() + 168 * 24 * 60 * 60)->toSql());
             $recipient->set('actionid', 0);
             //(is_object($action)) ? $action->id : 0; [zooley] Phasing out action items
             // Get the user's methods for being notified
             $notify = Hubzero\Message\Notify::blank();
             $methods = $notify->getRecords($uid, $type);
             $user = User::getInstance($uid);
             if (!is_object($user) || !$user->get('username')) {
                 continue;
             }
             if ($mconfig->get('user_messaging', 1) == 1 && ($type == 'member_message' || $type == 'group_message')) {
                 $pgroups = \Hubzero\User\Helper::getGroups($user->get('id'), 'all', 1);
                 $profilesgroups = array();
                 if (!empty($pgroups)) {
                     foreach ($pgroups as $group) {
                         if ($group->regconfirmed) {
                             $profilesgroups[] = $group->cn;
                         }
                     }
                 }
                 // Find the common groups
                 if (!$bypassGroupsCheck) {
                     $common = array_intersect($usersgroups, $profilesgroups);
                     if (count($common) <= 0) {
                         continue;
                     }
                 }
             }
             // Do we have any methods?
             if ($methods->count()) {
                 // Loop through each method
                 foreach ($methods as $method) {
                     $action = strtolower($method->method);
                     if ($action == 'internal') {
                         if (!$recipient->save()) {
                             $this->setError($recipient->getError());
                         }
                     } else {
                         if (!Event::trigger('onMessage', array($from, $xmessage, $user, $action))) {
                             $this->setError(Lang::txt('PLG_XMESSAGE_HANDLER_ERROR_UNABLE_TO_MESSAGE', $uid, $action));
                         }
                     }
                 }
             } else {
                 // First check if they have ANY methods saved (meaning they've changed their default settings)
                 // If They do have some methods, then they simply turned off everything for this $type
                 $methods = $notify->getRecords($uid);
                 if (!$methods || $methods->count() <= 0) {
                     // Load the default method
                     $p = Plugin::byType('members', 'messages');
                     $pp = new \Hubzero\Config\Registry(is_object($p) ? $p->params : '');
                     $d = $pp->get('default_method', 'email');
                     if (!$recipient->save()) {
                         $this->setError($recipient->getError());
                     }
                     // Use the Default in the case the user has no methods
                     if (!Event::trigger('onMessage', array($from, $xmessage, $user, $d))) {
                         $this->setError(Lang::txt('PLG_XMESSAGE_HANDLER_ERROR_UNABLE_TO_MESSAGE', $uid, $d));
                     }
                 }
             }
         }
     }
     return true;
 }
示例#26
0
	<form action="<?php 
echo Route::url('index.php?option=' . $this->option . '&' . ($this->task == 'create' ? 'return=' . $form_redirect : 'task=' . $this->task));
?>
" method="post" id="hubForm">

		<?php 
if ($this->task == 'create' && empty($this->xregistration->_invalid) && empty($this->xregistration->_missing)) {
    // Check to see if third party auth plugins are enabled
    Plugin::import('authentication');
    $plugins = Plugin::byType('authentication');
    $authenticators = array();
    foreach ($plugins as $p) {
        if ($p->name != 'hubzero') {
            $pparams = new \Hubzero\Config\Registry($p->params);
            $display = $pparams->get('display_name', ucfirst($p->name));
            $authenticators[] = array('name' => $p->name, 'display' => $display);
        }
    }
    // There are third party plugins, so show them on the registration form
    if (!empty($authenticators)) {
        $this->css('providers.css', 'com_users');
        ?>
				<div class="explaination">
					<p class="info">You can choose to log in via one of these services, and we'll help you fill in the info below!</p>
					<p>Already have an account? <a href="<?php 
        echo Route::url('index.php?option=com_users&view=login');
        ?>
">Log in here.</a></p>
				</div>
				<fieldset>
示例#27
0
 /**
  * Get stored auth token for service
  *
  * @param	   string	$param	Param name
  * @param	   integer	$uid	User ID
  *
  * @return	   string
  */
 public function getStoredParam($param, $uid = 0)
 {
     $uid = $uid ? $uid : $this->_uid;
     $objO = $this->model->table('Owner');
     $objO->loadOwner($this->model->get('id'), $uid);
     $params = new \Hubzero\Config\Registry($objO->params);
     return $params->get($param);
 }
示例#28
0
$params = new \Hubzero\Config\Registry($this->row->get('params'));
?>

					<fieldset class="adminform sectionparams">
						<legend><?php 
echo Lang::txt('COM_COURSES_FIELDSET_PARAMS');
?>
</legend>
						<div class="input-wrap">
							<label for="params-progress-calculation"><?php 
echo Lang::txt('COM_COURSES_PROGRESS_CALCULATION');
?>
:</label><br />
							<select name="params[progress_calculation]" id="params-progress-calculation">
								<option value=""<?php 
echo $params->get('progress_calculation', '') == '' ? 'selected="selected"' : '';
?>
><?php 
echo Lang::txt('COM_COURSES_PROGRESS_CALCULATION_INHERIT_FROM_OFFERING');
?>
</option>
								<option value="all"<?php 
echo $params->get('progress_calculation', '') == 'all' ? 'selected="selected"' : '';
?>
><?php 
echo Lang::txt('COM_COURSES_PROGRESS_CALCULATION_ALL');
?>
</option>
								<option value="graded"<?php 
echo $params->get('progress_calculation', '') == 'graded' ? 'selected="selected"' : '';
?>
示例#29
0
 /**
  * Lists projects
  *
  * @return  void
  */
 public function displayTask()
 {
     $this->view->config = $this->config;
     // Get quotas
     $this->view->defaultQuota = Helpers\Html::convertSize(floatval($this->config->get('defaultQuota', 1)), 'GB', 'b');
     $this->view->premiumQuota = Helpers\Html::convertSize(floatval($this->config->get('premiumQuota', 30)), 'GB', 'b');
     // Get filters
     $this->view->filters = array('limit' => Request::getState($this->_option . '.projects.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.projects.limitstart', 'limitstart', 0, 'int'), 'search' => urldecode(Request::getState($this->_option . '.projects.search', 'search', '')), 'sortby' => Request::getState($this->_option . '.projects.sort', 'filter_order', 'id'), 'sortdir' => Request::getState($this->_option . '.projects.sortdir', 'filter_order_Dir', 'DESC'), 'authorized' => true, 'getowner' => 1, 'activity' => 1, 'quota' => Request::getVar('quota', 'all', 'post'));
     $this->view->limit = $this->view->filters['limit'];
     $this->view->start = $this->view->filters['start'];
     // Retrieve all records when filtering by quota (no paging)
     if ($this->view->filters['quota'] != 'all') {
         $this->view->filters['limit'] = 'all';
         $this->view->filters['start'] = 0;
     }
     $obj = new Tables\Project($this->database);
     // Get records
     $this->view->rows = $obj->getRecords($this->view->filters, true, 0, 1);
     // Get a record count
     $this->view->total = $obj->getCount($this->view->filters, true, 0, 1);
     // Filtering by quota
     if ($this->view->filters['quota'] != 'all' && $this->view->rows) {
         $counter = $this->view->total;
         $rows = $this->view->rows;
         for ($i = 0, $n = count($rows); $i < $n; $i++) {
             $params = new \Hubzero\Config\Registry($rows[$i]->params);
             $quota = $params->get('quota', 0);
             if ($this->view->filters['quota'] == 'premium' && $quota < $this->view->premiumQuota || $this->view->filters['quota'] == 'regular' && $quota > $this->view->defaultQuota) {
                 $counter--;
                 unset($rows[$i]);
             }
         }
         $rows = array_values($rows);
         $this->view->total = $counter > 0 ? $counter : 0;
         // Fix up paging after filter
         if (count($rows) > $this->view->limit) {
             $k = 0;
             for ($i = 0, $n = count($rows); $i < $n; $i++) {
                 if ($k < $this->view->start || $k >= $this->view->limit + $this->view->start) {
                     unset($rows[$i]);
                 }
                 $k++;
             }
         }
         $this->view->rows = array_values($rows);
     }
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Check that master path is there
     if ($this->config->get('offroot') && !is_dir($this->config->get('webpath'))) {
         $this->view->setError(Lang::txt('Master directory does not exist. Administrator must fix this! ') . $this->config->get('webpath'));
     }
     // Output the HTML
     $this->view->display();
 }
示例#30
0
                        }
                    }
                    // Add PATH_CORE
                    $filename = PATH_APP . $filename;
                    $width = 0;
                    $height = 0;
                    if (file_exists($filename)) {
                        list($width, $height) = getimagesize($filename);
                    }
                    if ($width > 0 && $height > 0) {
                        $class .= ' ' . $width . 'x' . $height;
                    }
                }
            } else {
                $attribs = new \Hubzero\Config\Registry($child->attribs);
                $width = intval($attribs->get('width', 640));
                $height = intval($attribs->get('height', 360));
                if ($width > 0 && $height > 0) {
                    $class .= ' ' . $width . 'x' . $height;
                }
            }
            // user guide
            if (strtolower($title) != preg_replace('/user guide/', '', strtolower($title))) {
                $liclass = ' class="guide"';
            }
            ?>
					<li<?php 
            echo $liclass;
            ?>
>
						<?php