/**
  * Toggle side panel on/off without JS
  *
  * @access	public
  * @return	void
  * @see		The Dark Knight (it was an awesome movie)
  */
 public function _toggleSidePanel()
 {
     $current = IPSCookie::get('hide_sidebar');
     $new = $current ? 0 : 1;
     IPSCookie::set('hide_sidebar', $new);
     $this->registry->getClass('output')->silentRedirect($this->settings['base_url']);
 }
 function boardIndexTemplate($lastvisit = "", $stats = array(), $calendar_events = FALSE, $birthdays = FALSE, $chat_html = '', $news_data = array(), $cat_data = array(), $show_side_blocks = true, $side_blocks = array())
 {
     $IPBHTML = "";
     $this->templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $this->__default__templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("board", "0") . "\n" . $this->registry->getClass('output')->addJSModule("hooks", "0") . "<script type='text/javascript'>\n//<![CDATA[\n\tipb.global.boardMarkers = {$H}({\n\t\t'f_cat_unread': \"" . $this->registry->getClass('output')->getReplacement("f_cat_read") . "\",\n\t\t'f_unread': \"" . $this->registry->getClass('output')->getReplacement("f_read") . "\",\n\t\t'f_pass_unread': \"" . $this->registry->getClass('output')->getReplacement("f_pass_read") . "\"\n\t});\n\tvar markerURL = \"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&module=ajax&section=markasread&secure_key={$this->member->form_hash}&i=1&forumid=", 'public', ''), "", "") . "\"; // Ajax URL so don't use &amp;\n//]]>\n</script>\n" . ($this->templateVars['sidebar_enabled'] ? "<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=toggle", 'public', ''), "", "") . "' id='close_sidebar'  class='sidebar_toggle rounded' " . (IPSCookie::get('hide_sidebar') != '1' ? "style='display: none'" : "") . "><img src='{$this->settings['img_url']}/sidebar_close.png' alt='{$this->lang->words['sidebar_close']}' /></a>\n\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=toggle", 'public', ''), "", "") . "' id='open_sidebar' class='sidebar_toggle rounded' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . "><img src='{$this->settings['img_url']}/sidebar_open.png' alt='{$this->lang->words['sidebar_open']}' /></a>" : "") . "\n<h2 class='hide'>{$this->lang->words['board_index_title']}</h2>\n<div id='board_index' class='clearfix'>\n\t" . ($this->templateVars['sidebar_enabled'] ? "<div id='index_stats' class='right clearfix' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . ">\n\t\t\t" . $this->__f__ff88473eff708eb9314ce7282dac4715($lastvisit, $stats, $calendar_events, $birthdays, $chat_html, $news_data, $cat_data, $show_side_blocks, $side_blocks) . "\t\t</div>" : "") . "\n\t\n\t\n\t<div id='categories' class='" . (IPSCookie::get('hide_sidebar') == '1' || !$this->templateVars['sidebar_enabled'] ? "no_sidebar" : "") . " clearfix'>\n\t\t" . ((is_array($news_data) and count($news_data)) ? "\n\t\t\t<div id='latest_news' class='row2'><strong>{$this->lang->words['newslink']}</strong> <a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("showtopic={$news_data['id']}", 'public', ''), "{$news_data['seo_title']}", "showtopic") . "' title='{$this->lang->words['newslink']}'>{$news_data['title']}</a></div>\n\t\t" : "") . "\n\t<!-- CATS AND FORUMS -->\n\t\t" . ((is_array($cat_data) and count($cat_data)) ? "\n\t\t\t" . $this->__f__055700bb587a2b33772bc541b89a163e($lastvisit, $stats, $calendar_events, $birthdays, $chat_html, $news_data, $cat_data, $show_side_blocks, $side_blocks) . "\t\t" : "") . "\n\t</div>\n</div>\n<ul id='stat_links' class='filter_bar rounded'>\n\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=search&amp;do=active", 'public', ''), "", "") . "\" title=\"{$this->lang->words['today_active_cont']}\">{$this->lang->words['new_active_cont']}</a></li>\n\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats&amp;do=leaders", 'public', ''), "", "") . "\" title=\"{$this->lang->words['sm_forum_leaders_title']}\">{$this->lang->words['sm_forum_leaders']}</a></li>\n\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats", 'public', ''), "", "") . "\" title=\"{$this->lang->words['sm_all_posters_title']}\">{$this->lang->words['sm_today_posters']}</a></li>\n\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;section=view&amp;module=list&amp;max_results=20&amp;sort_key=posts&amp;sort_order=desc&amp;filter=ALL", 'public', ''), "", "") . "\" title=\"{$this->lang->words['sm_overall_posters_title']}\">{$this->lang->words['sm_overall_posters']}</a></li>\n</ul>\n<div id='board_statistics' class='statistics general_box clearfix'>\n\t" . ($this->settings['show_totals'] ? "\n\t\t<div id='stats'>\n\t\t\t<h2>{$this->lang->words['board_stats']}</h2>\n\t\t\t<dl>\n\t\t\t\t<dt>{$this->lang->words['total_posts']}</dt>\n\t\t\t\t<dd>{$stats['info']['total_posts']}</dd>\n\t\t\t\t<dt>{$this->lang->words['total_members']}</dt>\n\t\t\t\t<dd>{$stats['info']['mem_count']}</dd>\n\t\t\t\t<dt>{$this->lang->words['newest_member']}</dt>\n\t\t\t\t<dd><a href='{$stats['info']['last_mem_link']}' title='{$this->lang->words['view_profile']}'>{$stats['info']['last_mem_name']}</a>" . $this->registry->getClass('output')->getTemplate('global')->user_popup($stats['info']['last_mem_id'], $stats['info']['last_mem_seo']) . "&nbsp;</dd>\n\t\t\t\t<dt>{$this->lang->words['online_at_once']}</dt>\n\t\t\t\t<dd>{$stats['info']['most_online']}<br /><span class='extra'>{$this->lang->words['on']} {$stats['info']['most_time']}</span></dd>\n\t\t\t</dl>\n\t\t</div>\n\t" : "") . "\n\t" . ($this->settings['show_active'] ? "<div id='active_users' class='stats_list'>\n\t\t\t<h2>\n\t\t\t\t{$stats['TOTAL']} {$this->lang->words['active_users_text']} <span>{$this->lang->words['active_users']}</span><br />\n\t\t\t\t<span class='desc'>{$stats['MEMBERS']} {$this->lang->words['members']}, {$stats['GUESTS']} {$this->lang->words['guests']}, {$stats['ANON']} {$this->lang->words['anon_users']} | {$this->lang->words['show_by']}: <a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_order=desc", 'public', ''), "", "") . "'>{$this->lang->words['oul_click']}</a> {$this->lang->words['or']} <a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_key=name&amp;sort_order=asc&amp;show_mem=reg", 'public', ''), "", "") . "'>{$this->lang->words['oul_name']}</a></span>\n\t\t\t</h2>\n\t\t\t" . (count($stats['NAMES']) ? "\n\t\t\t\t<p>\n\t\t\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $stats['NAMES']) . "</span>\t\t\t\t\t\n\t\t\t\t</p>\n\t\t\t" : "") . "\n\t\t</div>" : "") . "\n\t" . ($calendar_events ? "<div id='cal_events' class='stats_list'>\n\t\t<h2>{$this->lang->words['upcoming_events']}</h2>\n\t\t" . (is_array($calendar_events) ? "\n\t\t\t<p>\n\t\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $calendar_events) . "</span>\n\t\t\t</p>\n\t\t" : "\n\t\t\t<p>{$calendar_events}</p>\n\t\t") . "\n\t</div>" : "") . "\n\t\n\t" . (($birthdays !== FALSE and is_array($birthdays['users']) and count($birthdays['users'])) ? "\n\t\t<div id='cal_bdays' class='stats_list'>\n\t\t\t<h2>{$birthdays['count']} {$this->lang->words['birthdays_today']}</h2>\n\t\t\t<p>\n\t\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $birthdays['users']) . "</span>\t\t\t\t\t\n\t\t\t</p>\n\t\t</div>\n\t" : "" . (($this->settings['show_birthdays'] and !$this->settings['autohide_bday']) ? "\n\t\t\t<div id='cal_bdays' class='stats_list'>\n\t\t\t\t<h2>0 {$this->lang->words['birthdays_today']}</h2>\n\t\t\t\t<p>{$this->lang->words['no_birth_users']}</p>\n\t\t\t</div>\n\t\t" : "") . "") . "\n\t\n</div>\n" . (($this->memberData['members_auto_dst'] == 1 and $this->settings['time_dst_auto_correction']) ? "\n<script type='text/javascript'>\n\tipb.vars['dst_on']\t= parseInt(\"{$this->memberData['dst_in_use']}\");\n\t\n\tipb.board.checkDST();\n</script>\n" : "") . "";
     return $IPBHTML;
 }
예제 #3
0
 function chatRoom($options = array(), $chatters = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_ipchat', $this->_funcHooks['chatRoom'])) {
         $count_fc473221c0d8519b3b35e078488c45d5 = is_array($this->functionData['chatRoom']) ? count($this->functionData['chatRoom']) : 0;
         $this->functionData['chatRoom'][$count_fc473221c0d8519b3b35e078488c45d5]['options'] = $options;
         $this->functionData['chatRoom'][$count_fc473221c0d8519b3b35e078488c45d5]['chatters'] = $chatters;
     }
     $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("chat", "0") . "\n" . $this->registry->getClass('output')->addToDocumentHead('importcss', "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/ipb_editor.css") . "\n<script type='text/javascript'>\n\t// Basic variables\n\tvar roomId\t\t= {$options['roomId']};\n\tvar userId\t\t= {$options['userId']};\n\tvar userName\t= '" . ($this->memberData['member_id'] ? "{$this->memberData['members_display_name']}" : "{$this->memberData['members_display_name']}_{$options['userId']}") . "';\n\tvar accessKey\t= '{$options['accessKey']}';\n\tvar serverHost\t= '{$options['serverHost']}';\n\tvar serverPath\t= '{$options['serverPath']}';\n\tvar ourUrl\t\t= '{$options['ourUrl']}';\n\tUSE_RTE\t\t\t= 0;\n\tvar isMobile\t= 0;\n\t// Chat settings\t\n\tipb.chat.condenseTime\t\t= parseInt({$this->settings['ipchat_limit_time']});\n\tipb.chat.maxMessages\t\t= parseInt({$this->settings['ipchat_max_messages']});\n\tipb.chat.moderator\t\t\t= parseInt({$options['moderator']});\n\tipb.chat.private\t\t\t= parseInt({$options['private']});\n\tipb.chat.hideEnterExit\t\t= parseInt({$this->settings['ipchat_hide_usermessage']});\n\tipb.chat.noBuffer\t\t\t= parseInt('{$this->settings['ipchat_no_buffer']}');\n\tipb.chat.inactiveKick\t\t= parseInt('{$this->settings['ipchat_inactive_minutes']}');\n\tipb.chat.user24hour \t\t= parseInt('{$this->settings['ipchat_24hour']}');\n\t\n\t// Set up templates\n\tipb.chat.templates['msg-1']\t\t\t\t= new Template( \"<li class='post chat-message #{ownclass}'>#{photo} <label>#{username}</label> <div>#{message}</div></li>\" );\n\tipb.chat.templates['msg-1-compound']\t= new Template( \"<li class='post chat-message #{ownclass}'><div class='hider'>&nbsp;</div><div>#{message}</div></li>\" );\n\tipb.chat.templates['msg-2']\t\t\t\t= new Template( \"<li class='post chat-notice'>#{photo} <label>#{username}</label> <div>#{action}</div></li>\" );\n\tipb.chat.templates['msg-3']\t\t\t\t= new Template( \"<li class='post chat-me'>#{photo} <label>#{username}</label> <div>**#{message}**</div></li>\" );\n\tipb.chat.templates['msg-4']\t\t\t\t= new Template( \"<li class='post chat-system'>{$this->lang->words['sys_message_pre']} #{message}</li>\" );\n\tipb.chat.templates['msg-5']\t\t\t\t= new Template( \"<li class='post chat-moderator'><label class='fluid'>#{username}</label> <div>{$this->lang->words['_kicked']} #{extra}</div></li>\" );\n\tipb.chat.templates['msg-K']\t\t\t\t= new Template( \"<li class='post chat-moderator'><div>{$this->lang->words['youve_been_kicked']}</div></li>\" );\n\tipb.chat.templates['send_private']\t\t= new Template( \"<div id='priv_#{id}_wrap'><h3 class='bar'>{$this->lang->words['sendprivatechat']}</h3><div class='chat-private-message'><textarea name='message_content' id='priv_chat_text_#{id}' cols='25' rows='2'></textarea> <input type='submit' value='{$this->lang->words['sendprivatebutton']}' class='input_submit add_folder' id='#{id}_submit' onclick='return ipb.chat.sendPrivateChat( #{id} );' /></div></div>\" );\n\tipb.chat.templates['new-tab']\t\t\t= new Template( \"<a href='#tab-#{id}' rel='#{id}'>#{name}&nbsp;&nbsp;&nbsp;<img src='{$this->settings['img_url']}/cross.png' alt='x' class='right' id='close-chat-tab-#{id}' /></a>\" );\n\tipb.chat.templates['count-title']\t\t= new Template( \"" . str_replace('%s', '#{count}', $this->lang->words['chattab_count']) . "\" );\n\t\n\t// Set some language vars\n\tipb.lang['time_am']\t\t\t\t= \"{$this->lang->words['time_am']}\";\n\tipb.lang['time_pm']\t\t\t\t= \"{$this->lang->words['time_pm']}\";\n\tipb.lang['entered_room']\t\t= \" {$this->lang->words['entered_room']}\";\n\tipb.lang['left_room']\t\t\t= \" {$this->lang->words['left_room']}\";\n\tipb.lang['chat_kick_user']\t\t= \"{$this->lang->words['chat_kick_user']}\";\n\tipb.lang['chat_ban_user']\t\t= \"{$this->lang->words['chat_ban_user']}\";\n\tipb.lang['chat_priv_user']\t\t= \"{$this->lang->words['chat_priv_user']}\";\n\tipb.lang['cant_kick_self']\t\t= \"{$this->lang->words['cant_kick_self']}\";\n\tipb.lang['youve_been_kicked']\t= \"{$this->lang->words['youve_been_kicked']}\";\n\tipb.lang['block_priv_user']\t\t= \"{$this->lang->words['block_priv_user']}\";\n\tipb.lang['unblock_priv_user']\t= \"{$this->lang->words['unblock_priv_user']}\";\n\tipb.lang['cant_block_user']\t\t= \"{$this->lang->words['cant_block_user']}\";\n\tipb.lang['noprivate_withignored'] = \"{$this->lang->words['noprivate_withignored']}\";\n\tipb.lang['ban_user_confirm']\t= \"{$this->lang->words['banconfirmpopup']}\";\n\t\n\t// Emoticons\n\tipb.chat.emoticons\t\t\t= \$H({ " . IPSLib::fetchEmoticonsAsJson($this->registry->output->skin['set_emo_dir'], true) . " });\n\tipb.vars['emoticon_url']\t= \"{$this->settings['emoticons_url']}\";\n\tipb.vars['img_url']\t\t\t= '{$this->settings['img_url']}';\n\t\n\t// Sound\n\tipb.chat.soundEnabled\t\t= " . (IPSCookie::get('chat_sounds') == 'off' ? "0" : "1") . ";\n\tipb.chat.soundOnImg\t\t\t= \"{$this->settings['img_url']}/bell.png\";\n\tipb.chat.soundOffImg\t\t= \"{$this->settings['img_url']}/bell_off.png\";\n\t\n\t// Chatters name formatting\n\t" . $this->__f__776f6e2cf0409238d7f8b06df58633b5($options, $chatters) . "\t// Ignore private chats from..\n\t" . $this->__f__5cb7dc707613b708061e35c39c0315de($options, $chatters) . "\t" . ((isset($this->memberData['_ignoredUsers']) and count($this->memberData['_ignoredUsers'])) ? "\n\t\t" . $this->__f__912a9882eb2468aa711103e006f1db77($options, $chatters) . "\t" : "") . "\n\t\n\t// Badwords\n\t" . ((is_array($this->caches['badwords']) and count($this->caches['badwords'])) ? "\n\t\t" . $this->__f__a322b0264fb42d72e2ed89b6f99a822a($options, $chatters) . "\t" : "") . "\n\t\n\t// Groups\n\t" . $this->__f__2a73ab0bb6c4c786423dde2785d55fd9($options, $chatters) . "</script>\n<script type='text/javascript' src='{$this->settings['public_dir']}js/ips.editor.js'></script>\n" . (!$this->request['_popup'] ? "\n\t<h1 class='ipsType_pagetitle'>" . IPSLib::getAppTitle('ipchat') . "</h1>\n\t<br /><br />\n" : "") . "\n<div class='ipsBox ipsLayout ipsLayout_withright ipsPostForm clearfix'>\n\t<div class='ipsBox_container ipsLayout_right ipsPostForm_sidebar'>\n\t\t<div id='chat-room-list' style='display:none'>\n\t\t\t<h3 class='bar'>{$this->lang->words['chats']}</h3>\n\t\t\t<div class='ipsPad ipsSideMenu'>\n\t\t\t\t<ul id='chat-tab-holder'>\n\t\t\t\t\t<li class='active' id='tab-chatroom'><a href='#tab-chatroom' rel='chatroom'>{$this->lang->words['chat_tab_home']}</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\t\n\t\t<h3 class='bar'><span id='online-chat-count'>" . (($_count = count($chatters)) ? "{$_count}" : "0") . "</span> {$this->lang->words['whos_chatting_ttl']}</h3>\n\t\t<div class='ipsPad' id='chatters-online-wrap'>\n\t\t\t<ul id='chatters-online'>\n\t\t\t\t" . $this->__f__85f7a2a7de7bd273e202a92898fb0067($options, $chatters) . "\t\t\t</ul>\n\t\t</div>\n\t\t<div class='ipsPad right'>\n\t\t\t<ul class='ipsList_inline'>\n\t\t\t\t<li>\n\t\t\t\t\t<a class='ipsButton_secondary' href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("module=ipschat&amp;section=chat&amp;do=leave&amp;room={$options['roomId']}&amp;user={$options['userId']}&amp;access_key={$options['accessKey']}&amp;secure_key={$this->member->form_hash}" . ($this->request['_popup'] ? "&amp;popup=1" : "") . "", "publicWithApp", ''), "", "") . "' title='{$this->lang->words['leave_room']}' id='leave_room'><img src='{$this->settings['img_url']}/cross.png' alt='{$this->lang->words['leave_room']}' /> {$this->lang->words['leave_room']}</a>\n\t\t\t\t</li>\n\t\t\t\t<li>\n\t\t\t\t\t<a class='ipsButton_secondary' href='#' title='{$this->lang->words['toggle_sound']}' id='sound_toggle'>&nbsp;<img id='sound_toggle_img' src='{$this->settings['img_url']}/" . (IPSCookie::get('chat_sounds') == 'off' ? "bell_off.png" : "bell.png") . "' alt='{$this->lang->words['toggle_sound']}' />&nbsp;</a>\n\t\t\t\t</li>\n\t\t\t\t" . (!$this->request['_popup'] ? "\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a class='ipsButton_secondary' href='#' title='{$this->lang->words['chat_new_window']}' id='chat_new_window'><img src='{$this->settings['img_url']}/chat/window_open.png' alt='{$this->lang->words['chat_new_window']}' /></a>\n\t\t\t\t\t</li>\n\t\t\t\t" : "") . "\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t<div class='ipsBox_container ipsLayout_content'>\n\t\t<div id='scrollbar_container'>\n\t\t\t<div id='messages-display'><span id='initial_message'>{$this->lang->words['please_wait_chats']}</span></div>\n\t\t</div>\n\t\t<form id='chat-form' action='#' method='post'>\n\t\t\t<input type='hidden' name='1_wysiwyg_used' id='1_wysiwyg_used' value='0' />\n\t\t\t<input type='hidden' name='editor_ids[]' value='1' />\n\t\t\t<div class='ips_editor' id='editor_message'>\n\t\t\t\t<div id='message_controls' class='controls'>\n\t\t\t\t\t<ul id='message_toolbar_2' class='toolbar' style='display: none'>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span id='message_cmd_bold' class='rte_control rte_button' title='{$this->lang->words['js_tt_bold']}'><img src='{$this->settings['img_url']}/rte_icons/bold.png' alt='{$this->lang->words['js_tt_bold']}' /></span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span id='message_cmd_italic' class='rte_control rte_button' title='{$this->lang->words['js_tt_italic']}'><img src='{$this->settings['img_url']}/rte_icons/italic.png' alt='{$this->lang->words['js_tt_italic']}' /></span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span id='message_cmd_underline' class='rte_control rte_button' title='{$this->lang->words['js_tt_underline']}'><img src='{$this->settings['img_url']}/rte_icons/underline.png' alt='{$this->lang->words['js_tt_underline']}' /></span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span id='emoticons_custom_menu' class='ipbmenu rte_control rte_button' title='{$this->lang->words['js_tt_emoticons']}'><img src='{$this->settings['img_url']}/rte_icons/emoticons.png' alt='{$this->lang->words['js_tt_emoticons']}' /></span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span id='message_cmd_link' class='rte_control rte_palette' title='{$this->lang->words['js_tt_link']}'><img src='{$this->settings['img_url']}/rte_icons/link.png' alt='{$this->lang->words['js_tt_link']}' /></span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t\t<div id='message_wrap' class='editor'>\n\t\t\t\t\t<textarea name=\"message\" class=\"input_rte\" id=\"message_textarea\" rows=\"3\" cols=\"50\" tabindex=\"0\" maxlength=\"450\"></textarea>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<input type='submit' id='chat-submit' class='input_submit' value='{$this->lang->words['chat_post_button']}' />\n\t\t</form>\n\t</div>\n</div>\n<div id='mod-menu-container'>\n\t" . $this->__f__b9925e475553743bdec6c74675fb1a60($options, $chatters) . "</div>\n<div id='emoticons_custom_menu_menucontent'></div>\n<script type='text/javascript'>\n\tif( \$( 'message_toolbar_2' ) ){ \$( 'message_toolbar_2' ).show(); }\n\tipb.editor_values.get('templates')['link'] = new Template(\"<label for='#{id}_url'>{$this->lang->words['js_template_url']}</label><input type='text' class='input_text' id='#{id}_url' value='http://' tabindex='10' /><label for='#{id}_urltext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_urltext' value='{$this->lang->words['js_template_default']}' tabindex='11' /><input type='submit' value='{$this->lang->words['js_template_insert_link']}' tabindex='12' />\");\n\tipb.editor_values.get('templates')['emoticons_showall'] = new Template(\"<input class='input_submit emoticons' type='button' id='#{id}_all_emoticons' value='{$this->lang->words['show_all_emoticons']}' />\");\n\tipb.editor_values.get('templates')['emoticon_wrapper'] = new Template(\"<h4><span>{$this->lang->words['emoticons_template_title']}</span></h4><div id='#{id}_emoticon_holder' class='emoticon_holder'></div>\");\n\tipb.editor_values.set( 'show_emoticon_link', false );\n\tipb.editor_values.set( 'emoticons', ipb.chat.emoticons );\n\tipb.editor_values.set( 'bbcodes', \$H(" . IPSLib::fetchBbcodeAsJson() . ") );\n\tipb.editors[ 'message' ] = new ipb.editor( 'message', 0 );\n\t/* Load emoticons on the fly ... */\n\tvar _emoticonsLoaded\t= false;\n\t\$('emoticons_custom_menu').observe( 'click', function( e ){ \n\t\tif( !_emoticonsLoaded )\n\t\t{\n\t\t\tnew Ajax.Request( \n\t\t\t\t\t\t\t\tipb.vars['base_url'] + \"&app=ipchat&module=ajax&section=getemoticons&md5check=\" + ipb.vars['secure_hash'], \n\t\t\t\t\t\t\t\t{ \n\t\t\t\t\t\t\t\t\tmethod: 'get',\n\t\t\t\t\t\t\t\t\tonSuccess: function(t)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\$('emoticons_custom_menu_menucontent').update( t.responseText );\n\t\t\t\t\t\t\t\t\t\t_emoticonsLoaded\t= true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t}\n\t});\n\tfunction addEmoImage(elem){\n\t\tvar code = elem.up('tr').down('a').innerHTML;\n\t\tvar title = elem.up('tr').down('img').readAttribute('title');\n\t\tipb.editors[ 'message' ].insert_emoticon('', title, code,'');\n\t}\n</script>\n\t\t\t\n<!--Iframes used for cross-domain \"AJAX\"-->\n<div id='iframeContainer'>\n<div id='storage_container_chatroom' class='storage-container'><ul id='storage_chatroom'></ul></div>\n</div>";
     return $IPBHTML;
 }
예제 #4
0
 /**
  * Toggle side panel on/off without JS
  *
  * @return	@e void
  * @see		The Dark Knight (it was an awesome movie)
  */
 public function _toggleSidePanel()
 {
     /* Security Check */
     if ($this->request['secure_key'] != $this->member->form_hash) {
         $this->registry->output->showError('usercp_forums_bad_key', 102998, null, null, 403);
     }
     $current = IPSCookie::get('hide_sidebar');
     $new = $current ? 0 : 1;
     IPSCookie::set('hide_sidebar', $new);
     $this->registry->getClass('output')->silentRedirect($this->settings['base_url'] . 'act=idx', 'false');
 }
예제 #5
0
 function boardIndexTemplate($lastvisit = "", $stats = array(), $cat_data = array(), $show_side_blocks = true, $side_blocks = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_boards', $this->_funcHooks['boardIndexTemplate'])) {
         $count_3caeb9bb43000ee1df74d49ffc12eae7 = is_array($this->functionData['boardIndexTemplate']) ? count($this->functionData['boardIndexTemplate']) : 0;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['lastvisit'] = $lastvisit;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['stats'] = $stats;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['cat_data'] = $cat_data;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['show_side_blocks'] = $show_side_blocks;
         $this->functionData['boardIndexTemplate'][$count_3caeb9bb43000ee1df74d49ffc12eae7]['side_blocks'] = $side_blocks;
     }
     $this->templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $this->__default__templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $IPBHTML .= "" . (($this->settings['hoverDescriptions'] = 'no') ? "" : "") . "\n" . (($this->settings['removeStatsColumn'] = 'no') ? "" : "") . "\n" . (($this->settings['customForumIcons'] = 'no') ? "" : "") . "\n" . (($this->settings['clickableRows'] = 'yes') ? "" : "") . "" . $this->registry->getClass('output')->addJSModule("board", "0") . "" . (true ? "" : "") . "\n<div id='board_index' class='ipsLayout " . ($this->templateVars['sidebar_enabled'] ? "ipsLayout_withleft" : "") . " ipsLayout_largeleft clearfix " . (IPSCookie::get('hide_sidebar') == '1' ? "no_sidebar" : "") . "'>\n\t" . ($this->templateVars['sidebar_enabled'] ? "<div id='index_stats' class='ipsLayout_left clearfix' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . ">\n" . ($this->settings['show_totals'] ? "\n  <div class='ipsSideBlock clearfix'>\n    <h3><span class='icon icon-span-text icon-block'></span>Статистика форума</h3>\n    <div class='_sbcollapsable'>\n      <ul class='ipsList_data csoStatistics clearfix'>\n        <li class='clearfix'>\n          <span class='value right'>" . $this->registry->getClass('class_localization')->formatNumber($this->caches['stats']['total_topics']) . "</span>\n          <span class='label left'><i class=\"fa fa-comment\"></i> Всего тем</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right'>{$stats['info']['total_posts']}</span>\n          <span class='label left'><i class=\"fa fa-pencil-square-o\"></i> {$this->lang->words['total_posts']}</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right'>{$stats['info']['mem_count']}</span>\n          <span class='label left'><i class=\"fa fa-users\"></i> {$this->lang->words['total_members']}</span>\n        </li>\n        <li class='clearfix'>\n          <span class='value right '>" . IPSMember::makeProfileLink($stats['info']['last_mem_name'], $stats['info']['last_mem_id'], $stats['info']['last_mem_seo'], 'value') . "</span>\n          <span class='label left'><i class=\"fa fa-user\"></i> {$this->lang->words['newest_member']}</span>\n        </li>\n        <li class='clearfix' data-tooltip='{$stats['info']['most_time']}'>\n          <span class='value right'>{$stats['info']['most_online']}</span>\n          <span class='label left'><i class=\"fa fa-signal\"></i> {$this->lang->words['online_at_once']}</span>\n        </li>                                                              \n      </ul>\n    </div>\n  </div>\n" : "") . "\n\t\t\t" . $this->__f__b29a9c9cce830e12603033197489dc70($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t</div>\n\t\t<a href='#' id='toggle_sidebar' title='{$this->lang->words['toggle_sidebar']}' data-closed=\"{$this->lang->words['_laquo']}\" data-open=\"&times;\">&nbsp;</a>" : "") . "\n\t<div id='categories' class='ipsLayout_content clearfix'>\n\t<!-- CATS AND FORUMS -->\n\t\t" . ((is_array($cat_data) and count($cat_data)) ? "\n\t\t\t" . $this->__f__5147475eaba97cbcedc3e8701382c4a7($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t" : "") . "\n\t</div>\n</div>\n<script type='text/javascript'>\n//<![CDATA[\n\tvar markerURL  = ipb.vars['base_url'] + \"app=forums&module=ajax&section=markasread&i=1\"; // Ajax URL so don't use &amp;\n\tvar unreadIcon = \"<img src='{$this->settings['img_url']}/f_icon_read.png' />\";\n\t\n\t" . ((is_array($cat_data) and count($cat_data)) ? "\n\t\t" . $this->__f__a75b64ad1448186d22b780ae5692d94a($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t" : "") . "\n//]]>\n</script>\n<div id='board_statistics' class='statistics clearfix'>\n\t<h4 class='statistics_head clearfix'><ul id='stat_links' class='ipsList_inline right ipsType_small'>\n\t\t" . (1 == 1 ? "<!-- Hook point -->\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats&amp;do=leaders", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_forum_leaders_title']}\">{$this->lang->words['sm_forum_leaders']}</a></li>\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_all_posters_title']}\">{$this->lang->words['sm_today_posters']}</a></li>\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=list&amp;max_results=20&amp;sort_key=posts&amp;sort_order=desc&amp;filter=ALL", "public", ''), "false", "") . "\" title=\"{$this->lang->words['sm_overall_posters_title']}\">{$this->lang->words['sm_overall_posters']}</a></li>\n            " . ($this->settings['reputation_enabled'] ? "<li>\n                    <a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=reputation&amp;section=most", "public", ''), "most_liked", "most_liked") . "\" title=\"" . ($this->settings['reputation_point_types'] == 'like' ? "{$this->lang->words['most_rep_likes']}" : "{$this->lang->words['most_rep_rep']}") . "\">\n                        " . ($this->settings['reputation_point_types'] == 'like' ? "\n                            {$this->lang->words['most_rep_likes']}\n                        " : "\n                            {$this->lang->words['most_rep_rep']}\n                        ") . "\n                    </a>\n                </li>" : "") . "" : "") . "\n\t</ul>\n" . ($this->settings['show_active'] && $this->memberData['gbw_view_online_lists'] ? "" . sprintf($this->lang->words['online_right_now'], $stats['TOTAL']) . " {$this->lang->words['active_users']}" : "") . "</h4>\n\t" . ($this->settings['show_active'] ? "<p class='statistics_brief desc'>\n\t\t" . sprintf($this->lang->words['active_users_detail'], $stats['MEMBERS'], $stats['GUESTS'], $stats['ANON']) . "\n\t\t" . ($this->settings['allow_online_list'] ? "&nbsp;&nbsp;<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_order=desc", "public", ''), "", "") . "' title='{$this->lang->words['online_link']}'>({$this->lang->words['online_link']})</a>" : "") . "\n\t</p>" : "") . "\n\t\n\t" . (count($stats['NAMES']) && $this->settings['show_active'] ? "\n\t\t<br />\n\t\t<p>\n\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $stats['NAMES']) . "</span>\t\t\t\t\t\n\t\t</p>\n\t" : "") . "\n</div>";
     return $IPBHTML;
 }
예제 #6
0
 function boardIndexTemplate($lastvisit = "", $stats = array(), $cat_data = array(), $show_side_blocks = true, $side_blocks = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_boards', $this->_funcHooks['boardIndexTemplate'])) {
         $count_d79a4680f047b95f9c696f93b859d2a2 = is_array($this->functionData['boardIndexTemplate']) ? count($this->functionData['boardIndexTemplate']) : 0;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['lastvisit'] = $lastvisit;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['stats'] = $stats;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['cat_data'] = $cat_data;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['show_side_blocks'] = $show_side_blocks;
         $this->functionData['boardIndexTemplate'][$count_d79a4680f047b95f9c696f93b859d2a2]['side_blocks'] = $side_blocks;
     }
     $this->templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $this->__default__templateVars['sidebar_enabled'] = "{$show_side_blocks}";
     $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("board", "0") . "" . (true ? "" : "") . "\r\n<div id='board_index' class='ipsLayout " . ($this->templateVars['sidebar_enabled'] ? "ipsLayout_withright" : "") . " ipsLayout_largeright clearfix " . (IPSCookie::get('hide_sidebar') == '1' ? "no_sidebar" : "") . "'>\t\r\n\t<div id='categories' class='ipsLayout_content clearfix'>\r\n\t<!-- CATS AND FORUMS -->\r\n\t\t" . ((is_array($cat_data) and count($cat_data)) ? "\r\n\t\t\t" . $this->__f__f3046b4671aec0807f8ac620415036a8($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t" : "") . "\r\n\t</div>\r\n\t" . ($this->templateVars['sidebar_enabled'] ? "<div id='index_stats' class='ipsLayout_right clearfix' " . (IPSCookie::get('hide_sidebar') == '1' ? "style='display: none'" : "") . ">\r\n\t\t\t" . $this->__f__89030e7582e797890a67a50f095f2544($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t\t</div>\r\n\t\t<a href='#' id='toggle_sidebar' title='{$this->lang->words['toggle_sidebar']}' data-closed=\"{$this->lang->words['_laquo']}\" data-open=\"&times;\">&nbsp;</a>" : "") . "\r\n</div>\r\n<script type='text/javascript'>\r\n//<![CDATA[\r\n\tvar markerURL  = ipb.vars['base_url'] + \"app=forums&module=ajax&section=markasread&i=1\"; // Ajax URL so don't use &amp;\r\n\tvar unreadIcon = \"<img src='{$this->settings['img_url']}/f_icon_read.png' />\";\r\n\t\r\n\t" . ((is_array($cat_data) and count($cat_data)) ? "\r\n\t\t" . $this->__f__2d7df5c3f0ad6083957d5ca77bafc27f($lastvisit, $stats, $cat_data, $show_side_blocks, $side_blocks) . "\t" : "") . "\r\n//]]>\r\n</script>\r\n" . ($this->settings['show_totals'] ? "\r\n\t<div id='board_stats'>\t\t\r\n\t\t<ul class='ipsType_small ipsList_inline'>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t<span class='value'>{$stats['info']['total_posts']}</span>\r\n\t\t\t\t{$this->lang->words['total_posts']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t<span class='value'>{$stats['info']['mem_count']}</span>\r\n\t\t\t\t{$this->lang->words['total_members']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear'>\r\n\t\t\t\t" . IPSMember::makeProfileLink($stats['info']['last_mem_name'], $stats['info']['last_mem_id'], $stats['info']['last_mem_seo'], 'value') . "\r\n\t\t\t\t{$this->lang->words['newest_member']}\r\n\t\t\t</li>\r\n\t\t\t<li class='clear' data-tooltip=\"{$stats['info']['most_time']}\">\r\n\t\t\t\t<span class='value'>{$stats['info']['most_online']}</span>\r\n\t\t\t\t{$this->lang->words['online_at_once']}\r\n\t\t\t</li>\r\n\t\t</ul>\r\n\t</div>\r\n" : "") . "\r\n<div id='board_statistics' class='statistics clearfix'>\r\n\t<ul id='stat_links' class='ipsList_inline right ipsType_small'>\r\n\t\t" . (1 == 1 ? "<!-- Hook point -->\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats&amp;do=leaders", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_forum_leaders_title']}\">{$this->lang->words['sm_forum_leaders']}</a></li>\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=stats", "public", ''), "", "") . "\" title=\"{$this->lang->words['sm_all_posters_title']}\">{$this->lang->words['sm_today_posters']}</a></li>\r\n\t\t\t<li><a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=list&amp;max_results=20&amp;sort_key=posts&amp;sort_order=desc&amp;filter=ALL", "public", ''), "false", "") . "\" title=\"{$this->lang->words['sm_overall_posters_title']}\">{$this->lang->words['sm_overall_posters']}</a></li>\r\n\t\t\t" . ($this->settings['reputation_enabled'] ? "<li>\r\n\t\t\t\t\t<a href=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=reputation&amp;section=most", "public", ''), "most_liked", "most_liked") . "\" title=\"" . ($this->settings['reputation_point_types'] == 'like' ? "{$this->lang->words['most_rep_likes']}" : "{$this->lang->words['most_rep_rep']}") . "\">\r\n\t\t\t\t\t\t" . ($this->settings['reputation_point_types'] == 'like' ? "\r\n\t\t\t\t\t\t\t{$this->lang->words['most_rep_likes']}\r\n\t\t\t\t\t\t" : "\r\n\t\t\t\t\t\t\t{$this->lang->words['most_rep_rep']}\r\n\t\t\t\t\t\t") . "\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</li>" : "") . "" : "") . "\r\n\t</ul>\r\n\t\r\n\t" . ($this->settings['show_active'] && $this->memberData['gbw_view_online_lists'] ? "<h4 class='statistics_head'>" . sprintf($this->lang->words['online_right_now'], $stats['TOTAL']) . " {$this->lang->words['active_users']}</h4>\r\n\t\t<p class='statistics_brief desc'>\r\n\t\t\t" . sprintf($this->lang->words['active_users_detail'], $stats['MEMBERS'], $stats['GUESTS'], $stats['ANON']) . "\r\n\t\t\t" . ($this->settings['allow_online_list'] ? "&nbsp;&nbsp;<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=online&amp;sort_order=desc", "public", ''), "", "") . "' title='{$this->lang->words['online_link']}'>({$this->lang->words['online_link']})</a>" : "") . "\r\n\t\t</p>" : "") . "\r\n\t" . (count($stats['NAMES']) && $this->settings['show_active'] ? "\r\n\t\t<br />\r\n\t\t<p>\r\n\t\t\t<span class='name'>" . implode(",</span> <span class='name'>", $stats['NAMES']) . "</span>\r\n\t\t</p>\r\n\t" : "") . "\r\n</div>";
     return $IPBHTML;
 }
예제 #7
0
 /**
  * Check Multi Quote
  * Checks for quoted information
  *
  * @param	string	Any raw post
  * @return	string	Formatted post
  */
 protected function _checkMultiQuote($postContent)
 {
     $raw_post = '';
     if (!$this->request['qpid']) {
         $this->request['qpid'] = IPSCookie::get('mqtids');
         if ($this->request['qpid'] == ",") {
             $this->request['qpid'] = "";
         }
     } else {
         //-----------------------------------------
         // Came from reply button
         //-----------------------------------------
         $this->request['parent_id'] = $this->request['qpid'];
     }
     $this->request['qpid'] = preg_replace('/[^,\\d]/', "", trim($this->request['qpid']));
     /* Load parser */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
     $parser = new $classToLoad();
     if ($this->request['qpid']) {
         $this->quoted_pids = preg_split('/,/', $this->request['qpid'], -1, PREG_SPLIT_NO_EMPTY);
         //-----------------------------------------
         // Get the posts from the DB and ensure we have
         // suitable read permissions to quote them
         //-----------------------------------------
         if (count($this->quoted_pids)) {
             $perm_id = $this->getAuthor('org_perm_id') ? $this->getAuthor('org_perm_id') : $this->getAuthor('g_perm_id');
             $perm_array = explode(",", $perm_id);
             $this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN(" . implode(',', $this->quoted_pids) . ")", 'add_join' => array(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('select' => 'member_id, members_display_name', 'from' => array('members' => 'm'), 'where' => 'p.author_id=m.member_id', 'type' => 'left'))));
             $this->DB->execute();
             while ($tp = $this->DB->fetch()) {
                 $canSee = $this->registry->getClass('topics')->canView($tp);
                 /* Direct quote/reply access */
                 if ($this->request['qpid'] && !$canSee) {
                     $msg = str_replace('EX_', '', $this->registry->getClass('topics')->getErrorMessage());
                     $this->registry->output->showError($msg, 10340, null, null, 404);
                 }
                 if ($canSee === true && $this->registry->permissions->check('read', $this->registry->class_forums->forum_by_id[$tp['forum_id']], $perm_array) === true) {
                     $tmp_post = $tp['post'];
                     $tp['author_name'] = $tp['members_display_name'] ? $tp['members_display_name'] : $tp['author_name'];
                     $tmp_post = $parser->stripSharedMedia($tmp_post);
                     if ($this->settings['strip_quotes']) {
                         $oldPost = $tmp_post;
                         $tmp_post = $parser->stripQuotes($tmp_post);
                         if (!preg_match('#\\S+?#', trim(IPSText::stripTags($tmp_post)))) {
                             $tmp_post = $oldPost;
                         }
                         unset($oldPost);
                     }
                     if ($tmp_post) {
                         $raw_post .= $parser->buildQuoteTag($tmp_post, $tp['author_name'], $tp['post_date'], 0, $tp['pid']);
                     }
                 }
             }
             $raw_post = trim($raw_post) . "<br />";
         }
     }
     //-----------------------------------------
     // Make raw POST safe for the text area
     //-----------------------------------------
     $raw_post .= $postContent;
     return $raw_post;
 }
예제 #8
0
 /**
  * Set current member to the member ID specified
  *
  * @param	integer		Member ID
  * @return	@e void
  */
 public static function setMember($member_id)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval($member_id);
     $addrs = array();
     //-----------------------------------------
     // If we have a member ID, set up the member
     //-----------------------------------------
     if ($member_id) {
         self::$data_store = IPSMember::load($member_id, 'extendedProfile,customFields,groups');
     }
     /* Got a member ID? */
     if (!empty($member_id) && self::$data_store['member_id']) {
         self::setUpMember();
         self::instance()->language_id = self::$data_store['language'];
         # Form hash
         self::instance()->form_hash = md5(self::$data_store['email'] . '&' . self::$data_store['member_login_key'] . '&' . self::$data_store['joined']);
     } else {
         self::$data_store = IPSMember::setUpGuest();
         self::instance()->perm_id = !empty(self::$data_store['org_perm_id']) ? self::$data_store['org_perm_id'] : self::$data_store['g_perm_id'];
         self::instance()->perm_id_array = explode(',', self::instance()->perm_id);
         if (IPSCookie::get('language')) {
             self::instance()->language_id = IPSCookie::get('language');
         }
         # Form hash
         self::instance()->form_hash = md5("this is only here to prevent it breaking on guests");
     }
     /* Get the ignored users */
     if (IPS_AREA == 'public') {
         /* Ok, Fetch ignored users */
         self::instance()->ignored_users = IPSMember::fetchIgnoredUsers(self::$data_store);
     }
     //-----------------------------------------
     // Set member data
     //-----------------------------------------
     self::instance()->member_id = $member_id;
 }
 /**
  * Compare forum pasword
  *
  * @param	integer	$fid	Forum ID
  * @return	bool
  */
 public function forumsComparePassword($fid)
 {
     $cookie_pass = IPSCookie::get('ipbforumpass_' . $fid);
     if (trim($cookie_pass) == md5($this->forum_by_id[$fid]['password'])) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 /**
  * Constructor :: Authorizes the session
  *
  * @access	public
  * @return	mixed		Void normally, but can print error message
  */
 public function __construct()
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->_member = self::instance();
     $this->_memberData =& self::instance()->fetchMemberData();
     /* Delete immediately */
     $this->_deleteNow = true;
     /**
      * If the sso.php file is present in this folder, we'll load it.
      * This file can be used to easily integrate single-sign on in
      * situations where you need to check session data
      */
     if (file_exists(IPS_ROOT_PATH . '/sources/classes/session/sso.php')) {
         require_once IPS_ROOT_PATH . '/sources/classes/session/sso.php';
         if (class_exists("ssoSessionExtension")) {
             $this->sso = new ssoSessionExtension($this->registry);
         }
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cookie = array();
     $this->_userAgent = substr($this->_member->user_agent, 0, 200);
     //-----------------------------------------
     // Fix up app / section / module
     //-----------------------------------------
     $this->current_appcomponent = IPS_APP_COMPONENT;
     $this->current_module = IPSText::alphanumericalClean($this->request['module']);
     $this->current_section = IPSText::alphanumericalClean($this->request['section']);
     $this->settings['session_expiration'] = $this->settings['session_expiration'] ? $this->settings['session_expiration'] : 3600;
     //-----------------------------------------
     // Return as guest if running a task
     //-----------------------------------------
     if (IPS_IS_TASK) {
         self::$data_store = IPSMember::setUpGuest();
         self::$data_store['last_activity'] = time();
         self::$data_store['last_visit'] = time();
         return true;
     }
     //-----------------------------------------
     // no new headers if we're simply viewing an attachment..
     //-----------------------------------------
     if ($this->request['section'] == 'attach') {
         $this->settings['no_print_header'] = 1;
     }
     //-----------------------------------------
     // no new headers if we're updating chat
     //-----------------------------------------
     if (IPS_IS_AJAX && $this->request['section'] != 'login' or $this->request['section'] == 'attach' or $this->request['section'] == 'captcha') {
         $this->settings['no_print_header'] = 1;
         $this->do_update = 0;
     }
     //-----------------------------------------
     // Continue!
     //-----------------------------------------
     $cookie['session_id'] = IPSCookie::get('session_id');
     $cookie['member_id'] = IPSCookie::get('member_id');
     $cookie['pass_hash'] = IPSCookie::get('pass_hash');
     if ($cookie['session_id']) {
         $this->getSession($cookie['session_id']);
         $this->session_type = 'cookie';
     } elseif (isset($this->request['s']) and $this->request['s']) {
         $this->getSession($this->request['s']);
         $this->session_type = 'url';
     } else {
         $this->session_id = 0;
     }
     //-----------------------------------------
     // Do we have a valid session ID?
     //-----------------------------------------
     if ($this->session_id) {
         //-----------------------------------------
         // We've checked the IP addy and browser, so we can assume that this is
         // a valid session.
         //-----------------------------------------
         if ($this->session_user_id != 0 and !empty($this->session_user_id)) {
             //-----------------------------------------
             // It's a member session, so load the member.
             //-----------------------------------------
             self::setMember($this->session_user_id);
             //-----------------------------------------
             // Did we get a member?
             //-----------------------------------------
             if (!self::$data_store['member_id'] or self::$data_store['member_id'] == 0) {
                 $this->_updateGuestSession();
                 /**
                  * If we have an SSO object, run it for the update guest session call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                     $this->sso->checkSSOForGuest('update');
                 }
             } else {
                 $this->_updateMemberSession();
                 /**
                  * If we have an SSO object, run it for the update member call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                     $this->sso->checkSSOForMember('update');
                 }
             }
         } else {
             $this->_updateGuestSession();
             /**
              * If we have an SSO object, run it for the update guest call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('update');
             }
         }
     } else {
         //-----------------------------------------
         // We didn't have a session, or the session didn't validate
         // Do we have cookies stored?
         //-----------------------------------------
         if ($cookie['member_id'] != "" and $cookie['pass_hash'] != "") {
             //-----------------------------------------
             // Load member
             //-----------------------------------------
             self::setMember($cookie['member_id']);
             //-----------------------------------------
             // INIT log in key stuff
             //-----------------------------------------
             $_ok = 1;
             $_days = 0;
             $_sticky = 1;
             $_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
             if (!self::$data_store['member_id'] or self::$data_store['member_id'] == 0) {
                 $this->_createGuestSession();
                 /**
                  * If we have an SSO object, run it for the create guest call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                     $this->sso->checkSSOForGuest('create');
                 }
             } else {
                 if (self::$data_store['member_login_key'] == $cookie['pass_hash']) {
                     //-----------------------------------------
                     // Key expired?
                     //-----------------------------------------
                     if ($this->settings['login_key_expire']) {
                         $_sticky = 0;
                         $_days = $this->settings['login_key_expire'];
                         if (time() > self::$data_store['member_login_key_expire']) {
                             $_ok = 0;
                         }
                     }
                     if ($_ok == 1) {
                         $this->_createMemberSession();
                         /**
                          * If we have an SSO object, run it for the create member call
                          */
                         if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                             $this->sso->checkSSOForMember('create');
                         }
                         //-----------------------------------------
                         // Change the log in key to make each authentication
                         // use a unique token. This means that if a cookie is
                         // stolen, the hacker can only use the auth once.
                         //-----------------------------------------
                         if ($this->settings['login_change_key']) {
                             self::$data_store['member_login_key'] = IPSMember::generateAutoLoginKey();
                             IPSMember::save(self::$data_store['member_id'], array('core' => array('member_login_key' => self::$data_store['member_login_key'], 'member_login_key_expire' => $_time)));
                             IPSCookie::set("pass_hash", self::$data_store['member_login_key'], $_sticky, $_days);
                         }
                     } else {
                         self::setMember(0);
                         $this->_createGuestSession();
                         /**
                          * If we have an SSO object, run it for the create guest call
                          */
                         if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                             $this->sso->checkSSOForGuest('create');
                         }
                     }
                 } else {
                     self::setMember(0);
                     $this->_createGuestSession();
                     /**
                      * If we have an SSO object, run it for the create guest call
                      */
                     if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                         $this->sso->checkSSOForGuest('create');
                     }
                 }
             }
         } else {
             $this->_createGuestSession();
             /**
              * If we have an SSO object, run it for the create guest call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('create');
             }
         }
     }
     //-----------------------------------------
     // Knock out Google Web Accelerator
     //-----------------------------------------
     if (ipsRegistry::$settings['disable_prefetching']) {
         if (my_getenv('HTTP_X_MOZ') and strstr(strtolower(my_getenv('HTTP_X_MOZ')), 'prefetch') and self::$data_store['member_id']) {
             if (IPB_PHP_SAPI == 'cgi-fcgi' or IPB_PHP_SAPI == 'cgi') {
                 @header('Status: 403 Forbidden');
             } else {
                 @header('HTTP/1.1 403 Forbidden');
             }
             @header("Cache-Control: no-cache, must-revalidate, max-age=0");
             @header("Expires: 0");
             @header("Pragma: no-cache");
             print "Prefetching or precaching is not allowed. If you have Google Accelerator enabled, please disable";
             exit;
         }
     }
     //-----------------------------------------
     // Still no member id and not a bot?
     //-----------------------------------------
     if (!self::$data_store['member_id'] and !$this->_member->is_not_human) {
         self::setMember(0);
         self::$data_store['last_activity'] = time();
         $this->request['last_visit'] = time();
     }
     //-----------------------------------------
     // Set a session ID cookie
     //-----------------------------------------
     $this->_member->session_type = $this->session_type;
     $this->_member->session_id = $this->session_id;
     IPSCookie::set("session_id", $this->session_id, -1);
 }
 function ips_editor($form_field = "", $initial_content = "", $images_path = "", $rte_mode = 0, $editor_id = 'ed-0', $smilies = '', $allow_sidebar = 1)
 {
     $IPBHTML = "";
     $IPBHTML .= "<!-- RTE ON: {$rte_mode} -->\n" . $this->registry->getClass('output')->addJSModule("editor", "0") . "\n<!--top-->\n<input type='hidden' name='{$editor_id}_wysiwyg_used' id='{$editor_id}_wysiwyg_used' value='0' />\n<input type='hidden' name='editor_ids[]' value='{$editor_id}' />\n" . (($show_sidebar = IPSCookie::get('emoticon_sidebar')) ? "" : "") . "\n<div class='ips_editor " . ($show_sidebar == '1' ? "with_sidebar" : "") . "' id='editor_{$editor_id}'>\n\t<div class='sidebar row1 altrow' id='{$editor_id}_sidebar' " . (IPSCookie::get('emoticon_sidebar') != '1' ? "style='display: none'" : "") . ">\n\t\t<h4><img src='{$this->settings['img_url']}/close_popup.png' alt='{$this->lang->words['icon']}' id='{$editor_id}_close_sidebar' /><span>{$this->lang->words['emoticons_template_title']}</span></h4>\n\t\t<div id='{$editor_id}_emoticon_holder' class='emoticon_holder'></div>\n\t\t<div class='show_all_emoticons' id='{$editor_id}_showall_bar'>\n\t\t\t<input type='button' value='Show All' id='{$editor_id}_showall_emoticons' class='input_submit emoticons' />\n\t\t</div>\n\t</div>\n\t<div id='{$editor_id}_controls' class='controls'>\n\t\t<ul id='{$editor_id}_toolbar_1' class='toolbar' style='display: none'>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_removeformat' class='rte_control rte_button' title='{$this->lang->words['js_tt_noformat']}'><img src='{$this->settings['img_url']}/rte_icons/remove_formatting.png' alt='{$this->lang->words['js_tt_noformat']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_togglesource' class='rte_control rte_button' title='{$this->lang->words['js_tt_htmlsource']}'><img src='{$this->settings['img_url']}/rte_icons/toggle_source.png' alt='{$this->lang->words['js_tt_htmlsource']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_otherstyles' class='rte_control rte_menu rte_special' title='{$this->lang->words['box_other_desc']}' style='display: none'>{$this->lang->words['box_other']}</span>\n\t\t\t</li>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_fontname' class='rte_control rte_menu rte_font' title='{$this->lang->words['box_font_desc']}'>{$this->lang->words['box_font']}</span>\n\t\t\t</li>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_fontsize' class='rte_control rte_menu rte_fontsize' title='{$this->lang->words['box_size_desc']}'>{$this->lang->words['box_size']}</span>\n\t\t\t</li>\n\t\t\t<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_forecolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_font_col']}'><img src='{$this->settings['img_url']}/rte_icons/font_color.png' alt='{$this->lang->words['js_tt_font_col']}' /></span>\n\t\t\t</li>\n\t\t\t<!--<li class='left'>\n\t\t\t\t<span id='{$editor_id}_cmd_backcolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_back_col']}'><img src='{$this->settings['img_url']}/rte_icons/background_color.png' alt='{$this->lang->words['js_tt_back_col']}' /></span>\n\t\t\t</li>-->\n\t\t\t\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_spellcheck' class='rte_control rte_button' title='{$this->lang->words['js_tt_spellcheck']}'><img src='{$this->settings['img_url']}/rte_icons/spellcheck.png' alt='{$this->lang->words['js_tt_spellcheck']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_r_small' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizesmall']}'><img src='{$this->settings['img_url']}/rte_icons/resize_small.png' alt='{$this->lang->words['js_tt_resizesmall']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_r_big' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizebig']}'><img src='{$this->settings['img_url']}/rte_icons/resize_big.png' alt='{$this->lang->words['js_tt_resizebig']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_help' class='rte_control rte_button' title='{$this->lang->words['js_tt_help']}'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=forums&amp;module=extras&amp;section=legends&amp;do=bbcode", 'public', ''), "", "") . "' title='{$this->lang->words['js_tt_help']}'><img src='{$this->settings['img_url']}/rte_icons/help.png' alt='{$this->lang->words['js_tt_help']}' /></a></span>\n\t\t\t</li>\t\t\t\n\t\t\t<li class='right sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_undo' class='rte_control rte_button' title='{$this->lang->words['js_tt_undo']}'><img src='{$this->settings['img_url']}/rte_icons/undo.png' alt='{$this->lang->words['js_tt_undo']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_redo' class='rte_control rte_button' title='{$this->lang->words['js_tt_redo']}'><img src='{$this->settings['img_url']}/rte_icons/redo.png' alt='{$this->lang->words['js_tt_redo']}' /></span>\n\t\t\t</li>\n\t\t\t\n\t\t" . ($this->settings['posting_allow_rte'] == 1 ? "\n\t\t\t<li class='right'>\n\t\t\t\t<!--<span id='{$editor_id}_cmd_switcheditor' class='rte_control rte_button' title='{$this->lang->words['js_tt_switcheditor']}'><img src='{$this->settings['img_url']}/rte_icons/switch.png' alt='{$this->lang->words['js_tt_switcheditor']}' /></span>-->\n\t\t\t</li>\n\t\t" : "") . "\n\t\t</ul>\n\t\t<ul id='{$editor_id}_toolbar_2' class='toolbar' style='display: none'>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_bold' class='rte_control rte_button' title='{$this->lang->words['js_tt_bold']}'><img src='{$this->settings['img_url']}/rte_icons/bold.png' alt='{$this->lang->words['js_tt_bold']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_italic' class='rte_control rte_button' title='{$this->lang->words['js_tt_italic']}'><img src='{$this->settings['img_url']}/rte_icons/italic.png' alt='{$this->lang->words['js_tt_italic']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_underline' class='rte_control rte_button' title='{$this->lang->words['js_tt_underline']}'><img src='{$this->settings['img_url']}/rte_icons/underline.png' alt='{$this->lang->words['js_tt_underline']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_strikethrough' class='rte_control rte_button' title='{$this->lang->words['js_tt_strike']}'><img src='{$this->settings['img_url']}/rte_icons/strike.png' alt='{$this->lang->words['js_tt_strike']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_subscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sub']}'><img src='{$this->settings['img_url']}/rte_icons/subscript.png' alt='{$this->lang->words['js_tt_sub']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_superscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sup']}'><img src='{$this->settings['img_url']}/rte_icons/superscript.png' alt='{$this->lang->words['js_tt_sup']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_insertunorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/unordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_insertorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/ordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>\n\t\t\t</li>\t\t\t\n\t\t" . ($this->settings['_remove_emoticons'] == 0 ? "\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_emoticons' class='rte_control rte_button' title='{$this->lang->words['js_tt_emoticons']}'><img src='{$this->settings['img_url']}/rte_icons/emoticons.png' alt='{$this->lang->words['js_tt_emoticons']}' /></span>\n\t\t\t</li>\n\t\t" : "") . "\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_link' class='rte_control rte_palette' title='{$this->lang->words['js_tt_link']}'><img src='{$this->settings['img_url']}/rte_icons/link.png' alt='{$this->lang->words['js_tt_link']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_image' class='rte_control rte_palette' title='{$this->lang->words['js_tt_image']}'><img src='{$this->settings['img_url']}/rte_icons/picture.png' alt='{$this->lang->words['js_tt_image']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_email' class='rte_control rte_palette' title='{$this->lang->words['js_tt_email']}'><img src='{$this->settings['img_url']}/rte_icons/email.png' alt='{$this->lang->words['js_tt_email']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_ipb_quote' class='rte_control rte_button' title='{$this->lang->words['js_tt_quote']}'><img src='{$this->settings['img_url']}/rte_icons/quote.png' alt='{$this->lang->words['js_tt_quote']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_ipb_code' class='rte_control rte_button' title='{$this->lang->words['js_tt_code']}'><img src='{$this->settings['img_url']}/rte_icons/code.png' alt='{$this->lang->words['js_tt_code']}' /></span>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<span id='{$editor_id}_cmd_media' class='rte_control rte_palette' title='{$this->lang->words['js_tt_media']}'><img src='{$this->settings['img_url']}/rte_icons/media.png' alt='{$this->lang->words['js_tt_media']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_justifyright' class='rte_control rte_button' title='{$this->lang->words['js_tt_right']}'><img src='{$this->settings['img_url']}/rte_icons/align_right.png' alt='{$this->lang->words['js_tt_right']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_justifycenter' class='rte_control rte_button' title='{$this->lang->words['js_tt_center']}'><img src='{$this->settings['img_url']}/rte_icons/align_center.png' alt='{$this->lang->words['js_tt_center']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_justifyleft' class='rte_control rte_button' title='{$this->lang->words['js_tt_left']}'><img src='{$this->settings['img_url']}/rte_icons/align_left.png' alt='{$this->lang->words['js_tt_left']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right sep'>\n\t\t\t\t<span id='{$editor_id}_cmd_indent' class='rte_control rte_button' title='{$this->lang->words['js_tt_indent']}'><img src='{$this->settings['img_url']}/rte_icons/indent.png' alt='{$this->lang->words['js_tt_indent']}' /></span>\n\t\t\t</li>\n\t\t\t<li class='right'>\n\t\t\t\t<span id='{$editor_id}_cmd_outdent' class='rte_control rte_button' title='{$this->lang->words['js_tt_outdent']}'><img src='{$this->settings['img_url']}/rte_icons/outdent.png' alt='{$this->lang->words['js_tt_outdent']}' /></span>\n\t\t\t</li>\n\t\t</ul>\n\t</div>\n\t<div id='{$editor_id}_wrap' class='editor'>\n\t\t<textarea name=\"{$form_field}\" class=\"input_rte\" id=\"{$editor_id}_textarea\" rows=\"10\" cols=\"60\" tabindex=\"0\">{$initial_content}</textarea>\n\t</div>\n</div>\n\t\n<!-- Toolpanes -->\n<script type=\"text/javascript\">\n//<![CDATA[\n\$('{$editor_id}_toolbar_1').show();\n\$('{$editor_id}_toolbar_2').show();\n// Rikki: Had to remove <form>... </form> because Opera would see </form> and not pass the topic icons / hidden fields properly. Tried \"</\" + \"form>\" but when it is parsed, it had the same affect\nipb.editor_values.get('templates')['link'] = new Template(\"<label for='#{id}_url'>{$this->lang->words['js_template_url']}</label><input type='text' class='input_text' id='#{id}_url' value='http://' tabindex='10' /><label for='#{id}_urltext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_urltext' value='{$this->lang->words['js_template_default']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_link']}' tabindex='12' />\");\nipb.editor_values.get('templates')['image'] = new Template(\"<label for='#{id}_img'>{$this->lang->words['js_template_imageurl']}</label><input type='text' class='input_text' id='#{id}_img' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_img']}' tabindex='11' />\");\nipb.editor_values.get('templates')['email'] = new Template(\"<label for='#{id}_email'>{$this->lang->words['js_template_email_url']}</label><input type='text' class='input_text' id='#{id}_email' tabindex='10' /><label for='#{id}_emailtext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_emailtext' value='{$this->lang->words['js_template_email_me']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_email']}' tabindex='12' />\");\nipb.editor_values.get('templates')['media'] = new Template(\"<label for='#{id}_media'>{$this->lang->words['js_template_media_url']}</label><input type='text' class='input_text' id='#{id}_media' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_media']}' tabindex='11' />\");\nipb.editor_values.get('templates')['generic'] = new Template(\"<div class='rte_title'>#{title}</div><strong>{$this->lang->words['js_template_example']}</strong><pre>#{example}</pre><label for='#{id}_option' class='optional'>#{option_text}</label><input type='text' class='input_text optional' id='#{id}_option' tabindex='10' /><label for='#{id}_text' class='tagcontent'>#{value_text}</label><textarea class='input_text _select tagcontent' id='#{id}_text' tabindex='11' rows='4' cols='30' style='width: 98%' /></textarea><input type='submit' class='input_submit' value='{$this->lang->words['js_template_add']}' tabindex='12' />\");\nipb.editor_values.get('templates')['toolbar'] = new Template(\"<ul id='#{id}_toolbar_#{toolbarid}' class='toolbar' style='display: none'>#{content}</ul>\");\nipb.editor_values.get('templates')['button'] = new Template(\"<li><span id='#{id}_cmd_custom_#{cmd}' class='rte_control rte_button specialitem' title='#{title}'><img src='{$this->settings['img_url']}/rte_icons/#{img}' alt='{$this->lang->words['icon']}' /></span></li>\");\nipb.editor_values.get('templates')['menu_item'] = new Template(\"<li id='#{id}_cmd_custom_#{cmd}' class='specialitem clickable'>#{title}</li>\");\nipb.editor_values.get('templates')['togglesource'] = new Template(\"<fieldset id='#{id}_ts_controls' class='submit' style='text-align: left'><input type='button' class='input_submit' value='{$this->lang->words['js_template_update']}' id='#{id}_ts_update' />&nbsp;&nbsp;&nbsp; <a href='#' id='#{id}_ts_cancel' class='cancel'>{$this->lang->words['js_template_cancel_source']}</a></fieldset>\");\nipb.editor_values.get('templates')['emoticons_showall'] = new Template(\"<input class='input_submit emoticons' type='button' id='#{id}_all_emoticons' value='{$this->lang->words['show_all_emoticons']}' />\");\nipb.editor_values.get('templates')['emoticon_wrapper'] = new Template(\"<h4><span>{$this->lang->words['emoticons_template_title']}</span></h4><div id='#{id}_emoticon_holder' class='emoticon_holder'></div>\");\n// Add smilies into the mix\nipb.editor_values.set( 'show_emoticon_link', " . ($allow_sidebar ? "true" : "false") . " );\nipb.editor_values.set( 'emoticons', \$H({ {$smilies} }) );\nipb.editor_values.set( 'bbcodes', \$H(" . IPSLib::fetchBbcodeAsJson() . ") );\nipb.vars['emoticon_url'] = \"{$this->settings['emoticons_url']}\";\nipb.editors[ '{$editor_id}' ] = new ipb.editor( '{$editor_id}', USE_RTE );\n//]]>\n</script>";
     return $IPBHTML;
 }
예제 #12
0
 function registerForm($general_errors = array(), $data = array(), $inline_errors = array(), $time_select = array(), $custom_fields = array(), $nexusFields = array(), $nexusStates = array())
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_register', $this->_funcHooks['registerForm'])) {
         $count_cddbc826bab17032ea84f409e00836ae = is_array($this->functionData['registerForm']) ? count($this->functionData['registerForm']) : 0;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['general_errors'] = $general_errors;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['data'] = $data;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['inline_errors'] = $inline_errors;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['time_select'] = $time_select;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['custom_fields'] = $custom_fields;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['nexusFields'] = $nexusFields;
         $this->functionData['registerForm'][$count_cddbc826bab17032ea84f409e00836ae]['nexusStates'] = $nexusStates;
     }
     $IPBHTML .= "" . ($this->settings['use_coppa'] && (!$this->request['coppa'] && !IPSCookie::get('coppa')) ? "\n\t" . (method_exists($this->registry->getClass('output')->getTemplate('register'), 'registerCoppaStart') ? $this->registry->getClass('output')->getTemplate('register')->registerCoppaStart() : '') . "\n" : "" . (!$this->request['agree_tos'] ? "\n\t\t<div class='master_list'>\n\t\t\t<h2>{$this->lang->words['reg_terms_popup_title']}</h2>\n\t\t\t<div class='row post line_spacing'>\n\t\t\t\t{$this->settings['_termsAndConditions']}\n\t\t\t</div>\n\t\t\t<div class='submit'>\n\t\t\t\t<a class='button secondary' href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register&amp;agree_tos=1", "public", ''), "", "") . "'>{$this->lang->words['mobile_agree_to_tos']}</a>\n\t\t\t</div>\n\t\t</div>\n\t" : "<div class='master_list'>\n\t\t\t<h2>{$this->lang->words['register']}</h2>\n\t\t\t" . (is_array($general_errors) && count($general_errors) ? "\n\t\t\t\t<div class='message error'>\n\t\t\t\t\t<strong>{$this->lang->words['following_errors']}</strong><br />\n\t\t\t\t\t" . $this->__f__19d06e799ceca51592bbfcc7cc259515($general_errors, $data, $inline_errors, $time_select, $custom_fields, $nexusFields, $nexusStates) . "\t\t\t\t</div>\n\t\t\t" : "") . "\n\t\n\t\t\t<form class='ipsForm_vertical' action=\"" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register", "public", ''), "", "") . "\" method=\"post\" name=\"REG\" id='register'>\n\t\t\t\t<input type=\"hidden\" name=\"termsread\" value=\"1\" />\n\t\t\t\t<input type=\"hidden\" name=\"agree_to_terms\" value=\"1\" />\n\t\t\t\t<input type=\"hidden\" name=\"agree_tos\" value=\"1\" />\n\t\t\t\t<input type=\"hidden\" name=\"do\" value=\"process_form\" />\n\t\t\t\t<input type=\"hidden\" name=\"coppa_user\" value=\"{$data['coppa_user']}\" />\n\t\t\t\t<input type='hidden' name='nexus_pass' value='1' />\n\t\t\n\t\t\t\t<h3>{$this->lang->words['reg_step1']}</h3>\n\t\t\t\t<div class='ipsField'>\n\t\t\t\t\t<label for='display_name' class='ipsField_title'>{$this->lang->words['reg_choose_dname']}</label>\n\t\t\t\t\t<input type='text' class='input_text " . ($inline_errors['dname'] ? "error" : "") . "' id='display_name' size='30' maxlength='{$this->settings['max_user_name_length']}' value='{$this->request['members_display_name']}' name='members_display_name' /><br />\n\t\t\t\t\t<span class='desc'>" . ($inline_errors['dname'] ? "<span class='error'>{$inline_errors['dname']}<br /></span>" : "") . "" . sprintf($this->lang->words['dname_desc'], $this->settings['max_user_name_length']) . "</span>\n\t\t\t\t</div>\n\t\t\n\t\t\t\t<div class='ipsField'>\n\t\t\t\t\t<label for='email_1' class='ipsField_title'>{$this->lang->words['reg_enter_email']}</label>\n\t\t\t\t\t<input type='text' id='email_1' class='input_text email " . ($inline_errors['email'] ? "error" : "") . "' size='30' maxlength='150' name='EmailAddress' value='{$this->request['EmailAddress']}' /><br />\n\t\t\t\t\t<span class='desc'>" . ($inline_errors['email'] ? "<span class='error'>{$inline_errors['email']}<br /></span>" : "") . "{$this->lang->words['reg_enter_email_desc']}</span>\n\t\t\t\t</div>\n\t\n\t\t\n\t\t\t\t<div class='ipsField'>\n\t\t\t\t\t<label for='password_1' class='ipsField_title'>{$this->lang->words['reg_choose_password']}</label>\n\t\t\t\t\t<input type='password' id='password_1' class='input_text password " . ($inline_errors['password'] ? "error" : "") . "' size='30' maxlength='32' value='{$this->request['PassWord']}' name='PassWord' /><br />\n\t\t\t\t\t<span class='desc'>" . ($inline_errors['password'] ? "<span class='error'>{$inline_errors['password']}<br /></span>" : "") . "{$this->lang->words['reg_choose_password_desc']}</span>\n\t\t\t\t</div>\n\t\t\n\t\t\t\t<div class='ipsField'>\n\t\t\t\t\t<label for='password_2' class='ipsField_title'>{$this->lang->words['reg_reenter_password']}</label>\n\t\t\t\t\t<input type='password' id='password_2' class='input_text password' size='30' maxlength='32' value='{$this->request['PassWord_Check']}' name='PassWord_Check' />\n\t\t\t\t</div>\n\t\t\n\t\t\t\t" . (is_array($custom_fields['required']) && count($custom_fields['required']) || is_array($custom_fields['optional']) && count($custom_fields['optional']) ? "<div class='row line_spacing'>\n\t\t\t\t\t\t" . (is_array($custom_fields['required']) && count($custom_fields['required']) ? "\n\t\t\t\t\t\t\t" . $this->__f__b992a2c8c4e8170e08721054c6f36ab3($general_errors, $data, $inline_errors, $time_select, $custom_fields, $nexusFields, $nexusStates) . "\t\t\t\t\t\t" : "") . "\n\t\t\t\t\n\t\t\t\t\t\t" . (is_array($custom_fields['optional']) && count($custom_fields['optional']) ? "\n\t\t\t\t\t\t\t" . $this->__f__c270991a3640ceae9340642786f02629($general_errors, $data, $inline_errors, $time_select, $custom_fields, $nexusFields, $nexusStates) . "\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t<!--IBF.MODULES.EXTRA-->\n\t\t\t\t\t</div>" : "") . "\n\t\t\n\t\t\t\t" . ($data['captchaHTML'] || $data['qandaHTML'] ? "\n\t\t\t\t\t<h3>{$this->lang->words['reg_step3_spam']}</h3>\n\t\t\t\t\t{$data['qandaHTML']}\n\t\t\t\t\t{$data['captchaHTML']}\n\t\t\t\t" : "") . "\n\t\t\t\n\t\t\t\t<div class='ipsField ipsField_checkbox'>\n\t\t\t\t\t<input type=\"checkbox\" name=\"allow_admin_mail\" id=\"allow_admin_mail\" value=\"1\" class=\"input_check\" " . ($this->request['allow_admin_mail'] || !isset($this->request['allow_admin_mail']) ? "checked='checked'" : "") . " />\n\t\t\t\t\t<p class='ipsField_content'>{$this->lang->words['receive_admin_emails']}</p>\n\t\t\t\t</div>\n\t\t\t\t<div class='submit'>\n\t\t\t\t\t<input type='submit' class='button' value='{$this->lang->words['register']}' />\n\t\t\t\t</div>\n\t\t\t</form>\n\t\n\t\t</div>") . "") . "";
     return $IPBHTML;
 }
 /**
  * Displays the registration form
  *
  * @access	public
  * @param	array 	$form_errors
  * @return	void
  */
 public function registerForm($form_errors = array())
 {
     /* INIT */
     $final_errors = array();
     if ($this->settings['no_reg'] == 1) {
         $this->registry->output->showError('registration_disabled', 10123);
     }
     $coppa = IPSCookie::get('coppa');
     if ($coppa == 'yes') {
         $this->registry->output->showError('awaiting_coppa', 10124);
     }
     $this->settings['username_errormsg'] = str_replace('{chars}', $this->settings['username_characters'], $this->settings['username_errormsg']);
     /* Read T&Cs yet? */
     if (!$this->request['termsread']) {
         if ($this->memberData['member_id']) {
             require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
             $this->han_login = new han_login($this->registry);
             $this->han_login->init();
             //-----------------------------------------
             // Set some cookies
             //-----------------------------------------
             IPSCookie::set("member_id", "0");
             IPSCookie::set("pass_hash", "0");
             IPSCookie::set("anonlogin", "-1");
             if (is_array($_COOKIE)) {
                 foreach ($_COOKIE as $cookie => $value) {
                     if (stripos($cookie, $this->settings['cookie_id'] . "ipbforum") !== false) {
                         IPSCookie::set(str_replace($this->settings['cookie_id'], "", $match[0]), '-', -1);
                     }
                 }
             }
             //-----------------------------------------
             // Logout callbacks...
             //-----------------------------------------
             $this->han_login->logoutCallback();
             //-----------------------------------------
             // Do it..
             //-----------------------------------------
             $this->member->sessionClass()->convertMemberToGuest();
             list($privacy, $loggedin) = explode('&', $this->memberData['login_anonymous']);
             IPSMember::save($this->memberData['member_id'], array('core' => array('login_anonymous' => "{$privacy}&0", 'last_activity' => time())));
         }
         /* Continue */
         $cache = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'"));
         $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
         /* Load the Parser */
         IPSText::getTextClass('bbcode')->bypass_badwords = 1;
         IPSText::getTextClass('bbcode')->parse_smilies = 1;
         IPSText::getTextClass('bbcode')->parse_html = 1;
         IPSText::getTextClass('bbcode')->parse_bbcode = 1;
         IPSText::getTextClass('bbcode')->parsing_section = 'global';
         $text = IPSText::getTextClass('bbcode')->preDbParse($text);
         $text = IPSText::getTextClass('bbcode')->preDisplayParse($text);
         $this->registry->output->setTitle($this->lang->words['registration_form']);
         $this->registry->output->addNavigation($this->lang->words['registration_form'], '');
         $this->output .= $this->registry->output->getTemplate('register')->registerShowTerms($text, $coppa);
         return;
     } else {
         /* Did we agree to the t&c? */
         if (!$this->request['agree_to_terms']) {
             $this->registry->output->showError('must_agree_to_terms', 10125);
         }
     }
     /* Do we have another URL that one needs to visit to register? */
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         if ($r['login_register_url']) {
             $this->registry->output->silentRedirect($r['login_register_url']);
             exit;
         }
     }
     /* Continue... */
     if ($this->settings['reg_auth_type']) {
         if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['email_validate_text'];
         }
         /* User then admin? */
         if ($this->settings['reg_auth_type'] == 'admin_user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['user_admin_validation'];
         }
         if ($this->settings['reg_auth_type'] == 'admin') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['just_admin_validation'];
         }
     }
     $captchaHTML = '';
     $qandaHTML = '';
     $this->cache->updateCacheWithoutSaving('_hasStep3', 0);
     /* Q and A Challenge */
     if ($this->settings['registration_qanda']) {
         // Grab a random question...
         $question = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'order' => 'rand()', 'limit' => array(1)));
         if (count($question)) {
             $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer($question);
         }
     }
     /* Custom Profile Fields */
     $custom_fields_out = array('required', 'optional');
     require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
     $custom_fields = new customProfileFields();
     $custom_fields->member_data = $member;
     $custom_fields->initData('edit');
     $custom_fields->parseToEdit('register');
     if (count($custom_fields->out_fields)) {
         $this->cache->updateCacheWithoutSaving('_hasStep3', 1);
         foreach ($custom_fields->out_fields as $id => $form_element) {
             if ($custom_fields->cache_data[$id]['pf_not_null'] == 1) {
                 $ftype = 'required';
             } else {
                 $ftype = 'optional';
             }
             $custom_fields_out[$ftype][] = array('name' => $custom_fields->field_names[$id], 'desc' => $custom_fields->field_desc[$id], 'field' => $form_element, 'id' => $id, 'error' => $error, 'type' => $custom_fields->cache_data[$id]['pf_type']);
         }
     }
     /* CAPTCHA */
     if ($this->settings['bot_antispam']) {
         $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
     }
     $this->registry->output->setTitle($this->lang->words['registration_form']);
     $this->registry->output->addNavigation($this->lang->words['registration_form'], '');
     /* Other errors */
     $final_errors = array('username' => NULL, 'dname' => NULL, 'password' => NULL, 'email' => NULL);
     foreach (array('username', 'dname', 'password', 'email') as $thing) {
         if (isset($form_errors[$thing]) and is_array($form_errors[$thing]) and count($form_errors[$thing])) {
             $final_errors[$thing] = implode("<br />", $form_errors[$thing]);
         }
     }
     $this->request['UserName'] = $this->request['UserName'] ? $this->request['UserName'] : '';
     $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '';
     $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '';
     $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '';
     $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '';
     $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '';
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '';
     $this->request['allow_member_mail'] = $this->request['allow_member_mail'] ? $this->request['allow_member_mail'] : '';
     $this->request['dst'] = $this->request['dst'] ? $this->request['dst'] : '';
     /* Time zone... */
     $this->registry->class_localization->loadLanguageFile(array('public_usercp'), 'core');
     $time_select = array();
     foreach ($this->lang->words as $k => $v) {
         if (strpos($k, "time_") === 0) {
             $k = str_replace("time_", '', $k);
             if (preg_match("/^[\\-\\d\\.]+\$/", $k)) {
                 $time_select[$k] = $v;
             }
         }
     }
     ksort($time_select);
     /* set default.. */
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : $this->settings['time_offset'];
     /* Need username? */
     $uses_name = false;
     foreach ($this->cache->getCache('login_methods') as $method) {
         if ($method['login_user_id'] == 'username') {
             $uses_name = true;
         }
     }
     /* Get form HTML */
     $this->output .= $this->registry->output->getTemplate('register')->registerForm($form_errors['general'], array('TEXT' => $this->lang->words['std_text'], 'coppa_user' => $coppa, 'captchaHTML' => $captchaHTML, 'qandaHTML' => $qandaHTML, 'requireName' => $uses_name), $final_errors, $time_select, $custom_fields_out);
     /* Run the member sync module */
     IPSLib::runMemberSync('onRegisterForm');
 }
예제 #14
0
 /**
  * Log a user out
  *
  * @param	integer		Flag to check md5 key
  * @return	mixed		Error message or array [0=immediate|redirect, 1=words to show, 2=URL to send to]
  */
 public function doLogout($check_key = true)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     if ($check_key) {
         $key = $this->request['k'];
         # Check for funny business
         if ($key != $this->member->form_hash) {
             $this->registry->getClass('output')->showError('bad_logout_key', 2012);
         }
     }
     //-----------------------------------------
     // Set some cookies
     //-----------------------------------------
     IPSCookie::set("member_id", "0", 1, 0, FALSE, TRUE);
     IPSCookie::set("pass_hash", "0", 1, 0, FALSE, TRUE);
     if (IPSCookie::get("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'))) {
         IPSCookie::set("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'), '0', 1, 0, FALSE, FALSE);
     }
     //-----------------------------------------
     // IPS Connect
     //-----------------------------------------
     foreach ($this->caches['login_methods'] as $k => $data) {
         if ($data['login_folder_name'] == 'ipsconnect' and $data['login_enabled']) {
             $ipsConnectSettings = unserialize($data['login_custom_config']);
             IPSCookie::set("ipsconnect_" . md5($ipsConnectSettings['master_url']), '0', 1, 0, FALSE, FALSE);
         }
     }
     if (is_array($_COOKIE)) {
         foreach ($_COOKIE as $cookie => $value) {
             if (stripos($cookie, $this->settings['cookie_id'] . 'ipbforumpass') !== false and !strstr($value, 'mobileApp')) {
                 IPSCookie::set(str_replace($this->settings['cookie_id'], "", $cookie), '-', -1);
             }
         }
     }
     //-----------------------------------------
     // Do it..
     //-----------------------------------------
     $this->member->sessionClass()->convertMemberToGuest();
     $privacy = intval(IPSMember::isLoggedInAnon($this->memberData));
     IPSMember::save($this->memberData['member_id'], array('core' => array('login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW)));
     //-----------------------------------------
     // Logout callbacks...
     //-----------------------------------------
     IPSLib::runMemberSync('onLogOut', $this->memberData);
     $this->han_login->logoutCallback($this->memberData);
     //-----------------------------------------
     // Return..
     //-----------------------------------------
     $url = "";
     if ($this->request['return'] and $this->request['return'] != "") {
         $return = urldecode($this->request['return']);
         if (strpos($return, "http://") === 0) {
             return array('immediate', '', $return);
         }
     }
     return array('redirect', $this->lang->words['thanks_for_logout'], $this->settings['board_url']);
 }
 function registerCoppaStart()
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_register', $this->_funcHooks['registerCoppaStart'])) {
         $count_3eafce7c341045eb32531a207fe147aa = is_array($this->functionData['registerCoppaStart']) ? count($this->functionData['registerCoppaStart']) : 0;
     }
     $IPBHTML .= "" . ($this->settings['use_coppa'] && (!$this->request['coppa'] && !IPSCookie::get('coppa')) ? "\n<div class='post_form' id='coppa_form'>\n\t<fieldset class='general_box'>\n\t\t<h3>{$this->lang->words['coppa_info']}</h3>\n\t\t<div class='ipsPad'>\n\t\t\t{$this->lang->words['confirm_over_thirteen']}\n\t\t</div>\n\t\t<div class='ipsPad ipsForm_center'>\n\t\t\t<form>\n\t\t\t<select name='month' id='coppa_bday_m'>\n\t\t\t\t" . $this->__f__31289532bb29664f292237ebeb94fedb() . "\t\t\t</select>\n\t\t\t&nbsp;\n\t\t\t<select name='day' id='coppa_bday_d'>\n\t\t\t\t" . $this->__f__4e3f5a71c65d7d600e3d4aced376270e() . "\t\t\t</select>\n\t\t\t&nbsp;\n\t\t\t<select name='year' id='coppa_bday_y'>\n\t\t\t\t" . $this->__f__bbfa142154b328986bcce1b3c0f0b237() . "\t\t\t</select>\n\t\t\t</form>\n\t\t</div>\n\t</fieldset>\n\t<fieldset class='ipsForm_submit ipsForm_right'>\n\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register&amp;do=coppa_two&amp;coppa=1", "public", ''), "", "") . "' id='confirm_coppa' class='ipsButton'>{$this->lang->words['coppa_continue_button']}</a>\n\t</fieldset>\n</div>\n<script type='text/javascript'>\n\t\$('coppa_form').hide();\n\t\n\tfunction validateDate( popup )\n\t{\n\t\tvar day\t\t= parseInt(\$('coppa_bday_d').value);\n\t\tvar month\t= parseInt(\$('coppa_bday_m').value);\n\t\tvar year\t= parseInt(\$('coppa_bday_y').value);\n\t\tvar compare\t\t= Math.round( new Date( year + 13, month - 1, day ).getTime() / 1000 );\n\t\tvar today\t\t= Math.round( new Date().getTime() / 1000 );\n\t\tif ( (today - compare) < 0 )\n\t\t{\n\t\t\twindow.location = ipb.vars['base_url'] + \"app=core&module=global&section=register&do=coppa_two\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpopup.hide();\n\t\t\tipb.Cookie.set('coppa', 'no', true);\n\t\t}\n\t}\n\t\n\tipb.vars['coppa_popup'] = new ipb.Popup( 'coppa_popup', {\ttype: 'pane',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinitial: \$('coppa_form').show(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thideAtStart: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thideClose: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefer: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tw: '550px' },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tafterInit: function( popup ){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpopup.getObj().select(\"#confirm_coppa\")[0].observe('click', function(e){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tEvent.stop(e);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn validateDate( popup );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n</script>\n" : "") . "";
     return $IPBHTML;
 }
 /**
  * Topic set up ya'll
  *
  * @access	public
  * @return	void
  **/
 public function topicSetUp()
 {
     //-----------------------------------------
     // Memory...
     //-----------------------------------------
     $_before = IPSDebug::getMemoryDebugFlag();
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['start'] = !empty($this->request['start']) ? intval($this->request['start']) : '';
     $this->request['st'] = !empty($this->request['st']) ? intval($this->request['st']) : '';
     //-----------------------------------------
     // Compile the language file
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_boards', 'public_topic'));
     $this->registry->class_localization->loadLanguageFile(array('public_editors'), 'core');
     //-----------------------------------------
     // Get all the member groups and
     // member title info
     //-----------------------------------------
     if (!is_array($this->cache->getCache('ranks'))) {
         $this->cache->rebuildCache('ranks', 'global');
     }
     //-----------------------------------------
     // Are we actually a moderator for this forum?
     //-----------------------------------------
     if (!$this->memberData['g_is_supmod']) {
         $moderator = $this->memberData['forumsModeratorData'];
         if (!isset($moderator[$this->forum['id']]) or !is_array($moderator[$this->forum['id']])) {
             $this->memberData['is_mod'] = 0;
         }
     }
     $this->settings['_base_url'] = $this->settings['base_url'];
     $this->forum['FORUM_JUMP'] = $this->registry->getClass('class_forums')->buildForumJump();
     $this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
     $this->request['view'] = !empty($this->request['view']) ? $this->request['view'] : NULL;
     //-----------------------------------------
     // Check viewing permissions, private forums,
     // password forums, etc
     //-----------------------------------------
     if (!$this->memberData['g_other_topics'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
         $this->registry->output->showError('topics_not_yours', 10359);
     } else {
         if (!$this->forum['can_view_others'] and !$this->memberData['is_mod'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
             $this->registry->output->showError('topics_not_yours2', 10360);
         }
     }
     //-----------------------------------------
     // Update the topic views counter
     //-----------------------------------------
     if (!$this->request['view'] and $this->topic['state'] != 'link') {
         if ($this->settings['update_topic_views_immediately']) {
             $this->DB->update('topics', 'views=views+1', "tid=" . $this->topic['tid'], true, true);
         } else {
             $this->DB->insert('topic_views', array('views_tid' => $this->topic['tid']), true);
         }
     }
     //-----------------------------------------
     // Need to update this topic?
     //-----------------------------------------
     if ($this->topic['state'] == 'open') {
         if (!$this->topic['topic_open_time'] or $this->topic['topic_open_time'] < $this->topic['topic_close_time']) {
             if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and (time() >= $this->topic['topic_open_time'] or !$this->topic['topic_open_time']))) {
                 $this->topic['state'] = 'closed';
                 $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
             }
         } else {
             if ($this->topic['topic_open_time'] or $this->topic['topic_open_time'] > $this->topic['topic_close_time']) {
                 if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and time() <= $this->topic['topic_open_time'])) {
                     $this->topic['state'] = 'closed';
                     $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
                 }
             }
         }
     } else {
         if ($this->topic['state'] == 'closed') {
             if (!$this->topic['topic_close_time'] or $this->topic['topic_close_time'] < $this->topic['topic_open_time']) {
                 if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and (time() >= $this->topic['topic_close_time'] or !$this->topic['topic_close_time']))) {
                     $this->topic['state'] = 'open';
                     $this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
                 }
             } else {
                 if ($this->topic['topic_close_time'] or $this->topic['topic_close_time'] > $this->topic['topic_open_time']) {
                     if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and time() <= $this->topic['topic_close_time'])) {
                         $this->topic['state'] = 'open';
                         $this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Current topic rating value
     //-----------------------------------------
     $this->topic['_rate_show'] = 0;
     $this->topic['_rate_int'] = 0;
     $this->topic['_rate_img'] = '';
     if ($this->topic['state'] != 'open') {
         $this->topic['_allow_rate'] = 0;
     } else {
         $this->topic['_allow_rate'] = $this->can_rate;
     }
     if ($this->forum['forum_allow_rating']) {
         $rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=" . $this->memberData['member_id']));
         if ($rating['rating_value'] and $this->memberData['g_topic_rate_setting'] != 2) {
             $this->topic['_allow_rate'] = 0;
         }
         $this->topic['_rate_id'] = 0;
         $this->topic['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : -1;
         if ($this->topic['topic_rating_total']) {
             $this->topic['_rate_int'] = round($this->topic['topic_rating_total'] / $this->topic['topic_rating_hits']);
         }
         //-----------------------------------------
         // Show image?
         //-----------------------------------------
         if ($this->topic['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $this->topic['_rate_int']) {
             $this->topic['_rate_id'] = $this->topic['_rate_int'];
             $this->topic['_rate_show'] = 1;
         }
     } else {
         $this->topic['_allow_rate'] = 0;
     }
     //-----------------------------------------
     // Update the item marker
     //-----------------------------------------
     if (!$this->request['view']) {
         $this->registry->getClass('classItemMarking')->markRead(array('forumID' => $this->forum['id'], 'itemID' => $this->topic['tid']));
     }
     //-----------------------------------------
     // If this forum is a link, then
     // redirect them to the new location
     //-----------------------------------------
     if ($this->topic['state'] == 'link') {
         $f_stuff = explode("&", $this->topic['moved_to']);
         $this->registry->output->redirectScreen($this->lang->words['topic_moved'], $this->settings['base_url'] . "showtopic={$f_stuff[0]}");
     }
     //-----------------------------------------
     // If this is a sub forum, we need to get
     // the cat details, and parent details
     //-----------------------------------------
     $this->nav = $this->registry->class_forums->forumsBreadcrumbNav($this->forum['id']);
     //-----------------------------------------
     // Are we a moderator?
     //-----------------------------------------
     if ($this->memberData['member_id'] and $this->memberData['g_is_supmod'] != 1) {
         $other_mgroups = array();
         if ($this->memberData['mgroup_others']) {
             $other_mgroups = explode(",", IPSText::cleanPermString($this->memberData['mgroup_others']));
         }
         $other_mgroups[] = $this->memberData['member_group_id'];
         $member_group_ids = implode(",", $other_mgroups);
         $this->moderator = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$this->forum['id']},%' AND (member_id={$this->memberData['member_id']} OR (is_group=1 AND group_id IN({$member_group_ids})))"));
     }
     //-----------------------------------------
     // Hi! Light?
     //-----------------------------------------
     $hl = (isset($this->request['hl']) and $this->request['hl']) ? '&amp;hl=' . $this->request['hl'] : '';
     //-----------------------------------------
     // If we can see queued topics, add count
     //-----------------------------------------
     if ($this->registry->class_forums->canQueuePosts($this->forum['id'])) {
         if (isset($this->request['modfilter']) and $this->request['modfilter'] == 'invisible_posts') {
             $this->topic['posts'] = intval($this->topic['topic_queuedposts']);
         } else {
             $this->topic['posts'] += intval($this->topic['topic_queuedposts']);
         }
     }
     //-----------------------------------------
     // Generate the forum page span links
     //-----------------------------------------
     $this->topic['SHOW_PAGES'] = $this->registry->output->generatePagination(array('totalItems' => $this->topic['posts'] + 1, 'itemsPerPage' => $this->settings['display_max_posts'], 'currentStartValue' => $this->first, 'seoTitle' => $this->topic['title_seo'], 'seoTemplate' => 'showtopic', 'baseUrl' => "showtopic=" . $this->topic['tid'] . $hl));
     if ($this->topic['posts'] + 1 > $this->settings['display_max_posts']) {
         //	$this->topic['go_new'] = $this->registry->output->getTemplate('topic')->golastpost_link($this->forum['id'], $this->topic['tid'] );
     }
     //-----------------------------------------
     // Fix up some of the words
     //-----------------------------------------
     $this->topic['TOPIC_START_DATE'] = $this->registry->class_localization->getDate($this->topic['start_date'], 'LONG');
     $this->lang->words['topic_stats'] = str_replace("<#START#>", $this->topic['TOPIC_START_DATE'], $this->lang->words['topic_stats']);
     $this->lang->words['topic_stats'] = str_replace("<#POSTS#>", $this->topic['posts'], $this->lang->words['topic_stats']);
     //-----------------------------------------
     // Multi Quoting?
     //-----------------------------------------
     $this->qpids = IPSCookie::get('mqtids');
     //-----------------------------------------
     // Multi PIDS?
     //-----------------------------------------
     $this->request['selectedpids'] = !empty($this->request['selectedpids']) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
     $this->request['selectedpidcount'] = 0;
     IPSCookie::set('modpids', '', 0);
     IPSDebug::setMemoryDebugFlag("TOPIC: topics.php::topicSetUp", $_before);
 }
 function forumPrefsForm($emailData, $data)
 {
     $IPBHTML = "";
     $this->registry->templateStriping['usercp'] = array(FALSE, "row1", "row2");
     $IPBHTML .= "<fieldset class='" . IPSLib::next($this->registry->templateStriping["usercp"]) . "'>\n\t<h3>{$this->lang->words['settings_display']}</h3>\n\t<ul>\n\t\t<li class='field checkbox'>\n\t\t\t<input type='checkbox' name='viewSignatures' id='view_sigs' value='1' class='input_check'" . ($this->memberData['view_sigs'] ? " checked=\"checked\"" : "") . "/> <label for='view_sigs'>{$this->lang->words['settings_viewsig']}</label>\n\t\t</li>\n\t\t<li class='field checkbox'>\n\t\t\t<input type='checkbox' name='viewImages' id='view_img' value='1' class='input_check'" . ($this->memberData['view_img'] ? " checked=\"checked\"" : "") . "/> <label for='view_img'>{$this->lang->words['settings_viewimg']}</label>\n\t\t</li>\n\t\t<li class='field checkbox'>\n\t\t\t<input type='checkbox' name='viewAvatars' id='view_avatar' value='1' class='input_check'" . ($this->memberData['view_avs'] ? " checked=\"checked\"" : "") . "/> <label for='view_avatar'>{$this->lang->words['settings_viewava']}</label>\n\t\t</li>\n\t\t<li class='field'>\n\t\t\t<label for='post_per_page' />{$this->lang->words['pp_number_posts']}</label>\n\t\t\t<select name=\"postpage\" class='input_select' id='posts_per_page'>\n\t\t\t\t<option value='-1'>{$this->lang->words['pp_use_default']}</option>\n\t\t\t\t" . $this->__f__a0f6a512da5e89e381e4ca0e2f2964d1($emailData, $data) . "\t\t\t</select>\n\t\t</li>\n\t\t<li class='field'>\n\t\t\t<label for='topics_per_page' />{$this->lang->words['pp_number_topics']}</label>\n\t\t\t<select name=\"topicpage\" class='input_select' id='topics_per_page'>\n\t\t\t\t<option value='-1'>{$this->lang->words['pp_use_default']}</option>\n\t\t\t\t" . $this->__f__84ac6e04839088af05ea72a005000a71($emailData, $data) . "\t\t\t\n\t\t\t</select>\n\t\t</li>\n\t</ul>\n</fieldset>\n<fieldset class='" . IPSLib::next($this->registry->templateStriping["usercp"]) . "'>\n\t<h3>{$this->lang->words['board_prefs']}</h3>\n\t<ul>\n\t\t<li class='field checkbox'>\n\t\t\t<input type='checkbox' class='input_check' id='send_full_msg' name='send_full_msg' value='1' {$emailData['email_full']} /> <label for='send_full_msg' />{$this->lang->words['send_full_msg']}</label><br />\n\t\t\t<span class='desc'>{$this->lang->words['send_full_msg_desc']}</span>\n\t\t</li>\n\t\t<li class='field checkbox'>\n\t\t\t<input class='input_check' type=\"checkbox\" id='auto_track' name=\"auto_track\" value=\"1\" {$emailData['auto_track']} /> <label for='auto_track' />{$this->lang->words['auto_track']}</label>\n\t\t\t<ul>\n\t\t\t\t<li class='field'>\n\t\t\t\t\t<label for='track_choice'>{$this->lang->words['auto_track_type']}</label>\n\t\t\t\t\t<select name=\"trackchoice\" id='track_choice' class='input_select'>\n\t\t\t\t\t\t<option value=\"none\" {$emailData['trackOption']['none']}>{$this->lang->words['subs_none_title']}</option>\n\t\t\t\t\t\t<option value=\"immediate\" {$emailData['trackOption']['immediate']}>{$this->lang->words['subs_immediate']}</option>\n\t\t\t\t\t\t<option value=\"delayed\" {$emailData['trackOption']['delayed']}>{$this->lang->words['subs_delayed']}</option>\n\t\t\t\t\t\t<option value=\"daily\" {$emailData['trackOption']['daily']}>{$this->lang->words['subs_daily']}</option>\n\t\t\t\t\t\t<option value=\"weekly\" {$emailData['trackOption']['weekly']}>{$this->lang->words['subs_weekly']}</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</li>\n\t\t<li class='field'>\n\t\t\t<label for='topic_display_mode'>{$this->lang->words['ucp_topic_display_mode']}</label> \n\t\t\t<select name=\"topic_display_mode\" id='topic_display_mode' class='input_select'>\n\t\t\t\t<option value=\"linear\"" . (IPSCookie::get('topicmode') == 'linear' ? " selected" : "") . ">{$this->lang->words['ucp_standard']}</option>\n\t\t\t\t<option value=\"linearplus\"" . (IPSCookie::get('topicmode') == 'linearplus' ? " selected" : "") . ">{$this->lang->words['ucp_linearplus']}</option>\n\t\t\t\t<option value=\"threaded\"" . (IPSCookie::get('topicmode') == 'threaded' ? " selected" : "") . ">{$this->lang->words['ucp_outline']}</option>\t\t\t\t\n\t\t\t</select>\n\t\t\t<span class='desc'>\n\t\t\t\t<strong>{$this->lang->words['ucp_standard']}:</strong> {$this->lang->words['ucp_standard_explain']}<br />\n\t\t\t\t<strong>{$this->lang->words['ucp_linearplus']}:</strong> {$this->lang->words['ucp_linearplus_explain']}<br />\n\t\t\t\t<strong>{$this->lang->words['ucp_outline']}:</strong> {$this->lang->words['ucp_outline_explain']}\n\t\t\t</span>\n\t\t</li>\t\t\n\t</ul>\n</fieldset>";
     return $IPBHTML;
 }
예제 #18
0
 /**
  * Init method
  *
  * @param	mixed	Extra data (can be used by extending classes)
  * @return	@e void
  */
 public function init($extraData = null)
 {
     $this->lang->loadLanguageFile(array('public_topic'), 'forums');
     /* Init some data */
     $this->_settings = $this->settings();
     $this->qpids = IPSCookie::get('comment_pids');
     $this->request['selectedpids'] = IPSCookie::get('commentmodpids');
     $this->request['selectedpidcount'] = intval(count(preg_split("/,/", $this->request['commentmodpids'], -1, PREG_SPLIT_NO_EMPTY)));
     IPSCookie::set('commentmodpids', '', 0);
     /* Load parser */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
     $this->parser = new $classToLoad();
     /* set up parser */
     $this->parser->set(array('memberData' => $this->memberData, 'parseBBCode' => 1, 'parseHtml' => 0, 'parseEmoticons' => 1, 'parseArea' => 'comments'));
 }
 /**
  * Check Multi Quote
  * Checks for quoted information
  *
  * @access	public
  * @param	string	Any raw post
  * @return	string	Formatted post
  */
 protected function _checkMultiQuote($postContent)
 {
     $raw_post = '';
     if (!$this->request['qpid']) {
         $this->request['qpid'] = IPSCookie::get('mqtids');
         if ($this->request['qpid'] == ",") {
             $this->request['qpid'] = "";
         }
     } else {
         //-----------------------------------------
         // Came from reply button
         //-----------------------------------------
         $this->request['parent_id'] = $this->request['qpid'];
     }
     $this->request['qpid'] = preg_replace("/[^,\\d]/", "", trim($this->request['qpid']));
     if ($this->request['qpid']) {
         $this->quoted_pids = preg_split('/,/', $this->request['qpid'], -1, PREG_SPLIT_NO_EMPTY);
         //-----------------------------------------
         // Get the posts from the DB and ensure we have
         // suitable read permissions to quote them
         //-----------------------------------------
         if (count($this->quoted_pids)) {
             $this->DB->build(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => "p.pid IN(" . implode(',', $this->quoted_pids) . ")", 'add_join' => array(array('select' => 't.forum_id', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('select' => 'member_id, members_display_name', 'from' => array('members' => 'm'), 'where' => 'p.author_id=m.member_id', 'type' => 'left'))));
             $this->DB->execute();
             while ($tp = $this->DB->fetch()) {
                 //if( IPSMember::checkPermissions('read', $this->getForumID() ) == TRUE )
                 $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('read', $this->getForumData(), $perm_array) === TRUE) {
                     $tmp_post = $this->_afterPostCompile($tp['post'], 'reply');
                     $tp['author_name'] = $tp['members_display_name'] ? $tp['members_display_name'] : $tp['author_name'];
                     /*if ( IPSText::getTextClass( 'editor' )->method == 'rte' )
                     		{
                     			$tmp_post = IPSText::getTextClass( 'bbcode' )->convertForRTE(  $tp['post'] );
                     		}
                     		else
                     		{
                     			$tmp_post = trim( IPSText::getTextClass( 'bbcode' )->preEditParse( $tp['post'] ) );
                     		}*/
                     if ($this->settings['strip_quotes']) {
                         $tmp_post = trim($this->_recursiveKillQuotes($tmp_post));
                     }
                     $extra = "";
                     if ($tmp_post) {
                         if (IPSText::getTextClass('editor')->method == 'rte') {
                             $raw_post .= "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($tp['author_name']) . "' date='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($this->registry->getClass('class_localization')->getDate($tp['post_date'], 'LONG', 1)) . "' timestamp='" . $tp['post_date'] . "' post='" . $tp['pid'] . "']<br />{$tmp_post}<br />" . $extra . '[/quote]<br /><br /><br />';
                         } else {
                             /* Knocks out <br />  */
                             $tmp_post = trim(IPSText::getTextClass('bbcode')->preEditParse($tmp_post));
                             $raw_post .= "[quote name='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($tp['author_name']) . "' date='" . IPSText::getTextClass('bbcode')->makeQuoteSafe($this->registry->getClass('class_localization')->getDate($tp['post_date'], 'LONG', 1)) . "' timestamp='" . $tp['post_date'] . "' post='" . $tp['pid'] . "']\n{$tmp_post}\n" . $extra . "[/quote]\n\n\n";
                         }
                     }
                 }
             }
             $raw_post = trim($raw_post) . "\n";
         }
     }
     //-----------------------------------------
     // Need to put into RTE format..
     //-----------------------------------------
     if (IPSText::getTextClass('editor')->method == 'rte') {
         $raw_post = IPSText::getTextClass('bbcode')->convertForRTE($raw_post);
     }
     //-----------------------------------------
     // Make raw POST safe for the text area
     //-----------------------------------------
     $raw_post .= IPSText::raw2form($postContent);
     return $raw_post;
 }
 function registerCoppaStart()
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_register', $this->_funcHooks['registerCoppaStart'])) {
         $count_dd1fe902298f5e195496c64806493be1 = is_array($this->functionData['registerCoppaStart']) ? count($this->functionData['registerCoppaStart']) : 0;
     }
     $IPBHTML .= "" . ($this->settings['use_coppa'] && (!$this->request['coppa'] && !IPSCookie::get('coppa')) ? "\n<div class='post_form' id='coppa_form'>\n\t<fieldset class='general_box'>\n\t\t<h3>{$this->lang->words['coppa_info']}</h3>\n\t\t<div class='ipsPad'>\n\t\t\t{$this->lang->words['confirm_over_thirteen']}\n\t\t</div>\n\t\t<div class='ipsPad ipsForm_center'>\n\t\t\t<form>\n\t\t\t<select name='month' id='coppa_bday_m'>\n\t\t\t\t" . $this->__f__b6a6f9f8c3ae81237fe1a6bb668c90bd() . "\t\t\t</select>\n\t\t\t&nbsp;\n\t\t\t<select name='day' id='coppa_bday_d'>\n\t\t\t\t" . $this->__f__6fb61d92dc250e6fc9de49b3fea4a984() . "\t\t\t</select>\n\t\t\t&nbsp;\n\t\t\t<select name='year' id='coppa_bday_y'>\n\t\t\t\t" . $this->__f__456d7e88acd0f3bc9ef50ffaa2e6fd2b() . "\t\t\t</select>\n\t\t\t</form>\n\t\t</div>\n\t</fieldset>\n\t<fieldset class='ipsForm_submit ipsForm_right'>\n\t\t<a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=core&amp;module=global&amp;section=register&amp;do=coppa_two&amp;coppa=1", "public", ''), "", "") . "' id='confirm_coppa' class='ipsButton'>{$this->lang->words['coppa_continue_button']}</a>\n\t</fieldset>\n</div>\n<script type='text/javascript'>\n\t\$('coppa_form').hide();\n\t\n\tfunction validateDate( popup )\n\t{\n\t\tvar day\t\t= parseInt(\$('coppa_bday_d').value);\n\t\tvar month\t= parseInt(\$('coppa_bday_m').value);\n\t\tvar year\t= parseInt(\$('coppa_bday_y').value);\n\t\tvar compare\t\t= Math.round( new Date( year + 13, month - 1, day ).getTime() / 1000 );\n\t\tvar today\t\t= Math.round( new Date().getTime() / 1000 );\n\t\tif ( (today - compare) < 0 )\n\t\t{\n\t\t\twindow.location = ipb.vars['base_url'] + \"app=core&module=global&section=register&do=coppa_two\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpopup.hide();\n\t\t\tipb.Cookie.set('coppa', 'no', true);\n\t\t}\n\t}\n\t\n\tipb.vars['coppa_popup'] = new ipb.Popup( 'coppa_popup', {\ttype: 'pane',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinitial: \$('coppa_form').show(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thideAtStart: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thideClose: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdefer: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tw: '550px' },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tafterInit: function( popup ){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpopup.getObj().select(\"#confirm_coppa\")[0].observe('click', function(e){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tEvent.stop(e);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn validateDate( popup );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n</script>\n" : "") . "";
     return $IPBHTML;
 }
예제 #21
0
 /**
  * Displays the registration form
  *
  * @param	array 	$form_errors
  * @return	@e void
  */
 public function registerForm($form_errors = array())
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $final_errors = array();
     $coppa = IPSCookie::get('coppa');
     $step = $this->request['step'] ? intval($this->request['step']) : 1;
     $this->settings['username_errormsg'] = str_replace('{chars}', $this->settings['username_characters'], $this->settings['username_errormsg']);
     if ($coppa == 'yes') {
         $this->registry->output->showError('awaiting_coppa', 10124);
     }
     $this->_resetMember();
     //-----------------------------------------
     // COPPA swapout
     //-----------------------------------------
     if ($this->settings['use_coppa']) {
         $this->lang->words['confirm_over_thirteen'] = str_replace("<#FORM_LINK#>", "{$this->settings['base_url']}app=core&amp;module=global&amp;section=register&amp;do=12", $this->lang->words['confirm_over_thirteen']);
     }
     //-----------------------------------------
     // T & C
     //-----------------------------------------
     $cache = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'"));
     $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
     IPSText::getTextClass('bbcode')->parse_smilies = 1;
     IPSText::getTextClass('bbcode')->parse_html = 1;
     IPSText::getTextClass('bbcode')->parse_nl2br = 1;
     IPSText::getTextClass('bbcode')->parse_bbcode = 1;
     IPSText::getTextClass('bbcode')->parsing_section = 'global';
     $this->settings['_termsAndConditions'] = IPSText::getTextClass('bbcode')->preDisplayParse($text);
     //-----------------------------------------
     // Page title / navigation
     //-----------------------------------------
     $this->registry->output->setTitle($this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name']);
     $this->registry->output->addNavigation($this->lang->words['registration_form'], '');
     //-----------------------------------------
     // If Nexus is installed, that is the first step
     //-----------------------------------------
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         //-----------------------------------------
         // We just submitted the form
         //-----------------------------------------
         if ($this->request['nexus_pass']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('nexus') . '/sources/hooks.php', 'nexusHooks', 'nexus');
             $hookGateway = new $classToLoad($this->registry);
             //-----------------------------------------
             // Check for errors
             //-----------------------------------------
             if ($this->settings['nexus_reg_force'] and !IPSCookie::get('cm_reg') and empty($this->request['cm_package'])) {
                 $nexusError = $this->lang->words['forceby_no_sel'];
             }
         }
         //-----------------------------------------
         // If no errors, create invoice and set cookie
         //-----------------------------------------
         if (!$nexusError and $this->request['nexus_pass']) {
             //-----------------------------------------
             // Did we buy a package?
             //-----------------------------------------
             $chosenPackages = ipsRegistry::$request['cm_package'];
             if (!empty($chosenPackages)) {
                 foreach ($chosenPackages as $itemID) {
                     require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
                     /*noLibHook*/
                     $package = package::load($itemID);
                     $shippingData = $package->shippingData();
                     $renewTerm = $package->renewalTerms();
                     $items[] = array('act' => 'new', 'app' => 'nexus', 'type' => $package->data['p_type'], 'cost' => $package->price($this->memberData['member_id'], FALSE), 'tax' => $package->data['p_tax'], 'renew_term' => $renewTerm['term'], 'renew_units' => $renewTerm['unit'], 'renew_cost' => $renewTerm['price'], 'physical' => is_null($shippingData) ? FALSE : TRUE, 'shipping' => is_null($shippingData) ? array() : $shippingData['shipping'], 'weight' => is_null($shippingData) ? 0 : $shippingData['weight'], 'itemName' => $package->data['p_name'], 'itemID' => $package->data['p_id'], 'groupRenewals' => $package->data['p_group_renewals'], 'methods' => $package->data['p_methods'] ? explode(',', $package->data['p_methods']) : array());
                 }
                 // Generate it
                 require_once IPSLib::getAppDir('nexus') . '/sources/nexusApi.php';
                 /*noLibHook*/
                 $invoiceID = nexusApi::generateInvoice(NULL, $this->memberData['member_id'], $items);
                 IPSCookie::set('cm_reg', $invoiceID);
             }
         } else {
             //-----------------------------------------
             // "step 1" if Nexus is set to show packages on registration
             //-----------------------------------------
             require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
             /*noLibHook*/
             $packages = array();
             $this->DB->build(array('select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position'));
             $e = $this->DB->execute();
             while ($row = $this->DB->fetch($e)) {
                 $packages[$row['p_id']] = package::load($row['p_id'])->buildDisplayData();
             }
             if (!empty($packages)) {
                 if (isset($this->request['cm_package'])) {
                     foreach ($this->request['cm_package'] as $packageID) {
                         $packages[$packageID]['checked'] = "checked='checked'";
                     }
                 }
                 $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32($packages, $nexusError);
                 return;
             } else {
                 $this->settings['nexus_reg_show'] = false;
             }
         }
     }
     //-----------------------------------------
     // Send to an alternate registration URL?
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         if ($r['login_register_url']) {
             $this->registry->output->silentRedirect($r['login_register_url']);
         }
     }
     //-----------------------------------------
     // Adjust text as needed based on validation type
     //-----------------------------------------
     if ($this->settings['reg_auth_type']) {
         if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['email_validate_text'];
         }
         /* User then admin? */
         if ($this->settings['reg_auth_type'] == 'admin_user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['user_admin_validation'];
         }
         if ($this->settings['reg_auth_type'] == 'admin') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['just_admin_validation'];
         }
     }
     //-----------------------------------------
     // Captcha / Q&A
     //-----------------------------------------
     $captchaHTML = '';
     $qandaHTML = '';
     $question = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1)));
     if ($question and count($question)) {
         $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer($question);
     }
     if ($this->settings['bot_antispam_type'] != 'none') {
         $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
     }
     //-----------------------------------------
     // Custom fields
     //-----------------------------------------
     $custom_fields_out = array('required', 'optional');
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields = new $classToLoad();
     $custom_fields->member_data = $this->memberData;
     $custom_fields->initData('edit', 0, array('tabindex' => 6));
     $custom_fields->parseToEdit('register');
     if (count($custom_fields->out_fields)) {
         foreach ($custom_fields->out_fields as $id => $form_element) {
             if ($custom_fields->cache_data[$id]['pf_not_null'] == 1) {
                 $ftype = 'required';
             } else {
                 $ftype = 'optional';
             }
             $custom_fields_out[$ftype][] = array('name' => $custom_fields->field_names[$id], 'desc' => $custom_fields->field_desc[$id], 'field' => $form_element, 'id' => $id, 'error' => '', 'type' => $custom_fields->cache_data[$id]['pf_type']);
         }
     }
     //-----------------------------------------
     // If Nexus is installed, also add billing information
     //-----------------------------------------
     $nexusFields = array();
     $nexusStates = array();
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_countries'), 'nexus');
         $fields = array();
         $_fields = ipsRegistry::cache()->getCache('customer_fields');
         if (is_array($_fields) and count($_fields)) {
             foreach ($_fields['reg'] as $k) {
                 $nexusFields[] = $_fields['fields'][$k];
             }
         }
         $nexusStates = customer::generateStateDropdown(TRUE);
     }
     //-----------------------------------------
     // Got errors to show?
     //-----------------------------------------
     $final_errors = array('dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL);
     foreach (array('dname', 'password', 'email', 'tos') as $thing) {
         if (isset($form_errors[$thing]) and is_array($form_errors[$thing]) and count($form_errors[$thing])) {
             $final_errors[$thing] = implode("<br />", $form_errors[$thing]);
         }
     }
     $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '';
     $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '';
     $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '';
     $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '';
     $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '';
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '';
     //-----------------------------------------
     // Create time zone dropdown array
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_usercp'), 'core');
     $time_select = array();
     foreach ($this->lang->words as $k => $v) {
         if (strpos($k, "time_") === 0) {
             $k = str_replace("time_", '', $k);
             if (preg_match('/^[\\-\\d\\.]+$/', $k)) {
                 $time_select[$k] = $v;
             }
         }
     }
     ksort($time_select);
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : $this->settings['time_offset'];
     //-----------------------------------------
     // Start output
     //-----------------------------------------
     $this->output .= $this->registry->output->getTemplate('register')->registerForm($form_errors['general'], array('TEXT' => $this->lang->words['std_text'], 'coppa_user' => $coppa, 'captchaHTML' => $captchaHTML, 'qandaHTML' => $qandaHTML, 'showCOPPA' => $this->settings['use_coppa'] and !(IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online'])), $final_errors, $time_select, $custom_fields_out, $nexusFields, $nexusStates);
     //-----------------------------------------
     // Member sync module
     //-----------------------------------------
     IPSLib::runMemberSync('onRegisterForm');
 }
    /**
     * Editor template for ACP
     *
     * @access	public
     * @param	string 		From field name
     * @param	string		Initial content for the editor
     * @param	string		Path to the images
     * @param	integer		Whether RTE is enabled (1) or not (0)
     * @param	string		Editor id
     * @param	string		Emoticon data
     * @return	string		HTML
     */
    public function ips_editor($form_field = "", $initial_content = "", $images_path = "", $rte_mode = 0, $editor_id = 'ed-0', $smilies = '')
    {
        $IPBHTML = "";
        //--starthtml--//
        $this->settings['extraJsModules'] .= ",editor";
        $bbcodes = IPSLib::fetchBbcodeAsJson();
        $show_sidebar = IPSCookie::get('emoticon_sidebar');
        $show_sidebar_class = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? 'with_sidebar' : '';
        $show_sidebar_style = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? '' : "style='display:none'";
        $show_sidebar_link = $show_sidebar && $this->settings['_remove_emoticons'] == 0 ? 'true' : 'false';
        $IPBHTML .= <<<EOF
\t<!--top-->
\t<input type='hidden' name='{$editor_id}_wysiwyg_used' id='{$editor_id}_wysiwyg_used' value='0' />
\t<input type='hidden' name='editor_ids[]' value='{$editor_id}' />
\t<div class='ips_editor {$show_sidebar_class}' id='editor_{$editor_id}'>
EOF;
        if ($this->settings['_remove_emoticons'] == 0) {
            $IPBHTML .= <<<EOF
\t\t<div class='sidebar row1 altrow' id='{$editor_id}_sidebar' {$show_sidebar_style}>
\t\t\t<h4><img src='{$this->settings['img_url']}/close_popup.png' alt='{$this->lang->words['icon']}' id='{$editor_id}_close_sidebar' /><span>{$this->lang->words['emoticons_template_title']}</span></h4>
\t\t\t<div id='{$editor_id}_emoticon_holder' class='emoticon_holder'></div>
\t\t\t<div class='show_all_emoticons' id='{$editor_id}_showall_bar'>
\t\t\t\t<input type='button' value='Show All' id='{$editor_id}_showall_emoticons' class='input_submit emoticons' />
\t\t\t</div>
\t\t</div>
EOF;
        }
        $IPBHTML .= <<<EOF
\t\t<div id='{$editor_id}_controls' class='controls'>
\t\t\t<ul id='{$editor_id}_toolbar_1' class='toolbar' style='display: none'>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_removeformat' class='rte_control rte_button' title='{$this->lang->words['js_tt_noformat']}'><img src='{$this->settings['img_url']}/rte_icons/remove_formatting.png' alt='{$this->lang->words['js_tt_noformat']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_togglesource' class='rte_control rte_button' title='{$this->lang->words['js_tt_htmlsource']}'><img src='{$this->settings['img_url']}/rte_icons/toggle_source.png' alt='{$this->lang->words['js_tt_htmlsource']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_otherstyles' class='rte_control rte_menu rte_special' title='{$this->lang->words['box_other_desc']}' style='display: none'>{$this->lang->words['box_other']}</span>
\t\t\t\t</li>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_fontname' class='rte_control rte_menu rte_font' title='{$this->lang->words['box_font_desc']}'>{$this->lang->words['box_font']}</span>
\t\t\t\t</li>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_fontsize' class='rte_control rte_menu rte_fontsize' title='{$this->lang->words['box_size_desc']}'>{$this->lang->words['box_size']}</span>
\t\t\t\t</li>
\t\t\t\t<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_forecolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_font_col']}'><img src='{$this->settings['img_url']}/rte_icons/font_color.png' alt='{$this->lang->words['js_tt_font_col']}' /></span>
\t\t\t\t</li>
\t\t\t\t<!--<li class='left'>
\t\t\t\t\t<span id='{$editor_id}_cmd_backcolor' class='rte_control rte_palette' title='{$this->lang->words['js_tt_back_col']}'><img src='{$this->settings['img_url']}/rte_icons/background_color.png' alt='{$this->lang->words['js_tt_back_col']}' /></span>
\t\t\t\t</li>-->

\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_spellcheck' class='rte_control rte_button' title='{$this->lang->words['js_tt_spellcheck']}'><img src='{$this->settings['img_url']}/rte_icons/spellcheck.png' alt='{$this->lang->words['js_tt_spellcheck']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_r_small' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizesmall']}'><img src='{$this->settings['img_url']}/rte_icons/resize_small.png' alt='{$this->lang->words['js_tt_resizesmall']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_r_big' class='rte_control rte_button' title='{$this->lang->words['js_tt_resizebig']}'><img src='{$this->settings['img_url']}/rte_icons/resize_big.png' alt='{$this->lang->words['js_tt_resizebig']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_help' class='rte_control rte_button' title='{$this->lang->words['js_tt_help']}'><a href='{parse url="app=forums&amp;module=extras&amp;section=legends&amp;do=bbcode" base="public"}' title='{$this->lang->words['js_tt_help']}'><img src='{$this->settings['img_url']}/rte_icons/help.png' alt='{$this->lang->words['js_tt_help']}' /></a></span>
\t\t\t\t</li>\t\t\t
\t\t\t\t<li class='right sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_undo' class='rte_control rte_button' title='{$this->lang->words['js_tt_undo']}'><img src='{$this->settings['img_url']}/rte_icons/undo.png' alt='{$this->lang->words['js_tt_undo']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_redo' class='rte_control rte_button' title='{$this->lang->words['js_tt_redo']}'><img src='{$this->settings['img_url']}/rte_icons/redo.png' alt='{$this->lang->words['js_tt_redo']}' /></span>
\t\t\t\t</li>
EOF;
        if ($this->settings['posting_allow_rte'] == 1) {
            $IPBHTML .= <<<EOF
\t\t\t\t<li class='right'>
\t\t\t\t\t<!--<span id='{$editor_id}_cmd_switcheditor' class='rte_control rte_button' title='{$this->lang->words['js_tt_switcheditor']}'><img src='{$this->settings['img_url']}/rte_icons/switch.png' alt='{$this->lang->words['js_tt_switcheditor']}' /></span>-->
\t\t\t\t</li>
EOF;
        }
        $IPBHTML .= <<<EOF
\t\t\t</ul>
\t\t\t<ul id='{$editor_id}_toolbar_2' class='toolbar' style='display: none'>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_bold' class='rte_control rte_button' title='{$this->lang->words['js_tt_bold']}'><img src='{$this->settings['img_url']}/rte_icons/bold.png' alt='{$this->lang->words['js_tt_bold']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_italic' class='rte_control rte_button' title='{$this->lang->words['js_tt_italic']}'><img src='{$this->settings['img_url']}/rte_icons/italic.png' alt='{$this->lang->words['js_tt_italic']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_underline' class='rte_control rte_button' title='{$this->lang->words['js_tt_underline']}'><img src='{$this->settings['img_url']}/rte_icons/underline.png' alt='{$this->lang->words['js_tt_underline']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_strikethrough' class='rte_control rte_button' title='{$this->lang->words['js_tt_strike']}'><img src='{$this->settings['img_url']}/rte_icons/strike.png' alt='{$this->lang->words['js_tt_strike']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_subscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sub']}'><img src='{$this->settings['img_url']}/rte_icons/subscript.png' alt='{$this->lang->words['js_tt_sub']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_superscript' class='rte_control rte_button' title='{$this->lang->words['js_tt_sup']}'><img src='{$this->settings['img_url']}/rte_icons/superscript.png' alt='{$this->lang->words['js_tt_sup']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_insertunorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/unordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_insertorderedlist' class='rte_control rte_button' title='{$this->lang->words['js_tt_list']}'><img src='{$this->settings['img_url']}/rte_icons/ordered_list.png' alt='{$this->lang->words['js_tt_list']}' /></span>
\t\t\t\t</li>
EOF;
        if ($this->settings['_remove_emoticons'] == 0) {
            $IPBHTML .= <<<EOF
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_emoticons' class='rte_control rte_button' title='{$this->lang->words['js_tt_emoticons']}'><img src='{$this->settings['img_url']}/rte_icons/emoticons.png' alt='{$this->lang->words['js_tt_emoticons']}' /></span>
\t\t\t\t</li>
EOF;
        }
        $IPBHTML .= <<<EOF
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_link' class='rte_control rte_palette' title='{$this->lang->words['js_tt_link']}'><img src='{$this->settings['img_url']}/rte_icons/link.png' alt='{$this->lang->words['js_tt_link']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_image' class='rte_control rte_palette' title='{$this->lang->words['js_tt_image']}'><img src='{$this->settings['img_url']}/rte_icons/picture.png' alt='{$this->lang->words['js_tt_image']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_email' class='rte_control rte_palette' title='{$this->lang->words['js_tt_email']}'><img src='{$this->settings['img_url']}/rte_icons/email.png' alt='{$this->lang->words['js_tt_email']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_ipb_quote' class='rte_control rte_button' title='{$this->lang->words['js_tt_quote']}'><img src='{$this->settings['img_url']}/rte_icons/quote.png' alt='{$this->lang->words['js_tt_quote']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_ipb_code' class='rte_control rte_button' title='{$this->lang->words['js_tt_code']}'><img src='{$this->settings['img_url']}/rte_icons/code.png' alt='{$this->lang->words['js_tt_code']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li>
\t\t\t\t\t<span id='{$editor_id}_cmd_media' class='rte_control rte_palette' title='{$this->lang->words['js_tt_media']}'><img src='{$this->settings['img_url']}/rte_icons/media.png' alt='{$this->lang->words['js_tt_media']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_justifyright' class='rte_control rte_button' title='{$this->lang->words['js_tt_right']}'><img src='{$this->settings['img_url']}/rte_icons/align_right.png' alt='{$this->lang->words['js_tt_right']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_justifycenter' class='rte_control rte_button' title='{$this->lang->words['js_tt_center']}'><img src='{$this->settings['img_url']}/rte_icons/align_center.png' alt='{$this->lang->words['js_tt_center']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_justifyleft' class='rte_control rte_button' title='{$this->lang->words['js_tt_left']}'><img src='{$this->settings['img_url']}/rte_icons/align_left.png' alt='{$this->lang->words['js_tt_left']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right sep'>
\t\t\t\t\t<span id='{$editor_id}_cmd_indent' class='rte_control rte_button' title='{$this->lang->words['js_tt_indent']}'><img src='{$this->settings['img_url']}/rte_icons/indent.png' alt='{$this->lang->words['js_tt_indent']}' /></span>
\t\t\t\t</li>
\t\t\t\t<li class='right'>
\t\t\t\t\t<span id='{$editor_id}_cmd_outdent' class='rte_control rte_button' title='{$this->lang->words['js_tt_outdent']}'><img src='{$this->settings['img_url']}/rte_icons/outdent.png' alt='{$this->lang->words['js_tt_outdent']}' /></span>
\t\t\t\t</li>
\t\t\t</ul>
\t\t</div>
\t\t<div id='{$editor_id}_wrap' class='editor'>
\t\t\t<textarea name="{$form_field}" class="input_rte" id="{$editor_id}_textarea" rows="10" cols="60" tabindex="0">{$initial_content}</textarea>
\t\t</div>
\t</div>

\t<!-- Toolpanes -->
\t<script type="text/javascript">
\t//<![CDATA[
\t\$('{$editor_id}_toolbar_1').show();
\t\$('{$editor_id}_toolbar_2').show();
\t// Rikki: Had to remove <form>... </form> because Opera would see </form> and not pass the topic icons / hidden fields properly. Tried "</" + "form>" but when it is parsed, it had the same affect
\tipb.editor_values.get('templates')['link'] = new Template("<label for='#{id}_url'>{$this->lang->words['js_template_url']}</label><input type='text' class='input_text' id='#{id}_url' value='http://' tabindex='10' /><label for='#{id}_urltext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_urltext' value='{$this->lang->words['js_template_default']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_link']}' tabindex='12' />");

\tipb.editor_values.get('templates')['image'] = new Template("<label for='#{id}_img'>{$this->lang->words['js_template_imageurl']}</label><input type='text' class='input_text' id='#{id}_img' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_img']}' tabindex='11' />");

\tipb.editor_values.get('templates')['email'] = new Template("<label for='#{id}_email'>{$this->lang->words['js_template_email_url']}</label><input type='text' class='input_text' id='#{id}_email' tabindex='10' /><label for='#{id}_emailtext'>{$this->lang->words['js_template_link']}</label><input type='text' class='input_text _select' id='#{id}_emailtext' value='{$this->lang->words['js_template_email_me']}' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_email']}' tabindex='12' />");

\tipb.editor_values.get('templates')['media'] = new Template("<label for='#{id}_media'>{$this->lang->words['js_template_media_url']}</label><input type='text' class='input_text' id='#{id}_media' value='http://' tabindex='10' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_insert_media']}' tabindex='11' />");

\tipb.editor_values.get('templates')['generic'] = new Template("<div class='rte_title'>#{title}</div><strong>{$this->lang->words['js_template_example']}</strong><pre>#{example}</pre><label for='#{id}_option' class='optional'>#{option_text}</label><input type='text' class='input_text optional' id='#{id}_option' tabindex='10' /><label for='#{id}_text' class='tagcontent'>#{value_text}</label><input type='text' class='input_text _select tagcontent' id='#{id}_text' tabindex='11' /><input type='submit' class='input_submit' value='{$this->lang->words['js_template_add']}' tabindex='12' />");

\tipb.editor_values.get('templates')['toolbar'] = new Template("<ul id='#{id}_toolbar_#{toolbarid}' class='toolbar' style='display: none'>#{content}</ul>");

\tipb.editor_values.get('templates')['button'] = new Template("<li><span id='#{id}_cmd_custom_#{cmd}' class='rte_control rte_button specialitem' title='#{title}'><img src='{$this->settings['img_url']}/rte_icons/#{img}' alt='{$this->lang->words['icon']}' /></span></li>");

\tipb.editor_values.get('templates')['menu_item'] = new Template("<li id='#{id}_cmd_custom_#{cmd}' class='specialitem clickable'>#{title}</li>");

\tipb.editor_values.get('templates')['togglesource'] = new Template("<fieldset id='#{id}_ts_controls' class='submit' style='text-align: left'><input type='button' class='input_submit' value='{$this->lang->words['js_template_update']}' id='#{id}_ts_update' />&nbsp;&nbsp;&nbsp; <a href='#' id='#{id}_ts_cancel' class='cancel'>{$this->lang->words['js_template_cancel_source']}</a></fieldset>");

\tipb.editor_values.get('templates')['emoticons_showall'] = new Template("<input class='input_submit emoticons' type='button' id='#{id}_all_emoticons' value='{$this->lang->words['show_all_emoticons']}' />");

\tipb.editor_values.get('templates')['emoticon_wrapper'] = new Template("<h4><span>{$this->lang->words['emoticons_template_title']}</span></h4><div id='#{id}_emoticon_holder' class='emoticon_holder'></div>");

\t// Add smilies into the mix
\tipb.editor_values.set( 'show_emoticon_link', true );
\tipb.editor_values.set( 'emoticons', \$H({ {$smilies} }) );
\tipb.editor_values.set( 'bbcodes', \$H( {$bbcodes} ) );

\tipb.vars['emoticon_url'] = "{$this->settings['emoticons_url']}";

\tEvent.observe(window, 'load', function(e){
\t\tipb.editors[ '{$editor_id}' ] = new ipb.editor( '{$editor_id}', USE_RTE );
\t});

\t//]]>
\t</script>

EOF;
        //--endhtml--//
        return $IPBHTML;
    }
 /**
  * Parase Topic Data
  *
  * @access	public
  * @param	array	$topic				Topic data
  * @param	bool	$last_time_default	Use default "last read time"
  * @return	array
  **/
 public function parseTopicData($topic, $last_time_default = true)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $topic['real_tid'] = $topic['tid'];
     $topic['_last_post'] = $topic['last_post'];
     //-----------------------------------------
     // Do we have an SEO title?
     //-----------------------------------------
     $_hasSEOTitle = false;
     if ($topic['title_seo']) {
         $_hasSEOTitle = true;
     }
     $topic['title_seo'] = $topic['title_seo'] ? $topic['title_seo'] : IPSText::makeSeoTitle($topic['title']);
     /**
      * Here we'll take the one query hit to update in order to speed it up in the future
      */
     if (!$_hasSEOTitle and $this->settings['use_friendly_urls']) {
         $this->DB->update('topics', array('title_seo' => $topic['title_seo'] ? $topic['title_seo'] : '-'), 'tid=' . $topic['tid']);
     }
     //-----------------------------------------
     // Need to update this topic?
     //-----------------------------------------
     if ($topic['state'] == 'open') {
         if (!$topic['topic_open_time'] or $topic['topic_open_time'] < $topic['topic_close_time']) {
             if ($topic['topic_close_time'] and ($topic['topic_close_time'] <= time() and (time() >= $topic['topic_open_time'] or !$topic['topic_open_time']))) {
                 $topic['state'] = 'closed';
                 $this->update_topics_close[] = $topic['real_tid'];
             }
         } else {
             if ($topic['topic_open_time'] or $topic['topic_open_time'] > $topic['topic_close_time']) {
                 if ($topic['topic_close_time'] and ($topic['topic_close_time'] <= time() and time() <= $topic['topic_open_time'])) {
                     $topic['state'] = 'closed';
                     $this->update_topics_close[] = $topic['real_tid'];
                 }
             }
         }
     } else {
         if ($topic['state'] == 'closed') {
             if (!$topic['topic_close_time'] or $topic['topic_close_time'] < $topic['topic_open_time']) {
                 if ($topic['topic_open_time'] and ($topic['topic_open_time'] <= time() and (time() >= $topic['topic_close_time'] or !$topic['topic_close_time']))) {
                     $topic['state'] = 'open';
                     $this->update_topics_open[] = $topic['real_tid'];
                 }
             } else {
                 if ($topic['topic_close_time'] or $topic['topic_close_time'] > $topic['topic_open_time']) {
                     if ($topic['topic_open_time'] and ($topic['topic_open_time'] <= time() and time() <= $topic['topic_close_time'])) {
                         $topic['state'] = 'open';
                         $this->update_topics_open[] = $topic['real_tid'];
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // For polls we check last vote instead
     // @todo [Future] Show a diff icon for new vote + new reply, new vote + no new reply, etc.
     // Bug 16598: Need separate checks for icon vs getnewpost link
     //-----------------------------------------
     if ($topic['poll_state'] and $topic['last_vote'] > $topic['last_post']) {
         $is_read = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_vote']), 'forums');
         $gotonewpost = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_post']), 'forums');
     } else {
         $is_read = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_post']), 'forums');
         $gotonewpost = $is_read;
     }
     //-----------------------------------------
     // Yawn
     //-----------------------------------------
     $topic['last_poster'] = $topic['last_poster_id'] ? IPSLib::makeProfileLink($topic['last_poster_name'], $topic['last_poster_id'], $topic['seo_last_name']) : $this->settings['guest_name_pre'] . $topic['last_poster_name'] . $this->settings['guest_name_suf'];
     $topic['starter'] = $topic['starter_id'] ? IPSLib::makeProfileLink($topic['starter_name'], $topic['starter_id'], $topic['seo_first_name']) : $this->settings['guest_name_pre'] . $topic['starter_name'] . $this->settings['guest_name_suf'];
     $topic['prefix'] = $topic['poll_state'] ? $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap($this->settings['pre_polls']) : '';
     $show_dots = "";
     if ($this->memberData['member_id'] and (isset($topic['author_id']) and $topic['author_id'])) {
         $show_dots = 1;
     }
     $topic['folder_img'] = $this->registry->getClass('class_forums')->fetchTopicFolderIcon($topic, $show_dots, $is_read);
     /* SKINNOTE: Change these so that the link is built in the skin, not here */
     $topic['topic_icon'] = $topic['icon_id'] ? '<img src="' . $this->settings['mime_img'] . '/style_extra/post_icons/icon' . $topic['icon_id'] . '.gif" border="0" alt="" />' : '&nbsp;';
     $topic['topic_icon'] = $topic['pinned'] ? '<{B_PIN}>' : $topic['topic_icon'];
     $topic['start_date'] = $this->registry->getClass('class_localization')->getDate($topic['start_date'], 'LONG');
     //-----------------------------------------
     // Pages 'n' posts
     //-----------------------------------------
     $pages = 1;
     $topic['PAGES'] = "";
     if ($this->memberData['is_mod']) {
         $topic['posts'] += intval($topic['topic_queuedposts']);
     }
     if ($topic['posts']) {
         $mode = IPSCookie::get('topicmode');
         if ($mode == 'threaded') {
             $this->settings['display_max_posts'] = $this->settings['threaded_per_page'];
         }
         if (($topic['posts'] + 1) % $this->settings['display_max_posts'] == 0) {
             $pages = ($topic['posts'] + 1) / $this->settings['display_max_posts'];
         } else {
             $number = ($topic['posts'] + 1) / $this->settings['display_max_posts'];
             $pages = ceil($number);
         }
     }
     if ($pages > 1) {
         for ($i = 0; $i < $pages; ++$i) {
             $real_no = $i * $this->settings['display_max_posts'];
             $page_no = $i + 1;
             if ($page_no == 4 and $pages > 4) {
                 $topic['pages'][] = array('last' => 1, 'st' => ($pages - 1) * $this->settings['display_max_posts'], 'page' => $pages);
                 break;
             } else {
                 $topic['pages'][] = array('last' => 0, 'st' => $real_no, 'page' => $page_no);
             }
         }
     }
     //-----------------------------------------
     // Format some numbers
     //-----------------------------------------
     $topic['posts'] = $this->registry->getClass('class_localization')->formatNumber(intval($topic['posts']));
     $topic['views'] = $this->registry->getClass('class_localization')->formatNumber(intval($topic['views']));
     //-----------------------------------------
     // Jump to latest post / last time stuff...
     //-----------------------------------------
     if (!$gotonewpost) {
         $topic['go_new_post'] = true;
     } else {
         $topic['go_new_post'] = false;
     }
     $topic['last_post'] = $this->registry->getClass('class_localization')->getDate($topic['last_post'], 'SHORT');
     //-----------------------------------------
     // Linky pinky!
     //-----------------------------------------
     if ($topic['state'] == 'link') {
         $t_array = explode("&", $topic['moved_to']);
         $topic['tid'] = $t_array[0];
         $topic['forum_id'] = $t_array[1];
         $topic['title'] = $topic['title'];
         $topic['views'] = '--';
         $topic['posts'] = '--';
         $topic['prefix'] = $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap($this->settings['pre_moved']);
         $topic['go_new_post'] = false;
     } else {
         $topic['_posts'] = $topic['posts'];
         $topic['posts'] = $this->registry->getClass('output')->getTemplate('forum')->who_link($topic['tid'], $topic['posts']);
     }
     $topic['_hasqueued'] = 0;
     $mod = $this->memberData['forumsModeratorData'];
     $mod = $mod ? $mod : array();
     if (($this->memberData['g_is_supmod'] or $mod[$topic['forum_id']]['post_q'] and $mod[$topic['forum_id']]['post_q'] == 1) and $topic['topic_queuedposts']) {
         $topic['_hasqueued'] = 1;
     }
     //-----------------------------------------
     // Topic rating
     //-----------------------------------------
     $topic['_rate_img'] = '';
     if (isset($this->forum['forum_allow_rating']) and $this->forum['forum_allow_rating']) {
         if ($topic['topic_rating_total']) {
             $topic['_rate_int'] = round($topic['topic_rating_total'] / $topic['topic_rating_hits']);
         }
         //-----------------------------------------
         // Show image?
         //-----------------------------------------
         if ($topic['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $topic['_rate_int']) {
             $topic['_rate_img'] = $this->registry->getClass('output')->getTemplate('forum')->topic_rating_image($topic['_rate_int']);
         }
     }
     //-----------------------------------------
     // Already switched on?
     //-----------------------------------------
     if ($this->memberData['is_mod']) {
         if ($this->request['selectedtids']) {
             if (strstr(',' . $this->request['selectedtids'] . ',', ',' . $topic['tid'] . ',')) {
                 $topic['tidon'] = 1;
             } else {
                 $topic['tidon'] = 0;
             }
         }
     }
     return $topic;
 }
예제 #24
0
파일: forums.php 프로젝트: mover5/imobackup
 /**
  * Builds an array of forum data for use in the output template
  *
  * @return	array
  */
 public function renderForum()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['page'] = $this->request['changefilters'] ? 0 : (isset($this->request['page']) ? intval($this->request['page']) : 0);
     $announce_data = array();
     $topic_data = array();
     $other_data = array();
     $multi_mod_data = array();
     $footer_filter = array();
     $member_ids = array();
     //-----------------------------------------
     // Show?
     //-----------------------------------------
     if (isset($this->request['show']) and $this->request['show'] == 'sinceLastVisit') {
         $this->request['prune_day'] = 200;
     }
     //-----------------------------------------
     // Are we actually a moderator for this forum?
     //-----------------------------------------
     $mod = $this->memberData['forumsModeratorData'];
     if (!$this->memberData['g_is_supmod']) {
         if (!isset($mod[$this->forum['id']]) or !is_array($mod[$this->forum['id']])) {
             $this->memberData['is_mod'] = 0;
         }
     }
     //-----------------------------------------
     // Announcements
     //-----------------------------------------
     if (is_array($this->registry->cache()->getCache('announcements')) and count($this->registry->cache()->getCache('announcements'))) {
         $announcements = array();
         foreach ($this->registry->cache()->getCache('announcements') as $announce) {
             $order = $announce['announce_start'] ? $announce['announce_start'] . ',' . $announce['announce_id'] : $announce['announce_id'];
             if ($announce['announce_forum'] == '*') {
                 $announcements[$order] = $announce;
             } else {
                 if (strstr(',' . $announce['announce_forum'] . ',', ',' . $this->forum['id'] . ',')) {
                     $announcements[$order] = $announce;
                 }
             }
         }
         if (count($announcements)) {
             //-----------------------------------------
             // sort by start date
             //-----------------------------------------
             krsort($announcements);
             foreach ($announcements as $announce) {
                 if ($announce['announce_start']) {
                     $announce['announce_start'] = $this->lang->getDate($announce['announce_start'], 'date');
                 } else {
                     $announce['announce_start'] = '--';
                 }
                 $announce['announce_title'] = IPSText::stripslashes($announce['announce_title']);
                 $announce['forum_id'] = $this->forum['id'];
                 $announce['announce_views'] = intval($announce['announce_views']);
                 $announce_data[] = $announce;
                 $member_ids[$announce['member_id']] = $announce['member_id'];
             }
             $this->forum['_showAnnouncementsBar'] = 1;
         }
     }
     //-----------------------------------------
     // Read topics
     //-----------------------------------------
     $First = $this->registry->class_forums->pageToSt(intval($this->request['page']));
     //-----------------------------------------
     // Sort options
     //-----------------------------------------
     $cookie_prune = IPSCookie::get($this->forum['id'] . "_prune_day");
     $cookie_sort = IPSCookie::get($this->forum['id'] . "_sort_key");
     $cookie_sortb = IPSCookie::get($this->forum['id'] . "_sort_by");
     $cookie_fill = IPSCookie::get($this->forum['id'] . "_topicfilter");
     $prune_value = $this->selectVariable(array(1 => !empty($this->request['prune_day']) ? $this->request['prune_day'] : NULL, 2 => !empty($cookie_prune) ? $cookie_prune : NULL, 3 => $this->forum['prune'], 4 => '100'));
     $sort_key = $this->selectVariable(array(1 => !empty($this->request['sort_key']) ? $this->request['sort_key'] : NULL, 2 => !empty($cookie_sort) ? $cookie_sort : NULL, 3 => $this->forum['sort_key'], 4 => 'last_post'));
     $sort_by = $this->selectVariable(array(1 => !empty($this->request['sort_by']) ? $this->request['sort_by'] : NULL, 2 => !empty($cookie_sortb) ? $cookie_sortb : NULL, 3 => $this->forum['sort_order'], 4 => 'Z-A'));
     $topicfilter = $this->selectVariable(array(1 => !empty($this->request['topicfilter']) ? $this->request['topicfilter'] : NULL, 2 => !empty($cookie_fill) ? $cookie_fill : NULL, 3 => $this->forum['topicfilter'], 4 => 'all'));
     if (!empty($this->request['remember'])) {
         if ($this->request['prune_day']) {
             IPSCookie::set($this->forum['id'] . "_prune_day", $this->request['prune_day']);
         }
         if ($this->request['sort_key']) {
             IPSCookie::set($this->forum['id'] . "_sort_key", $this->request['sort_key']);
         }
         if ($this->request['sort_by']) {
             IPSCookie::set($this->forum['id'] . "_sort_by", $this->request['sort_by']);
         }
         if ($this->request['topicfilter']) {
             IPSCookie::set($this->forum['id'] . "_topicfilter", $this->request['topicfilter']);
         }
     }
     //-----------------------------------------
     // Figure out sort order, day cut off, etc
     //-----------------------------------------
     $Prune = $prune_value < 100 ? time() - $prune_value * 60 * 60 * 24 : (($prune_value == 200 and $this->memberData['member_id']) ? $this->memberData['last_visit'] : 0);
     $sort_keys = array('last_post' => 'sort_by_date', 'last_poster_name' => 'sort_by_last_poster', 'title' => 'sort_by_topic', 'starter_name' => 'sort_by_poster', 'start_date' => 'sort_by_start', 'topic_hasattach' => 'sort_by_attach', 'posts' => 'sort_by_replies', 'views' => 'sort_by_views');
     $prune_by_day = array('1' => 'show_today', '5' => 'show_5_days', '7' => 'show_7_days', '10' => 'show_10_days', '15' => 'show_15_days', '20' => 'show_20_days', '25' => 'show_25_days', '30' => 'show_30_days', '60' => 'show_60_days', '90' => 'show_90_days', '100' => 'show_all', '200' => 'show_last_visit');
     $sort_by_keys = array('Z-A' => 'descending_order', 'A-Z' => 'ascending_order');
     $filter_keys = array('all' => 'topicfilter_all', 'open' => 'topicfilter_open', 'hot' => 'topicfilter_hot', 'poll' => 'topicfilter_poll', 'locked' => 'topicfilter_locked', 'moved' => 'topicfilter_moved');
     if ($this->memberData['member_id']) {
         $filter_keys['istarted'] = 'topicfilter_istarted';
         $filter_keys['ireplied'] = 'topicfilter_ireplied';
     }
     //-----------------------------------------
     // check for any form funny business by wanna-be hackers
     //-----------------------------------------
     if (!isset($filter_keys[$topicfilter]) or !isset($sort_keys[$sort_key]) or !isset($prune_by_day[$prune_value]) or !isset($sort_by_keys[strtoupper($sort_by)])) {
         $this->registry->getClass('output')->showError('forums_bad_filter', 10339);
     }
     $r_sort_by = $sort_by == 'A-Z' ? 'ASC' : 'DESC';
     //-----------------------------------------
     // If sorting by starter, add secondary..
     //-----------------------------------------
     $sort_key_chk = $sort_key;
     if ($sort_key == 'starter_name') {
         $sort_key = "starter_name {$r_sort_by}, t.last_post DESC";
         $r_sort_by = '';
     }
     //-----------------------------------------
     // Additional queries?
     //-----------------------------------------
     $add_query_array = array();
     $add_query = "";
     switch ($topicfilter) {
         case 'all':
             break;
         case 'open':
             $add_query_array[] = "t.state='open'";
             break;
         case 'hot':
             $add_query_array[] = "t.state='open' AND t.posts + 1 >= " . intval($this->settings['hot_topic']);
             break;
         case 'locked':
             $add_query_array[] = "t.state='closed'";
             break;
         case 'moved':
             $add_query_array[] = "t.state='link'";
             break;
         case 'poll':
             $add_query_array[] = "(t.poll_state='open' OR t.poll_state=1)";
             break;
         default:
             break;
     }
     if (!$this->memberData['g_other_topics'] or $topicfilter == 'istarted' or !$this->forum['can_view_others'] and !$this->memberData['is_mod']) {
         $add_query_array[] = "t.starter_id='" . $this->memberData['member_id'] . "'";
     }
     /* Answered / unanswered */
     if (isset($this->request['answered']) && $this->registry->class_forums->answerTopicsEnabled($this->forum['id'])) {
         if ($this->request['answered'] == 'true') {
             $add_query_array[] = 't.topic_answered_pid != 0';
         } else {
             if ($this->request['answered'] == 'false') {
                 $add_query_array[] = 't.topic_answered_pid = 0';
             }
         }
     }
     $_SQL_EXTRA = '';
     $_SQL_APPROVED = '';
     $_SQL_AGE_PRUNE = '';
     if (count($add_query_array)) {
         $_SQL_EXTRA = ' AND ' . implode(' AND ', $add_query_array);
     }
     //-----------------------------------------
     // Moderator?
     //-----------------------------------------
     $this->request['modfilter'] = isset($this->request['modfilter']) ? $this->request['modfilter'] : '';
     $modFilter = '';
     if ($this->memberData['is_mod']) {
         if ($this->request['modfilter'] == 'unapproved') {
             $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('hidden'), 't.') . ' OR t.topic_queuedposts';
         } elseif ($this->permissions['TopicSoftDeleteSee']) {
             if ($this->request['modfilter'] == 'hidden') {
                 $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('sdeleted'), 't.') . ' OR t.topic_deleted_posts';
             } else {
                 $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden', 'sdeleted'), 't.');
             }
         } else {
             $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'hidden'), 't.');
         }
     } else {
         if ($this->permissions['TopicSoftDeleteSee']) {
             $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible', 'sdeleted'), 't.');
         } else {
             $modFilter = $this->registry->class_forums->fetchTopicHiddenQuery(array('visible'), 't.');
         }
     }
     if ($modFilter) {
         $_SQL_APPROVED = ' AND (' . $modFilter . ')';
     }
     if ($Prune) {
         if ($prune_value == 200) {
             /* Just new content, don't show pinned, please */
             if ($modFilter) {
                 $_SQL_AGE_PRUNE = " AND (t.last_post > {$Prune} AND ( {$modFilter} ) )";
             } else {
                 $_SQL_AGE_PRUNE = " AND (t.last_post > {$Prune})";
             }
         } else {
             if ($modFilter) {
                 $_SQL_AGE_PRUNE = " AND (t.pinned=1 or t.last_post > {$Prune} AND ( {$modFilter} ) )";
             } else {
                 $_SQL_AGE_PRUNE = " AND (t.pinned=1 or t.last_post > {$Prune})";
             }
         }
     }
     //-----------------------------------------
     // Query the database to see how many topics there are in the forum
     //-----------------------------------------
     if ($topicfilter == 'ireplied') {
         //-----------------------------------------
         // Checking topics we've replied to?
         //-----------------------------------------
         $this->DB->build(array('select' => 'COUNT(' . $this->DB->buildDistinct('p.topic_id') . ') as max', 'from' => array('topics' => 't'), 'where' => "t.forum_id={$this->forum['id']} AND p.author_id=" . $this->memberData['member_id'] . " AND p.new_topic=0" . $_SQL_APPROVED . $_SQL_AGE_PRUNE, 'add_join' => array(array('from' => array('posts' => 'p'), 'where' => 'p.topic_id=t.tid'))));
         $this->DB->execute();
         $total_possible = $this->DB->fetch();
     } else {
         if ($_SQL_EXTRA or $_SQL_AGE_PRUNE or $this->request['modfilter']) {
             $this->DB->build(array('select' => 'COUNT(*) as max', 'from' => 'topics t', 'where' => "t.forum_id=" . $this->forum['id'] . $_SQL_APPROVED . $_SQL_AGE_PRUNE . $_SQL_EXTRA));
             $this->DB->execute();
             $total_possible = $this->DB->fetch();
         } else {
             $total_possible['max'] = $this->memberData['is_mod'] ? $this->forum['topics'] + $this->forum['queued_topics'] : $this->forum['topics'];
             if ($this->permissions['TopicSoftDeleteSee'] and $this->forum['deleted_topics']) {
                 $total_possible['max'] += intval($this->forum['deleted_topics']);
             }
             $Prune = 0;
         }
     }
     //-----------------------------------------
     // Generate the forum page span links
     //-----------------------------------------
     $_extraStuff = '';
     if ($this->request['modfilter']) {
         $_extraStuff .= "&amp;modfilter=" . $this->request['modfilter'];
     }
     if (isset($this->request['answered']) && $this->registry->class_forums->answerTopicsEnabled($this->forum['id'])) {
         $_extraStuff .= "&amp;answered=" . $this->request['answered'];
     }
     $this->forum['SHOW_PAGES'] = $this->registry->getClass('output')->generatePagination(array('totalItems' => $total_possible['max'], 'itemsPerPage' => $this->settings['display_max_topics'], 'currentStartValue' => intval($this->request['page']), 'isPagesMode' => true, 'seoTitle' => $this->forum['name_seo'], 'disableSinglePage' => false, 'baseUrl' => "showforum=" . $this->forum['id'] . "&amp;prune_day={$prune_value}&amp;sort_by={$sort_by}&amp;sort_key={$sort_key_chk}&amp;topicfilter={$topicfilter}{$_extraStuff}"));
     //-----------------------------------------
     // Start printing the page
     //-----------------------------------------
     $other_data = array('forum_data' => $this->forum, 'hasMore' => $this->registry->class_forums->pageToSt($this->request['page']) + $this->settings['display_max_topics'] > $total_possible['max'] ? false : true, 'can_edit_topics' => $this->can_edit_topics, 'can_open_topics' => $this->can_open_topics, 'can_close_topics' => $this->can_close_topics, 'can_move_topics' => $this->can_move_topics);
     $total_topics_printed = 0;
     //-----------------------------------------
     // Get main topics
     //-----------------------------------------
     $topic_array = array();
     $topic_ids = array();
     $topic_sort = "";
     //-----------------------------------------
     // Cut off?
     //-----------------------------------------
     $modAll = ($this->memberData['g_is_supmod'] or isset($this->memberData['forumsModeratorData'][$this->forum['id']]) and ($this->memberData['forumsModeratorData'][$this->forum['id']]['delete_topic'] or $this->memberData['forumsModeratorData'][$this->forum['id']]['move_topic'] or $this->memberData['forumsModeratorData'][$this->forum['id']]['split_merge']));
     $parse_dots = 1;
     if ($topicfilter == 'ireplied') {
         //-----------------------------------------
         // Checking topics we've replied to?
         // No point in getting dots again...
         //-----------------------------------------
         $parse_dots = 0;
         $_joins = array(array('select' => 't.*', 'from' => array('posts' => 'p'), 'where' => 'p.topic_id=t.tid AND p.author_id=' . $this->memberData['member_id']));
         if ($this->settings['tags_enabled'] and !$this->forum['bw_disable_tagging']) {
             $_joins[] = $this->registry->tags->getCacheJoin(array('meta_id_field' => 't.tid'));
         }
         // For some reason, mySQL doesn't like the distinct + t.* being in reverse order...
         $this->DB->build(array('select' => $this->DB->buildDistinct('p.author_id'), 'from' => array('topics' => 't'), 'where' => "t.forum_id=" . $this->forum['id'] . " AND t.pinned IN (0,1)" . $_SQL_APPROVED . $_SQL_AGE_PRUNE . " AND p.new_topic=0", 'order' => "t.pinned desc,{$topic_sort} t.{$sort_key} {$r_sort_by}", 'limit' => array(intval($First), intval($this->settings['display_max_topics'])), 'add_join' => $_joins));
         $this->DB->execute();
     } else {
         $this->DB->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => "t.forum_id=" . $this->forum['id'] . " AND t.pinned IN (0,1)" . $_SQL_APPROVED . $_SQL_AGE_PRUNE . $_SQL_EXTRA, 'order' => 't.pinned DESC, ' . $topic_sort . ' t.' . $sort_key . ' ' . $r_sort_by, 'limit' => array(intval($First), $this->settings['display_max_topics']), 'add_join' => ($this->settings['tags_enabled'] and !$this->forum['bw_disable_tagging']) ? array($this->registry->tags->getCacheJoin(array('meta_id_field' => 't.tid'))) : array()));
         $this->DB->execute();
     }
     while ($t = $this->DB->fetch()) {
         /* Should we display the moderate checkbox for this post? */
         $t['moddable'] = FALSE;
         if ($modAll or isset($this->memberData['forumsModeratorData'][$this->forum['id']]) and ($t['pinned'] == 0 and $this->memberData['forumsModeratorData'][$this->forum['id']]['pin_topic'] or $t['pinned'] == 1 and $this->memberData['forumsModeratorData'][$this->forum['id']]['unpin_topic'] or $t['state'] == 'open' and $this->memberData['forumsModeratorData'][$this->forum['id']]['close_topic'] or $t['state'] == 'closed' and $this->memberData['forumsModeratorData'][$this->forum['id']]['open_topic'])) {
             $t['moddable'] = TRUE;
         }
         /* Add to array */
         $topic_array[$t['tid']] = $t;
         $topic_ids[$t['tid']] = $t['tid'];
         if ($t['last_poster_id']) {
             $member_ids[$t['last_poster_id']] = $t['last_poster_id'];
         }
         if ($t['starter_id']) {
             $member_ids[$t['starter_id']] = $t['starter_id'];
         }
     }
     ksort($topic_ids);
     //-----------------------------------------
     // Are we dotty?
     //-----------------------------------------
     if ($this->settings['show_user_posted'] == 1 and $this->memberData['member_id'] and count($topic_ids) and $parse_dots) {
         $_queued = $this->registry->class_forums->fetchPostHiddenQuery(array('visible'), '');
         $this->DB->build(array('select' => $this->DB->buildDistinct('topic_id'), 'from' => 'posts', 'where' => $_queued . ' AND author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode(',', $topic_ids) . ')'));
         $this->DB->execute();
         while ($p = $this->DB->fetch()) {
             if (is_array($topic_array[$p['topic_id']])) {
                 $topic_array[$p['topic_id']]['author_id'] = $this->memberData['member_id'];
             }
         }
     }
     //-----------------------------------------
     // Get needed members
     //-----------------------------------------
     if (count($member_ids)) {
         $_members = IPSMember::load($member_ids);
         //-----------------------------------------
         // Add member data to announcements
         //-----------------------------------------
         $new_announces = array();
         foreach ($announce_data as $announce) {
             $announce = array_merge($announce, IPSMember::buildDisplayData($_members[$announce['member_id']]));
             $new_announces[] = $announce;
         }
         $announce_data = $new_announces;
     }
     //-----------------------------------------
     // Show meh the topics!
     //-----------------------------------------
     $adCodeSet = false;
     foreach ($topic_array as $topic) {
         /* Add member */
         if ($topic['last_poster_id']) {
             $topic = array_merge(IPSMember::buildDisplayData($_members[$topic['last_poster_id']]), $topic);
         } else {
             $topic = array_merge(IPSMember::buildProfilePhoto(array()), $topic);
         }
         if ($topic['starter_id']) {
             $topic['_starter'] = $_members[$topic['starter_id']];
         }
         /* AD Code */
         if ($this->registry->getClass('IPSAdCode')->userCanViewAds() && !$adCodeSet) {
             $topic['_adCode'] = $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_forum_view_topic_code');
             if ($topic['_adCode']) {
                 $adCodeSet = true;
             }
         }
         if ($topic['pinned']) {
             $this->pinned_topic_count++;
         }
         $topic_data[$topic['tid']] = $this->renderEntry($topic);
         $total_topics_printed++;
     }
     //-----------------------------------------
     // Finish off the rest of the page  $filter_keys[$topicfilter]))
     //-----------------------------------------
     $sort_by_html = "";
     $sort_key_html = "";
     $prune_day_html = "";
     $filter_html = "";
     foreach ($sort_by_keys as $k => $v) {
         $sort_by_html .= $k == $sort_by ? "<option value='{$k}' selected='selected'>{$this->lang->words[$sort_by_keys[$k]]}</option>\n" : "<option value='{$k}'>{$this->lang->words[$sort_by_keys[$k]]}</option>\n";
     }
     foreach ($sort_keys as $k => $v) {
         $sort_key_html .= $k == $sort_key_chk ? "<option value='{$k}' selected='selected'>{$this->lang->words[$sort_keys[$k]]}</option>\n" : "<option value='{$k}'>{$this->lang->words[$sort_keys[$k]]}</option>\n";
     }
     foreach ($prune_by_day as $k => $v) {
         $prune_day_html .= $k == $prune_value ? "<option value='{$k}' selected='selected'>{$this->lang->words[$prune_by_day[$k]]}</option>\n" : "<option value='{$k}'>{$this->lang->words[$prune_by_day[$k]]}</option>\n";
     }
     foreach ($filter_keys as $k => $v) {
         $filter_html .= $k == $topicfilter ? "<option value='{$k}' selected='selected'>{$this->lang->words[$filter_keys[$k]]}</option>\n" : "<option value='{$k}'>{$this->lang->words[$filter_keys[$k]]}</option>\n";
     }
     $footer_filter['sort_by'] = $sort_key_html;
     $footer_filter['sort_order'] = $sort_by_html;
     $footer_filter['sort_prune'] = $prune_day_html;
     $footer_filter['topic_filter'] = $filter_html;
     if ($this->memberData['is_mod']) {
         $count = 0;
         $other_pages = 0;
         if ($this->request['selectedtids'] != "") {
             $tids = explode(",", $this->request['selectedtids']);
             if (is_array($tids) and count($tids)) {
                 foreach ($tids as $tid) {
                     if ($tid != '') {
                         if (!isset($topic_array[$tid])) {
                             $other_pages++;
                         }
                         $count++;
                     }
                 }
             }
         }
         $this->lang->words['f_go'] .= " ({$count})";
         if ($other_pages) {
             $this->lang->words['f_go'] .= " ({$other_pages} " . $this->lang->words['jscript_otherpage'] . ")";
         }
     }
     //-----------------------------------------
     // Multi-moderation?
     //-----------------------------------------
     if ($this->memberData['is_mod']) {
         $mm_array = $this->registry->getClass('class_forums')->getMultimod($this->forum['id']);
         if (is_array($mm_array) and count($mm_array)) {
             foreach ($mm_array as $m) {
                 $multi_mod_data[] = $m;
             }
         }
     }
     //-----------------------------------------
     // Need to update topics?
     //-----------------------------------------
     if (count($this->update_topics_open)) {
         $this->DB->update('topics', array('state' => 'open'), 'tid IN (' . implode(",", $this->update_topics_open) . ')');
     }
     if (count($this->update_topics_close)) {
         $this->DB->update('topics', array('state' => 'closed'), 'tid IN (' . implode(",", $this->update_topics_close) . ')');
     }
     /* Got soft delete tids? */
     if (is_array($this->_sdTids) and count($this->_sdTids)) {
         $other_data['sdData'] = IPSDeleteLog::fetchEntries($this->_sdTids, 'topic', false);
     }
     /* Fetch follow data */
     $other_data['follow_data'] = $this->_like->render('summary', $this->forum['id']);
     return array('announce_data' => $announce_data, 'topic_data' => $topic_data, 'other_data' => $other_data, 'multi_mod_data' => $multi_mod_data, 'footer_filter' => $footer_filter, 'active_users' => $this->_generateActiveUserData());
 }
 /**
  * Save cookie
  *
  * @access	protected
  * @param	string		Key name (leave blank to save out all cookies)
  * @return	@e void
  */
 protected function _saveCookie($key = '')
 {
     if (!$this->_useCookies) {
         return;
     }
     if ($key and is_array($this->_cookie[$key])) {
         IPSCookie::set($key, $this->_cookie[$key], 1);
     } else {
         foreach ($this->_cookie as $k => $v) {
             if (is_array($v) and !count($v)) {
                 /* Do we have a cookie? */
                 $test = IPSCookie::get($k);
                 if ($test) {
                     /* set a blank, non sticky cookie */
                     IPSCookie::set($k, '-', 0, -1);
                 } else {
                     continue;
                 }
             } else {
                 IPSDebug::addMessage('Cookie SAVED: ' . $k . ' - ' . $this->_compressCookie($v));
                 IPSCookie::set($k, $this->_compressCookie($v), 1);
             }
         }
     }
 }
예제 #26
0
파일: search.php 프로젝트: mover5/imobackup
 /**
  * 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('&amp;', '&', 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'] and !is_array($this->request['search_date_end'])) ? $this->request['search_date_end'] : 'now');
     IPSSearchRegistry::set('in.search_date_start', ($this->request['search_date_start'] and !is_array($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(IPSSearchRegistry::get('in.search_date_start')) > time()) {
         IPSSearchRegistry::set('in.search_date_start', 'now');
     }
     if (IPSSearchRegistry::get('in.search_date_end') and strtotime(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(IPSSearchRegistry::get('in.search_date_start')) > strtotime(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("&quot;", '"', IPSCookie::get('sfct'));
         $last_term = str_replace("&amp;", '&', $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() . '&amp;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();
         }
     }
     if ($count < 1) {
         $this->registry->output->setHeaderCode(404);
     }
     /* 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'));
 }
 /**
  * Lists currently installed languages
  *
  * @return	@e void
  */
 public function languagesList()
 {
     /* Do we have a valid translation session? */
     $sessionData = $this->cache->getCache('translate_session');
     $hasTranslate = false;
     /* Check */
     if (!empty($sessionData['lang_id']) and count($sessionData['files'])) {
         $hasTranslate = true;
     }
     /* Fallback for the recache all button */
     $forceEnglish = IPSCookie::get('forceEnglish');
     if (!$this->lang->words['language_list_recache'] || $forceEnglish) {
         $this->lang->words['language_list_recache'] = 'Recache all...';
     }
     //-----------------------------------------
     // Get languages
     //-----------------------------------------
     $rows = array();
     $this->DB->build(array('select' => '*', 'from' => 'core_sys_lang'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         /* Get Local Data */
         //setlocale( LC_ALL, $r['lang_short'] );
         IPSLib::setlocale($r['lang_short']);
         $this->registry->class_localization->local_data = localeconv();
         $_menu = array();
         if ($r['lang_protected'] && !IN_DEV) {
             $_menu[] = array("", $this->lang->words['lang_pack_protected'], 'edit');
         } else {
             $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=list_word_packs&amp;id={$r['lang_id']}", $this->lang->words['language_list_translate'], 'info');
             /* If we don't have a current session... */
             if (!$hasTranslate) {
                 $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=translateExtSplash&amp;id={$r['lang_id']}", $this->lang->words['language_list_translate_ext'], 'info');
             }
         }
         $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=copy_lang_pack&amp;id={$r['lang_id']}", $this->lang->words['language_list_copy']);
         $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=export&amp;id={$r['lang_id']}", $this->lang->words['l_xmlexportfull'], 'export');
         if ($r['lang_id']) {
             $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=rebuildFromXml&amp;id={$r['lang_id']}&amp;type=public", $this->lang->words['rebuild_lang_from_xml']);
         }
         foreach (ipsRegistry::$applications as $app_dir => $app_data) {
             $_menu[] = array("{$this->settings['base_url']}{$this->form_code}&amp;do=export&amp;id={$r['lang_id']}&amp;app_dir={$app_dir}", $this->lang->words['l_xmlexport'] . $app_data['app_title'], 'export');
         }
         //-----------------------------------------
         // Data for output
         //-----------------------------------------
         $rows[] = array('title' => $r['lang_title'], 'local' => $r['lang_short'], 'date' => $this->registry->class_localization->getDate(time(), 'long', 1) . '<br />' . $this->registry->class_localization->getDate(time(), 'short', 1), 'money' => $this->registry->class_localization->formatMoney('12345231.12', 0), 'default' => $r['lang_default'], 'menu' => $_menu, 'id' => $r['lang_id'], 'protected' => $r['lang_protected']);
     }
     //-----------------------------------------
     // Reset locale
     //-----------------------------------------
     IPSLib::setlocale($this->registry->class_localization->local);
     //setlocale( LC_ALL, $this->registry->class_localization->local );
     $this->registry->class_localization->local_data = localeconv();
     //-----------------------------------------
     // Output
     //-----------------------------------------
     $this->registry->output->html .= $this->html->languages_list($rows, $hasTranslate);
 }
 /**
  * Constructor
  * 
  * @access	public
  * @param	string	[$lang]		Language file to load, english by default
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make objects */
     $this->DB = $registry->DB();
     $this->settings = $registry->fetchSettings();
     $this->member = $registry->member();
     $this->cache = $registry->cache();
     $this->caches =& $registry->cache()->fetchCaches();
     $this->request = $registry->fetchRequest();
     $this->memberData =& $registry->member()->fetchMemberData();
     /* Rebuild the cache if needed */
     if (!$this->caches['lang_data']) {
         $this->rebuildLanguagesCache();
     }
     /* Find the lang we need */
     if ($this->caches['lang_data']) {
         foreach ($this->caches['lang_data'] as $_lang) {
             $this->languages[] = $_lang;
             if ($_lang['lang_default']) {
                 $this->local = $_lang['lang_short'];
                 $this->lang_id = $_lang['lang_id'];
                 $this->language_dir = $_lang['lang_id'];
                 /* Guests get the default */
                 if (!$this->memberData['member_id']) {
                     $this->member->language_id = $this->lang_id;
                 }
             }
         }
     }
     /* Got a guest cookie? */
     if (!$this->memberData['member_id']) {
         $langCookie = IPSCookie::get('language');
         if ($langCookie) {
             $this->member->language_id = trim(IPSText::parseCleanValue($langCookie));
         }
     }
     /* Forcing Engrish? */
     if ($forceCookie = IPSCookie::get('forceEnglish')) {
         if ($forceCookie) {
             $this->_forceEnglish = true;
         }
     }
     //-----------------------------------------
     // Time options
     //-----------------------------------------
     /* 	%b is month abbr
     			%B is full month
     			%d is date 01-31
     			%Y is 4 digit year
     			%g is 2 digit year
     			%I is hour 01-12
     			%H - hour as a decimal number using a 24-hour clock (range 00 to 23) 
     			%M is min 01-59
     			%p is am/pm */
     $this->time_options = array('JOINED' => $this->settings['clock_joined'] ? $this->settings['clock_joined'] : '%d-%B %y', 'SHORT' => $this->settings['clock_short'] ? $this->settings['clock_short'] : '%b %d %Y %I:%M %p', 'LONG' => $this->settings['clock_long'] ? $this->settings['clock_long'] : '%d %B %Y - %I:%M %p', 'TINY' => $this->settings['clock_tiny'] ? $this->settings['clock_tiny'] : '%d %b %Y - %H:%M', 'DATE' => $this->settings['clock_date'] ? $this->settings['clock_date'] : '%d %b %Y', 'TIME' => 'h:i A', 'ACP' => '%d %B %Y, %H:%M', 'ACP2' => '%d %B %Y, %H:%M');
     //--------------------------------
     // Did we choose a language?
     //--------------------------------
     if (isset($this->request['setlanguage']) and $this->request['setlanguage'] and $this->request['langid']) {
         /* Forcing english? */
         if ($this->request['langid'] == '__english__') {
             IPSDebug::addMessage("forceEnglish cookie written");
             IPSCookie::set('forceEnglish', 1, 0);
             $this->_forceEnglish = true;
         } else {
             if ($this->request['k'] == $this->member->form_hash and is_array(ipsRegistry::cache()->getCache('lang_data')) and count(ipsRegistry::cache()->getCache('lang_data'))) {
                 foreach (ipsRegistry::cache()->getCache('lang_data') as $data) {
                     if ($data['lang_id'] == $this->request['langid']) {
                         if ($this->memberData['member_id']) {
                             IPSMember::save($this->memberData['member_id'], array('core' => array('language' => $data['lang_id'])));
                         } else {
                             IPSCookie::set('language', $data['lang_id']);
                         }
                         $this->member->language_id = $data['lang_id'];
                         $this->member->setProperty('language', $data['lang_id']);
                         break;
                     }
                 }
             }
         }
     }
     //--------------------------------
     // Now set it
     //--------------------------------
     if ($this->member->language_id) {
         foreach ($this->caches['lang_data'] as $_lang) {
             if ($_lang['lang_id'] == $this->member->language_id) {
                 $this->local = $_lang['lang_short'];
                 $this->lang_id = $_lang['lang_id'];
                 $this->language_dir = $_lang['lang_id'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Set locale
     //-----------------------------------------
     setlocale(LC_ALL, $this->local);
     $this->local_data = localeconv();
     //-----------------------------------------
     // Using in_dev override
     //-----------------------------------------
     if (IN_DEV and !$this->_forceEnglish) {
         if (is_dir(IPS_CACHE_PATH . 'cache/lang_cache/master_lang')) {
             $this->lang_id = 'master_lang';
         }
     }
 }
 /**
  * Attempt to fetch a skin based on member's preferences
  *
  * @access	private
  * @return	mixed		INT skin ID or FALSE if none found
  */
 private function _fetchSkinByMemberPrefs()
 {
     $useSkinID = $this->memberData['member_id'] ? intval($this->memberData['skin']) : intval(IPSCookie::get('guestSkinChoice'));
     if (!$useSkinID) {
         $useSkinID = false;
     }
     /* Make sure it's legal */
     if ($useSkinID) {
         $_test = $this->allSkins[$useSkinID];
         if ($_test['_youCanUse'] !== TRUE) {
             $useSkinID = FALSE;
         }
     }
     if (!$useSkinID) {
         $useSkinID = FALSE;
     }
     if ($useSkinID !== FALSE) {
         IPSDebug::addMessage("Skin set found via member's preferences. Using set #" . $useSkinID);
     }
     return $useSkinID;
 }
예제 #30
0
 /**
  * Parse/format the online list data for the records
  *
  * @author	Brandon Farber
  * @param	array 			Online list rows to check against
  * @return	array 			Online list rows parsed
  */
 public function parseOnlineEntries($rows)
 {
     if (!is_array($rows) or !count($rows)) {
         return $rows;
     }
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $forums_raw = array();
     $forums = array();
     $topics_raw = array();
     $topics = array();
     $posts_raw = array();
     $posts = array();
     $final = array();
     //-----------------------------------------
     // Extract the topic/forum data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'forums' or !$row['current_module']) {
             continue;
         }
         if ($row['current_section'] == 'forums') {
             $forums_raw[$row['location_2_id']] = '';
         } else {
             if ($row['current_section'] == 'topics') {
                 $topics_raw[$row['location_1_id']] = $row['location_1_id'];
             } else {
                 if ($row['current_section'] == 'post') {
                     $forums_raw[$row['location_2_id']] = '';
                     $topics_raw[$row['location_1_id']] = $row['location_1_id'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Get the forums, if you dare
     //-----------------------------------------
     ipsRegistry::getAppClass('forums');
     if (count($forums_raw)) {
         foreach (ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum) {
             if (isset($forums_raw[$fid])) {
                 if (ipsRegistry::getClass('permissions')->check('view', $forum) !== false) {
                     $forums[$fid] = $forum['name'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Get the topics, if you care
     //-----------------------------------------
     if (count($topics_raw)) {
         $_approved = ipsRegistry::getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
         ipsRegistry::DB()->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.tid IN(' . implode(',', $topics_raw) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'), 'add_join' => array(array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'", 'type' => 'left'))));
         $tr = ipsRegistry::DB()->execute();
         while ($r = ipsRegistry::DB()->fetch($tr)) {
             $_forum = ipsRegistry::getClass('class_forums')->getForumByid($r['forum_id']);
             if (count($_forum) and ipsRegistry::getClass('class_forums')->forumsCheckAccess($_forum['id'], false, 'topic', $r, true)) {
                 if (ipsRegistry::getClass('permissions')->check('read', $_forum) !== false) {
                     if ($_forum['password'] == '' or IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', $_forum['password_override'])) or IPSCookie::get("ipbforumpass_{$_forum['id']}") == md5($_forum['password'])) {
                         $topics[$r['tid']] = $r['title'];
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Put humpty dumpty together again
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'forums') {
             $final[$row['id']] = $row;
             continue;
         }
         if (!$row['current_module']) {
             $row['where_line'] = ipsRegistry::getClass('class_localization')->words['board_index'];
             $final[$row['id']] = $row;
             continue;
         }
         if ($row['current_section'] == 'forums') {
             if (isset($forums[$row['location_2_id']])) {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_sf'];
                 $row['where_line_more'] = $forums[$row['location_2_id']];
                 $row['where_link'] = 'showforum=' . $row['location_2_id'];
                 $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
             }
         } else {
             if ($row['current_section'] == 'topics') {
                 if (isset($topics[$row['location_1_id']])) {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_st'];
                     $row['where_line_more'] = $topics[$row['location_1_id']];
                     $row['where_link'] = 'showtopic=' . $row['location_1_id'];
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
                 }
             } else {
                 if ($row['current_section'] == 'post') {
                     if ($row['location_1_id']) {
                         if (isset($topics[$row['location_1_id']])) {
                             $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postrep'];
                             $row['where_line_more'] = $topics[$row['location_1_id']];
                             $row['where_link'] = 'showtopic=' . $row['location_1_id'];
                             $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
                         }
                     } else {
                         if ($row['location_2_id']) {
                             if (isset($forums[$row['location_2_id']])) {
                                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postnew'];
                                 $row['where_line_more'] = $forums[$row['location_2_id']];
                                 $row['where_link'] = 'showforum=' . $row['location_2_id'];
                                 $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
                             }
                         }
                     }
                 }
             }
         }
         $final[$row['id']] = $row;
     }
     return $final;
 }