/** * Once a user changed their profile, request them to update their profile * */ public function updateProfile() { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE')); $profileType = JRequest::getVar('profileType', ''); $my = CFactory::getUser(); $this->addPathway(JText::_('COM_COMMUNITY_PROFILE'), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_CHANGE_TYPE'), CRoute::_('index.php?option=com_community&view=multiprofile&task=changeprofile')); $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE')); $model = CFactory::getModel('profile'); $profileType = JRequest::getVar('profileType', 0); // Get all published custom field for profile $filter = array('published' => '1', 'registration' => '1'); // $fields = $model->getAllFields( $filter , $profileType ); $result = $model->getEditableProfile($my->id, $profileType); $empty_html = array(); $post = JRequest::get('post'); // Bind result from previous post into the field object if (!empty($post)) { foreach ($fields as $group) { $field = $group->fields; for ($i = 0; $i < count($field); $i++) { $fieldid = $field[$i]->id; $fieldType = $field[$i]->type; if (!empty($post['field' . $fieldid])) { if (is_array($post['field' . $fieldid])) { if ($fieldType != 'date') { $values = $post['field' . $fieldid]; $value = ''; foreach ($values as $listValue) { $value .= $listValue . ','; } $field[$i]->value = $value; } else { $field[$i]->value = $post['field' . $fieldid]; } } else { $field[$i]->value = $post['field' . $fieldid]; } } } } } $js = 'assets/validate-1.5.min.js'; CFactory::attach($js, 'js'); $profileType = JRequest::getVar('profileType', 0, 'GET'); //CFactory::load( 'libraries' , 'profile' ); $tmpl = new CTemplate(); echo $tmpl->set('fields', $result['fields'])->set('profileType', $profileType)->fetch('multiprofile.update'); }
public function isAlbumBrowsable($albumId) { $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); $group = JTable::getInstance('Group', 'CTable'); $group->load($album->groupid); $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); //@rule: Do not allow non members to view albums for private group if ($group->approvals == COMMUNITY_PRIVATE_GROUP && !$group->isMember($this->my->id) && !$group->isAdmin($this->my->id) && !COwnerHelper::isCommunityAdmin()) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_ALBUM_MEMBER_PERMISSION'); return false; } return true; }
public function advanceSearch() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); //load calendar behavior JHtml::_('behavior.calendar'); JHtml::_('behavior.tooltip'); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); //$this->showSubMenu(); $this->addPathway(JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); $profileType = $jinput->get('profiletype', 0, 'INT'); $my = CFactory::getUser(); $config = CFactory::getConfig(); $result = null; $fields = CAdvanceSearch::getFields($profileType); $data = new stdClass(); $post = JRequest::get('GET'); $keyList = isset($post['key-list']) ? $post['key-list'] : ''; $avatarOnly = $jinput->get('avatar', '', 'NONE'); if (JString::strlen($keyList) > 0) { //formatting the assoc array $filter = array(); $key = explode(',', $keyList); $joinOperator = isset($post['operator']) ? $post['operator'] : ''; foreach ($key as $idx) { $obj = new stdClass(); $obj->field = $post['field' . $idx]; $obj->condition = $post['condition' . $idx]; $obj->fieldType = $post['fieldType' . $idx]; if ($obj->fieldType == 'email') { $obj->condition = 'equal'; } // we need to check whether the value contain start and end kind of values. // if yes, make them an array. if (isset($post['value' . $idx . '_2'])) { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $endDate = empty($post['value' . $idx . '_2']) ? '01/01/1970' : $post['value' . $idx . '_2']; // Joomla 1.5 uses "/" // Joomla 1.6 uses "-" $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); $edate = explode($delimeter, $endDate); if (isset($sdate[2]) && isset($edate[2])) { $obj->value = array($sdate[0] . '-' . $sdate[1] . '-' . $sdate[2] . ' 00:00:00', $edate[0] . '-' . $edate[1] . '-' . $edate[2] . ' 23:59:59'); } else { $obj->value = array(0, 0); } } else { $obj->value = array($post['value' . $idx], $post['value' . $idx . '_2']); } } else { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); if (isset($sdate[2])) { $obj->value = $sdate[2] . '-' . $sdate[1] . '-' . $sdate[0] . ' 00:00:00'; } else { $obj->value = 0; } } else { if ($obj->fieldType == 'checkbox') { if (empty($post['value' . $idx])) { //this mean user didnot check any of the option. $obj->value = ''; } else { $obj->value = isset($post['value' . $idx]) ? implode(',', $post['value' . $idx]) : ''; } } else { $obj->value = isset($post['value' . $idx]) ? $post['value' . $idx] : ''; } } } $filter[] = $obj; } $data->search = CAdvanceSearch::getResult($filter, $joinOperator, $avatarOnly, '', $profileType); $data->filter = $post; } $rows = !empty($data->search) ? $data->search->result : array(); $pagination = !empty($data->search) ? $data->search->pagination : ''; $filter = !empty($data->filter) ? $data->filter : array(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; //filter the user profile type if ($profileType && $row->_profile_id != $profileType) { continue; } $obj = new stdClass(); $obj->user = $row; $obj->friendsCount = $row->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $row->id ? true : false; $resultRows[] = $obj; } if (class_exists('Services_JSON')) { $json = new Services_JSON(); } else { require_once AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php'; $json = new Services_JSON(); } $tmpl = new CTemplate(); $multiprofileArr = array(); $hasMultiprofile = false; //let see if we have any multiprofile enabled if ($config->get('profile_multiprofile')) { $hasMultiprofile = true; //lets get the available profile $profileModel = CFactory::getModel('Profile'); $profiles = $profileModel->getProfileTypes(); if ($profiles) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch'), 'name' => JText::_('COM_COMMUNITY_ALL_PROFILE'), 'selected' => !$profileType ? 1 : 0); foreach ($profiles as $profile) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profileType ? 1 : 0); } } } $searchForm = $tmpl->set('fields', $fields)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('keyList', $keyList)->set('profileType', $profileType)->set('avatarOnly', $avatarOnly)->set('filterJson', $json->encode($filter))->set('postresult', isset($post['key-list']))->set('submenu', $this->showSubmenu(false))->fetch('search.advancesearch'); if (isset($post['key-list'])) { //result template $tmplResult = new CTemplate(); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $tmpl->set('featuredList', $featuredList); $searchForm .= $tmplResult->set('my', $my)->set('showFeaturedList', false)->set('multiprofileArr', $multiprofileArr)->set('featuredList', $featuredList)->set('data', $resultRows)->set('isAdvanceSearch', true)->set('hasMultiprofile', $hasMultiprofile)->set('sortings', '')->set('pagination', $pagination)->set('filter', $filter)->set('featuredList', $featuredList)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); } echo $searchForm; }
public function display($tpl = null) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $id = $jinput->get('listid', '', 'INT'); //JRequest::getVar( 'listid' , '' ); $list = JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('COM_COMMUNITY_INVALID_ID'); return; } /** * Opengraph */ CHeadHelper::setType('website', $list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($tmpCriterias as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': case 'birthdate': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); if (isset($date[1])) { $delimeter = '-'; if (strpos($date[0], '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $date[0]); $endDate = explode($delimeter, $date[1]); if (isset($startDate[2]) && isset($endDate[2])) { //date format $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { //age format $obj->value = array($date[0], $date[1]); } } else { //wrong data, set to default $obj->value = array(0, 0); } } else { $delimeter = '-'; if (strpos($criteria->value, '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $criteria->value); if (isset($startDate[2])) { //date format $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } else { //age format $obj->value = $criteria->value; } } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } //CFactory::load( 'helpers' , 'time'); $created = CTimeHelper::getDate($list->created); //CFactory::load( 'libraries' , 'advancesearch' ); //CFactory::load( 'libraries' , 'filterbar' ); $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $sorting = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result'); unset($tmpl); //CFactory::load( 'libraries' , 'tooltip' ); //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'featured' ); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); $alreadyfriend = array(); //CFactory::load( 'helpers' , 'friends' ); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; //record friends if ($obj->addFriend) { $alreadyfriend[$user->id] = $user->id; } $resultRows[] = $obj; } $tmpl = new CTemplate(); echo $tmpl->set('data', $resultRows)->set('alreadyfriend', $alreadyfriend)->set('sortings', '')->set('pagination', $data->pagination)->set('filter', '')->set('featuredList', $featuredList)->set('my', $my)->set('showFeaturedList', false)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); }
public function uploadAvatar() { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_EVENTS_AVATAR')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $eventid = $jinput->get('eventid', '0', 'INT'); $this->_addEventInPathway($eventid); $this->addPathway(JText::_('COM_COMMUNITY_EVENTS_AVATAR')); $this->showSubmenu(); $event = JTable::getInstance('Event', 'CTable'); $event->load($eventid); //CFactory::load( 'helpers' , 'event' ); $handler = CEventHelper::getHandler($event); if (!$handler->manageable()) { $this->noAccess(); return; } $config = CFactory::getConfig(); $uploadLimit = (double) $config->get('maxuploadsize'); $uploadLimit .= 'MB'; //CFactory::load( 'models' , 'events' ); $event = JTable::getInstance('Event', 'CTable'); $event->load($eventid); //CFactory::load( 'libraries' , 'apps' ); $app = CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-events-uploadavatar')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('eventId', $eventid)->set('avatar', $event->getAvatar('avatar'))->set('thumbnail', $event->getThumbAvatar())->set('uploadLimit', $uploadLimit)->fetch('events.uploadavatar'); }
/** * Frontpage display * @param type $tpl */ public function display($tpl = null) { /** * Init variables */ $config = CFactory::getConfig(); $document = JFactory::getDocument(); $usersConfig = JComponentHelper::getParams('com_users'); $my = CFactory::getUser(); $model = CFactory::getModel('user'); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename'))); /** * Init document */ $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); // Process headers HTML output $headerHTML = ''; $tmpl = new CTemplate(); $alreadyLogin = 0; /* User is logged */ if ($my->id != 0) { $headerHTML = $tmpl->fetch('frontpage.members'); $alreadyLogin = 1; } else { /* User is not logged */ $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; /* Facebook login */ if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } /* Joomla! Facebook Connect */ if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } //hero image $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg'; if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg'; } else { if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) { $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png'; } } //add the hero image as the image metatdata $imgMeta = '<meta property="og:image" content="' . $heroImage . '"/>'; $document->addCustomTag($imgMeta); $themeModel = CFactory::getModel('theme'); $settings = $themeModel->getSettings(); /* Generate header HTML for guest */ if ($settings['general']['enable-frontpage-login']) { $headerHTML = $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration'))->set('heroImage', $heroImage)->set('fbHtml', $fbHtml)->set('useractivation', $usersConfig->get('useractivation'))->set('return', $uri)->set('settings', $settings)->fetch('frontpage/guest'); } else { $headerHTML = ''; } } /* Get site members count */ $totalMembers = $model->getMembersCount(); $latestActivitiesData = $this->showLatestActivities(); $latestActivitiesHTML = $latestActivitiesData['HTML']; $tmpl = new CTemplate(); $tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('customActivityHTML', $this->getCustomActivityHTML()); $status = new CUserStatus(); if ($my->authorise('community.view', 'frontpage.statusbox')) { // Add default status box CUserHelper::addDefaultStatusCreator($status); if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) { $template = new CTemplate(); $template->set('customActivities', CActivityStream::getCustomActivities()); $creator = new CUserStatusCreator('custom'); $creator->title = JText::_('COM_COMMUNITY_CUSTOM'); $creator->html = $template->fetch('status.custom'); $status->addCreator($creator); } } /** * Misc variables * @since 3.3 * Move out variable init in side template into view */ $moduleCount = count(JModuleHelper::getModules('js_side_frontpage')) + count(JModuleHelper::getModules('js_side_top')) + count(JModuleHelper::getModules('js_side_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_top')) + count(JModuleHelper::getModules('js_side_frontpage_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_stacked')) + count(JModuleHelper::getModules('js_side_top_stacked')) + count(JModuleHelper::getModules('js_side_bottom_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_top_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_bottom_stacked')); $jinput = JFactory::getApplication()->input; /** * @todo 3.3 * All of these code must be provided in object. DO NOT PUT ANY CODE LOGIC HERE ! */ $cconfig = CFactory::getConfig(); $filter = $jinput->get('filter'); $filterValue = $jinput->get('value', 'default_value', 'RAW'); $filterText = JText::_("COM_COMMUNITY_FILTERBAR_ALL"); $filterHashtag = false; $filterKeyword = false; if ($filter == 'apps') { switch ($filterValue) { case 'profile': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_STATUS"); break; case 'photo': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_PHOTO"); break; case 'video': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_VIDEO"); break; case 'group': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_GROUP"); break; case 'event': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_EVENT"); break; } } else { if ($filter == 'hashtag') { $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_HASHTAG") . ' #' . $filterValue; $filterHashtag = true; } else { if ($filter == 'keyword') { $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_KEYWORD") . ' ' . $filterValue; $filterKeyword = true; } else { switch ($filterValue) { case 'me-and-friends': $filterText = JText::_("COM_COMMUNITY_FILTERBAR_RELATIONSHIP_ME_AND_FRIENDS"); break; } } } } echo $tmpl->set('userstatus', $status)->set('moduleCount', $moduleCount)->set('class', $moduleCount > 0 ? 'span8' : 'span12')->set('filterKey', $filter)->set('filter', $filter)->set('filterText', $filterText)->set('filterHashtag', $filterHashtag)->set('filterKeyword', $filterKeyword)->set('filterValue', $filterValue)->fetch('frontpage/base'); }
public function news() { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_FRIENDS_FRIENDS_NEWS')); }
/** * Method to display video * @return void */ public function video() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $requestUser = CFactory::getRequestUser(); $videoId = $jinput->get('videoid', '', 'INT'); $task = $jinput->getCmd('task'); // Get show video location map by default $videoMapsDefault = $config->get('videosmapdefault'); // Load window library CWindow::load(); $video = JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { if ($jinput->get('videoid', '', 'INT')) { $videoId = $jinput->get('videoid', '', 'INT'); } else { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } if ($video->groupid) { JRequest::setVar('groupid', $video->groupid); } elseif ($video->eventid) { JRequest::setVar('eventid', $video->eventid); } // Setting up the sub menu if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), "joms.api.videoFetchThumbnail('" . $video->id . "');", true); // Only add the set as profile video for video owner if ($my->id == $video->creator && $config->get('enableprofilevideo')) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), "joms.api.videoLinkToProfile('" . $video->id . "');", true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), "joms.api.videoEdit('" . $video->id . "');", true); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.api.videoRemove('" . $video->id . "');", true); } $this->_addSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { // $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } $sorted = $jinput->get('sort', 'latest', 'STRING'); $limit = $jinput->get('limitstart', 6, 'INT'); $permissions = $my->id == 0 ? 0 : 20; $cat_id = $jinput->get('cat_id', '', 'INT'); $model = CFactory::getModel('videos'); /* We get groupid from video table instead user input */ $groupId = $video->groupid; if ($video->creator_type == VIDEO_GROUP_TYPE) { if (!CGroupHelper::allowViewMedia($groupId)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); return; } $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=display&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); switch ($video->permissions) { case '40': $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice')); break; case '30': $owner = CFactory::getUser($video->creator); $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName())); break; default: $this->noAccess(); break; } return; } // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit); $otherVideos = $model->getVideos($filters); } // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; $report = new CReportingLibrary(); if ($user->id != $my->id) { $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); } // Get bookmark html $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video'); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); $wallViewAll = ''; if ($wallCount > $config->get('stream_default_comments')) { $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); } $wallForm = ''; if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) { $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); } $redirectUrl = CRoute::getURI(false); // Get like information. $like = new CLike(); $likeCount = $like->getLikeCount('videos', $video->id); $likeLiked = $like->userLiked('videos', $video->id, $my->id) === COMMUNITY_LIKE; $tmpl = new CTemplate(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document = JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } if ($video->location !== '' && $videoMapsDefault) { $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150, $video->longitude, $video->latitude); } else { $zoomableMap = ""; } //friend list for video tag $tagging = new CVideoTagging(); $taggedList = $tagging->getTaggedList($video->id); for ($t = 0; $t < count($taggedList); $t++) { $tagItem = $taggedList[$t]; $tagUser = CFactory::getUser($tagItem->userid); $canRemoveTag = 0; // 1st we check the tagged user is the video owner. // If yes, canRemoveTag == true. // If no, then check on user is the tag creator or not. // If yes, canRemoveTag == true // If no, then check on user whether user is being tagged if (COwnerHelper::isMine($my->id, $video->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } if ($video->type == "file") { $storage = CStorage::getStorage($video->storage); $video->path = $storage->getURI($video->path); } $config = CFactory::getConfig(); $canSearch = 1; if ($my->id == 0 && !$config->get('enableguestsearchvideos')) { $canSearch = 0; } CHeadHelper::addOpengraph('og:image', JUri::root() . $video->thumb, true); CHeadHelper::setType('website', $video->title); $video->tagged = $taggedList; echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likeCount', $likeCount)->set('canSearch', $canSearch)->set('likeLiked', $likeLiked)->set('redirectUrl', $redirectUrl)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->set('videoMapsDefault', $videoMapsDefault)->set('wallCount', $wallCount)->set('isGroup', $groupId ? true : false)->set('groupId', $groupId ? $groupId : null)->set('submenu', $this->showSubmenu(false))->fetch('videos/single'); }
/** * */ public function notifications() { $mainframe = JFactory::getApplication(); if (!$this->accessAllowed('registered')) { return; } $pathway = $mainframe->getPathway(); $my = CFactory::getUser(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('COM_COMMUNITY_PROFILE_NOTIFICATIONS'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PROFILE_NOTIFICATIONS')); $user = CFactory::getUser(); $params = $user->getParams(); $config = CFactory::getConfig(); $modelNotification = CFactory::getModel('notification'); $notifications = $modelNotification->getNotification($my->id, '0', 0); $app = CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-notifications')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('params', $params)->set('config', $config)->set('submenu', $this->showSubmenu(false))->set('pagination', $modelNotification->getPagination())->set('notifications', $notifications)->fetch('profile.notification'); }
public function activation() { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESEND_ACTIVATION')); // $js = 'assets/validate-1.5.min.js'; // CFactory::attach($js, 'js'); $tmpl = new CTemplate(); echo $tmpl->fetch('register.activation'); }
/** * Method to display add new bulletin form * * @param $title The title of the bulletin if the adding failed * @param $message The message of the bulletin if adding failed * */ public function addNews($bulletin) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_ADD_BULLETIN')); $this->showSubmenu(); $config = CFactory::getConfig(); $groupId = JRequest::getInt('groupid', ''); $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { $this->_redirectUnpublishGroup(); return; } // Add pathways $this->_addGroupInPathway($groupId); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_BULLETIN_CREATE')); $editor = new CEditor($config->get('htmleditor', 'none')); $title = $bulletin ? $bulletin->title : ''; $message = $bulletin ? $bulletin->message : ''; $params = $group->getParams(); $tmpl = new CTemplate(); echo $tmpl->set('config', $config)->set('title', $title)->set('message', $message)->set('groupid', $groupId)->set('editor', $editor)->set('params', $params)->fetch('groups.addnews'); }