/** * Class entry point * * @param object Registry reference * @return @e void [Outputs to screen/redirects] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // Get HTML and skin //----------------------------------------- $this->registry->class_localization->loadLanguageFile(array('public_list'), 'members'); //----------------------------------------- // Can we access? //----------------------------------------- if (!$this->memberData['g_mem_info']) { $this->registry->output->showError('cannot_view_memberlist', 10221, null, null, 403); } //----------------------------------------- // Init variables //----------------------------------------- $see_groups = array(); $the_filter = array('ALL' => $this->lang->words['show_all']); $the_members = array(); $query = array("m.members_l_display_name !='' AND m.members_l_display_name " . $this->DB->buildIsNull(false)); $url = array(); $pp_rating_real = isset($this->request['pp_rating_real']) ? intval($this->request['pp_rating_real']) : 0; $this->first = isset($this->request['st']) ? intval($this->request['st']) : 0; $this->max_results = !empty($this->request['max_results']) ? $this->request['max_results'] : $this->max_results; $this->sort_key = !empty($this->request['sort_key']) ? $this->request['sort_key'] : 'members_display_name'; $this->sort_order = !empty($this->request['sort_order']) ? $this->request['sort_order'] : 'asc'; $this->filter = !empty($this->request['filter']) ? $this->request['filter'] == 'ALL' ? 'ALL' : intval($this->request['filter']) : 'ALL'; $this->request['showall'] = isset($this->request['showall']) ? intval($this->request['showall']) : 0; $this->request['name_box'] = isset($this->request['name_box']) ? $this->request['name_box'] : ''; $this->request['quickjump'] = isset($this->request['quickjump']) ? $this->request['quickjump'] : 0; $_queryPP = false; //----------------------------------------- // Set some of the URL params //----------------------------------------- if ($this->request['quickjump']) { $this->request['name_box'] = 'begins'; $this->request['name'] = $this->request['quickjump']; } $url['app'] = "app=members&module=list"; $url['showall'] = 'showall=' . $this->request['showall']; $url['sort_key'] = "sort_key={$this->sort_key}"; $url['sort_order'] = "sort_order={$this->sort_order}"; $url['max_results'] = "max_results={$this->max_results}"; $url['quickjump'] = "quickjump={$this->request['quickjump']}"; $url['name_box'] = 'name_box=' . $this->request['name_box']; $url['name'] = isset($this->request['name']) ? "name={$this->request['name']}" : "name="; //----------------------------------------- // Sort the member group info //----------------------------------------- foreach ($this->caches['group_cache'] as $row) { if ($row['g_hide_from_list']) { if (!($this->memberData['g_access_cp'] and $this->request['showall'])) { $hide_ids[] = $row['g_id']; continue; } } $see_groups[] = $row['g_id']; $this->mem_groups[$row['g_id']] = array('TITLE' => $row['g_title'], 'ICON' => $row['g_icon']); if ($row['g_id'] == $this->settings['guest_group']) { continue; } $the_filter[$row['g_id']] = $row['g_title']; } //----------------------------------------- // Init some arrays //----------------------------------------- $the_sort_key = array('members_l_display_name' => 'sort_by_name', 'posts' => 'pcount', 'joined' => 'sort_by_joined', 'members_profile_views' => 'm_dd_views'); $the_max_results = array(10 => '10', 20 => '20', 40 => '40', 60 => '60'); $the_sort_order = array('desc' => 'descending_order', 'asc' => 'ascending_order'); $dropdowns = array('filter' => $the_filter, 'sort_key' => $the_sort_key, 'sort_order' => $the_sort_order, 'max_results' => $the_max_results); $defaults = array('filter' => $this->filter, 'sort_key' => $this->sort_key, 'sort_order' => $this->sort_order, 'max_results' => $this->max_results, 'photoonly' => !empty($this->request['photoonly']) ? 1 : 0); //----------------------------------------- // Final vars for query //----------------------------------------- $this->sort_key = isset($the_sort_key[$this->sort_key]) ? $this->sort_key : 'members_l_display_name'; $this->sort_order = isset($the_sort_order[$this->sort_order]) ? $this->sort_order : 'asc'; $this->filter = isset($the_filter[$this->filter]) ? $this->filter : 'ALL'; $this->max_results = isset($the_max_results[$this->max_results]) ? $this->max_results : 20; //----------------------------------------- // Get custom profile information //----------------------------------------- $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields'); $this->custom_fields = new $classToLoad(); $this->custom_fields->initData('edit', 1); $this->custom_fields->parseToEdit('mlist'); //----------------------------------------- // Member Groups... //----------------------------------------- if ($this->filter != 'ALL') { if (!in_array($this->filter, $see_groups)) { $query[] = 'm.member_group_id IN(' . implode(',', $see_groups) . ')'; } else { $query[] = 'm.member_group_id=' . $this->filter; } $url['filter'] = 'filter=' . $this->filter; } //----------------------------------------- // NOT IN Member Groups... //----------------------------------------- if (count($hide_ids)) { $query[] = "m.member_group_id NOT IN(" . implode(",", $hide_ids) . ")"; } /* Not banned */ $query[] = "m.member_banned=0"; /* Not a spammer */ $query[] = '( ! ' . IPSBWOptions::sql('bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has') . ')'; //----------------------------------------- // Build query //----------------------------------------- $dates = array('lastpost', 'lastvisit', 'joined'); $mapit = array('posts' => 'm.posts', 'joined' => 'm.joined', 'lastpost' => 'm.last_post', 'lastvisit' => 'm.last_visit', 'signature' => 'pp.signature', 'name' => 'm.members_display_name', 'photoonly' => 'pp.pp_main_photo'); //----------------------------------------- // Do search //----------------------------------------- foreach ($mapit as $in => $tbl) { /** * Leave isset && != '', can't use empty or 0 values are skipped as well * @link http://community.invisionpower.com/tracker/issue-37350-sorting-members-by-post-count/ */ $this->request[$in] = isset($this->request[$in]) && $this->request[$in] != '' ? $this->request[$in] : ''; $inbit = $this->request[$in] = IPSText::parseCleanValue(trim(urldecode(IPSText::stripslashes($this->request[$in])))); $url[$in] = $in . '=' . urlencode($this->request[$in]); //----------------------------------------- // Name... //----------------------------------------- if ($in == 'name' and $inbit != "") { if ($this->request['name_box'] == 'begins') { $query[] = "m.members_l_display_name LIKE '" . mb_strtolower($inbit) . "%'"; } else { $query[] = "m.members_l_display_name LIKE '%" . mb_strtolower($inbit) . "%'"; } } else { if ($in == 'posts' and is_numeric($inbit) and intval($inbit) > -1) { $ltmt = $this->request[$in . '_ltmt'] == 'lt' ? '<' : '>'; $query[] = $tbl . ' ' . $ltmt . ' ' . intval($inbit); $url[$in] = $in . '_ltmt=' . $this->request[$in . '_ltmt'] . '&posts=' . intval($inbit); } else { if (in_array($in, $dates) and $inbit) { if (preg_match('/\\d{2}-\\d{2}-\\d{4}/', $this->request[$in])) { $_tmp = explode('-', $this->request[$in]); $time_int = mktime(23, 59, 59, $_tmp[0], $_tmp[1], $_tmp[2]); } else { $time_int = strtotime(IPSText::monthNameRu2En($this->request[$inbit])); } if ($time_int) { $ltmt = $this->request[$in . '_ltmt'] == 'lt' ? '<' : '>'; $query[] = $tbl . ' ' . $ltmt . ' ' . $time_int; $url[$in . '_ltmt'] = $in . '_ltmt=' . $this->request[$in . '_ltmt']; } } else { if ($in == 'photoonly') { if ($this->request['photoonly'] == 1) { $_queryPP = true; $query[] = $tbl . "<> ''"; $url[] = 'photoonly=1'; } } else { if ($inbit != "" and $in != 'posts') { $_queryPP = true; $query[] = $tbl . " LIKE '%{$inbit}%'"; } } } } } } //----------------------------------------- // Custom fields? //----------------------------------------- if (count($this->custom_fields->out_fields)) { foreach ($this->custom_fields->out_fields as $id => $data) { if (!empty($this->request['field_' . $id])) { $_queryPP = true; if (is_array($this->request['field_' . $id])) { foreach ($this->request['field_' . $id] as $k => $v) { $this->request['field_' . $id][$k] = urldecode($v); $url[$in] = "field_{$id}[{$k}]=" . $v; } } else { $url[$in] = "field_{$id}=" . $this->request['field_' . $id]; $this->request['field_' . $id] = urldecode($this->request['field_' . $id]); } if ($this->custom_fields->cache_data[$id]['pf_type'] == 'drop') { $query[] = "p.field_{$id}='" . $this->request['field_' . $id] . "'"; } else { if ($this->custom_fields->cache_data[$id]['pf_type'] == 'cbox') { if (count($this->request['field_' . $id])) { foreach ($this->request['field_' . $id] as $k => $v) { $query[] = "p.field_{$id} LIKE '%|{$k}|%'"; } } } else { $query[] = $this->custom_fields->cache_data[$id]['pf_search_type'] == 'loose' ? "p.field_{$id} LIKE '%" . $this->request['field_' . $id] . "%'" : "p.field_{$id} = '" . $this->request['field_' . $id] . "'"; } } } } } //----------------------------------------- // Rating.. //----------------------------------------- if ($pp_rating_real) { $_queryPP = true; $query[] = "pp.pp_rating_real > " . $pp_rating_real; $url['pp_rating_real'] = "pp_rating_real=" . $pp_rating_real; } //----------------------------------------- // Finish query //----------------------------------------- //$query[] = "m.members_l_display_name != ''"; $joins = array(); if ($_queryPP) { $joins[] = array('from' => array('pfields_content' => 'p'), 'where' => 'p.member_id=m.member_id', 'type' => 'left'); $joins[] = array('from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'); } //----------------------------------------- // Reputation //----------------------------------------- if (!ipsRegistry::isClassLoaded('repCache')) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache'); ipsRegistry::setClass('repCache', new $classToLoad()); } //----------------------------------------- // START THE LISTING //----------------------------------------- $notInMembers = 0; foreach ($query as $q) { if (!strstr($q, 'm.')) { $notInMembers++; } } /* Get the count */ if ($notInMembers > 0 or $this->sort_key != 'members_l_display_name' or $this->request['request_method'] == 'post') { $_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'add_join' => $joins)); $this->DB->build(array('select' => ' m.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results), 'add_join' => $joins)); } else { $_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => 'members m', 'where' => implode(" AND ", $query))); $this->DB->build(array('select' => 'm.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results))); } /* Fetch IDs */ $mids = array(); $this->DB->execute(); while ($m = $this->DB->fetch()) { if ($m['member_id']) { $mids[] = $m['member_id']; } } if (count($mids)) { $members = array(); $_members = IPSMember::load($mids, 'all'); /* Make sure that we keep the ordering from the query */ foreach ($mids as $id) { $members[$id] = $_members[$id]; } } $max = $_max['cnt']; if (is_array($members) and count($members)) { foreach ($members as $id => $member) { /* Damn SQL thing with member_id */ if (!$member['member_id']) { $member['member_id'] = $member['member_table_id']; } $member['members_display_name'] = $member['members_display_name'] ? $member['members_display_name'] : $member['name']; $member['members_seo_name'] = IPSMember::fetchSeoName($member); $member['group'] = $this->mem_groups[$member['member_group_id']]['TITLE']; $member = IPSMember::buildProfilePhoto($member); $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0; $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']); /* Reputation */ if ($this->settings['reputation_protected_groups']) { if (in_array($member['member_group_id'], explode(",", $this->settings['reputation_protected_groups']))) { $member['pp_reputation_points'] = null; $member['author_reputation'] = null; } } $the_members[] = $member; } } /* make sure URL doesn't contain empty params */ $_url = $url; $url = array(); foreach ($_url as $key => $bit) { if (strrpos($bit, '=') + 1 == strlen($bit)) { continue; } $url[] = $bit; } $pages = $this->registry->output->generatePagination(array('totalItems' => $max, 'itemsPerPage' => $this->max_results, 'currentStartValue' => $this->first, 'seoTitle' => "false", 'seoTemplate' => 'members_list', 'baseUrl' => implode('&', $url))); //----------------------------------------- // Print... //----------------------------------------- $this->output .= $this->registry->getClass('output')->getTemplate('mlist')->member_list_show($the_members, $pages, $dropdowns, $defaults, $this->custom_fields, implode('&', $url)); //----------------------------------------- // Push to print handler //----------------------------------------- $this->registry->output->addContent($this->output); $this->registry->output->setTitle($this->lang->words['page_title'] . ' - ' . ipsRegistry::$settings['board_name']); $this->registry->output->addNavigation($this->lang->words['page_title'], 'app=members', "false", 'members_list'); $this->registry->output->sendOutput(); }
/** * Processes a search request * * @return @e void */ public function searchResults() { /* Search Term */ if (isset($this->request['search_term']) && !is_string($this->request['search_term'])) { $this->registry->getClass('output')->showError('invalid_search_term', 10312564); } $_st = $this->searchController->formatSearchTerm(trim($this->request['search_term'])); $search_term = $_st['search_term']; $removedTerms = $_st['removed']; /* Set up some defaults */ $this->settings['max_search_word'] = $this->settings['max_search_word'] ? $this->settings['max_search_word'] : 300; /* Did we come in off a post request? */ if ($this->request['request_method'] == 'post') { /* Set a no-expires header */ $this->registry->getClass('output')->setCacheExpirationSeconds(30 * 60); } if (is_array($this->request['search_app_filters'])) { array_walk_recursive($this->request['search_app_filters'], create_function('&$item, $key', '$item = IPSText::htmlspecialchars($item);')); } /* App specific */ if (isset($this->request['search_sort_by_' . $this->request['search_app']])) { $this->request['search_sort_by'] = $_POST['search_sort_by_' . $this->request['search_app']] ? htmlspecialchars($_POST['search_sort_by_' . $this->request['search_app']]) : $this->request['search_sort_by_' . $this->request['search_app']]; $this->request['search_sort_order'] = $_POST['search_sort_order_' . $this->request['search_app']] ? htmlspecialchars($_POST['search_sort_order_' . $this->request['search_app']]) : $this->request['search_sort_order_' . $this->request['search_app']]; } /* Populate the registry */ IPSSearchRegistry::set('in.search_app', $this->request['search_app']); IPSSearchRegistry::set('in.raw_search_term', trim($this->request['search_term'])); IPSSearchRegistry::set('in.clean_search_term', $search_term); IPSSearchRegistry::set('in.raw_search_tags', str_replace('&', '&', trim(IPSText::parseCleanValue(IPSText::urldecode_furlSafe($_REQUEST['search_tags']))))); IPSSearchRegistry::set('in.search_higlight', str_replace('.', '', $this->request['search_term'])); IPSSearchRegistry::set('in.search_date_end', $this->request['search_date_start'] && $this->request['search_date_end'] ? $this->request['search_date_end'] : 'now'); IPSSearchRegistry::set('in.search_date_start', $this->request['search_date_start'] ? $this->request['search_date_start'] : ''); IPSSearchRegistry::set('in.search_author', !empty($this->request['search_author']) ? $this->request['search_author'] : ''); /* Set sort filters */ $this->_setSortFilters(); /* These can be overridden in the actual engine scripts */ // IPSSearchRegistry::set('set.hardLimit' , 0 ); IPSSearchRegistry::set('set.resultsCutToLimit', false); IPSSearchRegistry::set('set.resultsAsForum', false); /* Are we option to show titles only / search in titles only */ IPSSearchRegistry::set('opt.searchType', (!empty($this->request['search_content']) and in_array($this->request['search_content'], array('both', 'titles', 'content'))) ? $this->request['search_content'] : 'both'); /* Time check */ if (IPSSearchRegistry::get('in.search_date_start') and strtotime(IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_start'))) > time()) { IPSSearchRegistry::set('in.search_date_start', 'now'); } if (IPSSearchRegistry::get('in.search_date_end') and strtotime(IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_end'))) > time()) { IPSSearchRegistry::set('in.search_date_end', 'now'); } /* Do some date checking */ if (IPSSearchRegistry::get('in.search_date_end') and IPSSearchRegistry::get('in.search_date_start') and strtotime(IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_start'))) > strtotime(IPSText::monthNameRu2En(IPSSearchRegistry::get('in.search_date_end')))) { $this->searchAdvancedForm($this->lang->words['search_invalid_date_range']); return; } /** * Lower limit */ if ($this->settings['min_search_word'] && !IPSSearchRegistry::get('in.search_author') && !IPSSearchRegistry::get('in.raw_search_tags')) { if ($this->settings['search_method'] == 'sphinx' && substr_count($search_term, '"') >= 2) { $_ok = true; } else { $_words = explode(' ', preg_replace("#\"(.*?)\"#", '', $search_term)); $_ok = $search_term ? true : false; foreach ($_words as $_word) { $_word = preg_replace('#^\\+(.+?)$#', "\\1", $_word); if (!$_word or $_word == '|') { continue; } if (strlen($_word) < $this->settings['min_search_word']) { $_ok = false; break; } } } if (!$_ok) { $this->searchAdvancedForm(sprintf($this->lang->words['search_term_short'], $this->settings['min_search_word']), $removedTerms); return; } } /** * Ok this is an upper limit. * If you needed to change this, you could do so via conf_global.php by adding: * $INFO['max_search_word'] = #####; */ if ($this->settings['max_search_word'] && strlen(IPSSearchRegistry::get('in.raw_search_term')) > $this->settings['max_search_word']) { $this->searchAdvancedForm(sprintf($this->lang->words['search_term_long'], $this->settings['max_search_word'])); return; } /* Search Flood Check */ if ($this->memberData['g_search_flood']) { /* Check for a cookie */ $last_search = IPSCookie::get('sfc'); $last_term = str_replace(""", '"', IPSCookie::get('sfct')); $last_term = str_replace("&", '&', $last_term); /* If we have a last search time, check it */ if ($last_search && $last_term) { if (time() - $last_search <= $this->memberData['g_search_flood'] && $last_term != IPSSearchRegistry::get('in.raw_search_term')) { $this->searchAdvancedForm(sprintf($this->lang->words['xml_flood'], $this->memberData['g_search_flood'] - (time() - $last_search))); return; } else { /* Reset the cookie */ IPSCookie::set('sfc', time()); IPSCookie::set('sfct', urlencode(IPSSearchRegistry::get('in.raw_search_term'))); } } else { IPSCookie::set('sfc', time()); IPSCookie::set('sfct', urlencode(IPSSearchRegistry::get('in.raw_search_term'))); } } /* Clean search term for results view */ $_search_term = trim(preg_replace('#(^|\\s)(\\+|\\-|\\||\\~)#', " ", $search_term)); /* Got tag search only but app doesn't support tags */ if (IPSSearchRegistry::get('in.raw_search_tags') && !IPSSearchRegistry::get('config.can_searchTags') && !IPSSearchRegistry::get('in.raw_search_term')) { $count = 0; $results = array(); } else { if (IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'search')) { /* Perform the search */ $this->searchController->search(); /* Get count */ $count = $this->searchController->getResultCount(); /* Get results which will be array of IDs */ $results = $this->searchController->getResultSet(); /* Get templates to use */ $template = $this->searchController->fetchTemplates(); /* Fetch sort details */ $sortDropDown = $this->searchController->fetchSortDropDown(); /* Set default sort option */ $_a = IPSSearchRegistry::get('in.search_app'); $_k = IPSSearchRegistry::get($_a . '.searchInKey') ? IPSSearchRegistry::get($_a . '.searchInKey') : ''; if ($_k and !$this->request['search_app_filters'][$_a][$_k]['sortKey'] and is_array($sortDropDown) and count($sortDropDown)) { $this->request['search_app_filters'][$_a][$_k]['sortKey'] = key($sortDropDown); } else { if (!$_k and !$this->request['search_app_filters'][$_a]['sortKey'] and is_array($sortDropDown) and count($sortDropDown)) { $this->request['search_app_filters'][$_a]['sortKey'] = key($sortDropDown); } } /* Fetch sort details */ $sortIn = $this->searchController->fetchSortIn(); /* Build pagination */ $links = $this->registry->output->generatePagination(array('totalItems' => $count, 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'), 'currentStartValue' => IPSSearchRegistry::get('in.start'), 'baseUrl' => $this->_buildURLString() . '&search_app=' . IPSSearchRegistry::get('in.search_app'))); /* Showing */ $showing = array('start' => IPSSearchRegistry::get('in.start') + 1, 'end' => IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') > $count ? $count : IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page')); /* Parse result set */ $results = $this->registry->output->getTemplate($template['group'])->{$template}['template']($results, IPSSearchRegistry::get('opt.searchType') == 'titles' || IPSSearchRegistry::get('opt.noPostPreview') ? 1 : 0); /* Check for sortIn */ if (count($sortIn) && !$this->request['search_app_filters'][$this->request['search_app']]['searchInKey']) { $this->request['search_app_filters'][$this->request['search_app']]['searchInKey'] = $sortIn[0][0]; } } else { $count = 0; $results = array(); } } /* Output */ $this->title = $this->lang->words['search_results']; $this->output .= $this->registry->output->getTemplate('search')->searchResultsWrapper($results, $sortDropDown, $sortIn, $links, $count, $showing, $_search_term, $this->_buildURLString(), $this->request['search_app'], $removedTerms, IPSSearchRegistry::get('set.hardLimit'), IPSSearchRegistry::get('set.resultsCutToLimit'), IPSSearchRegistry::get('in.raw_search_tags')); }
/** * Global checks and set up * Functions pertaining to ALL posting methods * * @return @e void * Exception Codes: * NO_USER_SET No user has been set * NO_POSTING_PPD No posting perms 'cos of PPD */ public function globalSetUp() { //----------------------------------------- // Checks... //----------------------------------------- if (!$this->getForumID()) { throw new Exception('NO_FORUM_ID'); } if (!is_array($this->getAuthor())) { throw new Exception('NO_AUTHOR_SET'); } //----------------------------------------- // Forum checks //----------------------------------------- # No forum id? if (!$this->getForumData('id')) { throw new Exception('NO_FORUM_ID'); } # Non postable sub forum if (!$this->getForumData('sub_can_post')) { throw new Exception('NO_SUCH_FORUM'); } /* Make sure we have someone set */ if (!$this->getAuthor('member_group_id') or !$this->getAuthor('members_display_name')) { throw new Exception("NO_USER_SET"); } /* Auto check published */ $pub = $this->getPublished(); if (is_string($pub)) { $this->setPublished($this->_checkPostModeration($pub)); } //----------------------------------------- // Do we have the member group info for this member? //----------------------------------------- if (!$this->getAuthor('g_id')) { $group_cache = $this->registry->cache()->getCache('group_cache'); $this->setAuthor(array_merge($this->getAuthor(), $group_cache[$this->getAuthor('member_group_id')])); } //----------------------------------------- // Allowed to upload? //----------------------------------------- $perm_id = $this->getAuthor('org_perm_id') ? $this->getAuthor('org_perm_id') : $this->getAuthor('g_perm_id'); $perm_array = explode(",", $perm_id); if ($this->registry->permissions->check('upload', $this->getForumData(), $perm_array) === TRUE) { if ($this->getAuthor('g_attach_max') != -1) { $this->can_upload = 1; } } //----------------------------------------- // Allowed poll? //----------------------------------------- $_moderator = $this->getAuthor('forumsModeratorData'); $this->can_add_poll = intval($this->getAuthor('g_post_polls')); $this->max_poll_choices_per_question = intval($this->settings['max_poll_choices']); $this->max_poll_questions = intval($this->settings['max_poll_questions']); $this->can_edit_poll = $this->getAuthor('g_is_supmod') ? $this->getAuthor('g_is_supmod') : (isset($_moderator[$this->getForumData('id')]['edit_post']) ? intval($_moderator[$this->getForumData('id')]['edit_post']) : 0); if (!$this->max_poll_questions) { $this->can_add_poll = 0; } if (!$this->getForumData('allow_poll')) { $this->can_add_poll = 0; } $this->settings['max_post_length'] = $this->settings['max_post_length'] ? $this->settings['max_post_length'] : 2140000; //----------------------------------------- // Are we a moderator? //----------------------------------------- if ($this->getAuthor('member_id') != 0 and $this->getAuthor('g_is_supmod') == 0) { /* Load Moderator Options */ $this->moderator = $_moderator[$this->getForumID()]; } //----------------------------------------- // Set open and close time //----------------------------------------- $this->can_set_open_time = $this->getAuthor('g_is_supmod') ? $this->getAuthor('g_is_supmod') : (isset($_moderator[$this->getForumData('id')]['mod_can_set_open_time']) ? intval($_moderator[$this->getForumData('id')]['mod_can_set_open_time']) : 0); $this->can_set_close_time = $this->getAuthor('g_is_supmod') ? $this->getAuthor('g_is_supmod') : (isset($_moderator[$this->getForumData('id')]['mod_can_set_close_time']) ? intval($_moderator[$this->getForumData('id')]['mod_can_set_close_time']) : 0); //----------------------------------------- // OPEN... //----------------------------------------- $_POST['open_time_date'] = isset($_POST['open_time_date']) ? $_POST['open_time_date'] : NULL; $_POST['open_time_time'] = isset($_POST['open_time_time']) ? $_POST['open_time_time'] : NULL; $_POST['close_time_date'] = isset($_POST['close_time_date']) ? $_POST['close_time_date'] : NULL; $_POST['close_time_time'] = isset($_POST['close_time_time']) ? $_POST['close_time_time'] : NULL; if ($this->can_set_open_time and $_POST['open_time_date'] and $_POST['open_time_time']) { $date = strtotime(IPSText::monthNameRu2En($_POST['open_time_date'])); list($hour, $minute) = explode(":", $_POST['open_time_time']); if ($date) { // Bug #20374 $this->times['open'] = $date + $minute * 60 + $hour * 3600 - $this->registry->class_localization->getTimeOffset(); } } //----------------------------------------- // CLOSE... //----------------------------------------- if ($this->can_set_close_time and $_POST['close_time_date'] and $_POST['close_time_time']) { $date = strtotime(IPSText::monthNameRu2En($_POST['close_time_date'])); list($hour, $minute) = explode(":", $_POST['close_time_time']); if ($date) { // Bug #20374 $this->times['close'] = $date + $minute * 60 + $hour * 3600 - $this->registry->class_localization->getTimeOffset(); } } /* Check PPD. Always do this last in globalSetUp as we skip this error if showing edit box */ if ($this->_bypassPermChecks !== TRUE && $this->registry->getClass('class_forums')->checkGroupPostPerDay($this->getAuthor()) !== TRUE) { throw new Exception('NO_POSTING_PPD'); } }