function getLanguagesOptionsDropDown($vars) { $words = new MOD_words(); $languages = array(); $model = new RoxModelBase(); $member = $model->getLoggedInMember(); if ($member) { $languages = $member->get_languages_spoken(); } $select = '<strong class="small">' . $words->getFormatted('SearchLanguages') . '</strong><br/>'; $select .= '<select name="search-languages[]" multiple="multiple" '; if (!$member) { $select .= 'disabled="disabled" '; } $select .= 'class="multiselect sval">'; foreach ($languages as $language) { $select .= '<option value="' . $language->IdLanguage . '"'; if (isset($vars['search-languages']) && in_array($language->IdLanguage, $vars['search-languages']) === true) { $select .= ' selected="selected"'; } $select .= '>' . $language->Name . '</option>'; } $select .= '</select>' . $words->flushBuffer(); return $select; }
/** * Initialise the current user. * Sets language and online status. */ protected function initUser() { $this->setLanguage(); PVars::register('lang', $_SESSION['lang']); $roxModelBase = new RoxModelBase(); $member = $roxModelBase->getLoggedInMember(); // try restoring session from memory cookie if (!$member) { $member = $roxModelBase->restoreLoggedInMember(); } $memberId = false; if ($member) { if ($member->isBanned()) { $member->logOut(); } else { $memberId = $member->id; } } $ipAsInt = intval(ip2long($_SERVER['REMOTE_ADDR'])); MOD_online::get()->iAmOnline($ipAsInt, $memberId); }
protected function _getLoginMessages() { $model = new RoxModelBase(); $member = $model->getLoggedInMember(); if ($member) { $loginMessage = new LoginMessage(); return $loginMessage->getLatestLoginMessages($member); } else { return false; } }
public function __construct(&$dao, $boardname, $link, $navichain = false, $tags = false, $continent = false, $countrycode = false, $admincode = false, $geonameid = false, $board_description = false, $IdGroup = false, $no_forumsgroup = false) { $this->THREADS_PER_PAGE = Forums::CV_THREADS_PER_PAGE; //Variable because it can change wether the user is logged or no $this->POSTS_PER_PAGE = Forums::CV_POSTS_PER_PAGE; //Variable because it can change wether the user is logged or no $this->BW_Right = MOD_right::get(); if (!isset($_SESSION['IdMember'])) { $this->THREADS_PER_PAGE = 100; // Variable because it can change wether the user is logged or no $this->POSTS_PER_PAGE = 200; // Variable because it can change wether the user is logged or no } $this->dao =& $dao; $this->boardname = $boardname; $this->board_description = $board_description; $this->link = $link; $this->continent = $continent; $this->countrycode = $countrycode; $this->admincode = $admincode; $this->geonameid = $geonameid; $this->navichain = $navichain; $this->IdGroup = $IdGroup; $this->tags = $tags; // Decide if it is an active LoggeMember or not if (empty($_SESSION["IdMember"]) or empty($_SESSION["MemberStatus"]) or $_SESSION["MemberStatus"] == 'Pending' or $_SESSION["MemberStatus"] == 'NeedMore') { $this->PublicThreadVisibility = " (ThreadVisibility='NoRestriction') and (ThreadDeleted!='Deleted')"; $this->PublicPostVisibility = " (PostVisibility='NoRestriction') and (PostDeleted!='Deleted')"; if ($no_forumsgroup) { $this->ThreadGroupsRestriction = " (IdGroup != 0 and ThreadVisibility ='NoRestriction')"; $this->PostGroupsRestriction = " (IdGroup != 0 and PostVisibility='NoRestriction')"; } else { $this->ThreadGroupsRestriction = " (IdGroup=0 or ThreadVisibility ='NoRestriction')"; $this->PostGroupsRestriction = " (IdGroup=0 or PostVisibility='NoRestriction')"; } } else { $this->PublicThreadVisibility = "(ThreadVisibility!='ModeratorOnly') and (ThreadDeleted!='Deleted')"; $this->PublicPostVisibility = " (PostDeleted!='Deleted')"; //if the member prefers to see only posts to his/her groups $roxmodel = new RoxModelBase(); $member = $roxmodel->getLoggedInMember(); $owngroupsonly = $member->getPreference("ShowMyGroupsTopicsOnly", $default = "No"); $this->owngroupsonly = $owngroupsonly; if ($owngroupsonly == "Yes" && ($this->IdGroup === false || !isset($this->IdGroup))) { // 0 is the group id for topics without an explicit group, we don't want them in this case. Lazy hack to avoid changing more than necessary: replace 0 with -1 $this->PostGroupsRestriction = " (((IdGroup IN (-1"; $this->ThreadGroupsRestriction = " (((IdGroup IN (-1"; } else { $this->PostGroupsRestriction = " ((PostVisibility IN ('MembersOnly','NoRestriction') or (PostVisibility = 'GroupOnly' AND IdGroup IN (0"; $this->ThreadGroupsRestriction = " ((ThreadVisibility IN ('MembersOnly','NoRestriction') OR (ThreadVisibility = 'GroupOnly' AND IdGroup IN (0"; } $qry = $this->dao->query("SELECT IdGroup FROM membersgroups WHERE IdMember=" . $_SESSION["IdMember"] . " AND Status = 'In'"); if (!$qry) { throw new PException('Failed to retrieve groups for member id =#' . $_SESSION["IdMember"] . ' !'); } while ($rr = $qry->fetch(PDB::FETCH_OBJ)) { $this->PostGroupsRestriction = $this->PostGroupsRestriction . "," . $rr->IdGroup; $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "," . $rr->IdGroup; } if ($no_forumsgroup) { $this->PostGroupsRestriction = $this->PostGroupsRestriction . "))) and IdGroup != 0)"; $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "))) and IdGroup != 0)"; } else { $this->PostGroupsRestriction = $this->PostGroupsRestriction . "))))"; $this->ThreadGroupsRestriction = $this->ThreadGroupsRestriction . "))))"; } } // Prepares additional visibility options for moderator if ($this->BW_Right->HasRight("ForumModerator")) { $this->PublicPostVisibility = " PostVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')"; $this->PublicThreadVisibility = " ThreadVisibility IN ('NoRestriction', 'MembersOnly','GroupOnly','ModeratorOnly')"; if ($this->BW_Right->HasRight("ForumModerator", "AllGroups") or $this->BW_Right->HasRight("ForumModerator", "All")) { if ($no_forumsgroup) { $this->PostGroupsRestriction = " (IdGroup != 0)"; $this->ThreadGroupsRestriction = " (IdGroup != 0)"; } else { $this->PostGroupsRestriction = " (1=1)"; $this->ThreadGroupsRestriction = " (1=1)"; } } } }
<?php $Forums = new ForumsController(); $citylatlong = $this->model->getAllCityLatLong(); $google_conf = PVars::getObj('config_google'); // TODO: Creating new rox model base, because I don't know how to get logged in // member otherwise. Feel free to correct. $roxModelBase = new RoxModelBase(); $member = $roxModelBase->getLoggedInMember(); // Get preference for showing profile visits $preference = $member->getPreference('PreferenceShowProfileVisits', 'Yes'); if ($preference == 'Yes') { $showVisitors = true; } else { $showVisitors = false; } //Blog model to fetch the Community News $Blog = new Blog(); $postIt = $Blog->getTaggedPostsIt('Community News for the frontpage', true); $format = array('short' => $words->getSilent('DateFormatShort')); //magpierss support for BV Blog require_once SCRIPT_BASE . 'build/rox/magpierss/rss_fetch.inc';