/**
  * 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;
 }
Example #3
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');
 }
Example #4
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;
 }
Example #5
0
 /**
  * Changes the skin ID choice for the member
  *
  * @return	@e void
  */
 protected function _change()
 {
     $skinId = $this->request['skinId'];
     if ($this->request['skinId'] != 'setAsMobile' && $this->request['k'] != $this->member->form_hash) {
         $this->registry->output->showError('no_permission', 10122243, FALSE, '', 403);
     }
     if (is_numeric($skinId)) {
         /* Rudimentaty check */
         if ($this->registry->output->allSkins[$skinId]['_youCanUse'] and $this->registry->output->allSkins[$skinId]['_gatewayExclude'] !== TRUE) {
             if ($this->memberData['member_id']) {
                 /* Update... */
                 IPSMember::save($this->memberData['member_id'], array('core' => array('skin' => $skinId)));
             } else {
                 IPSCookie::set('guestSkinChoice', $skinId);
             }
             /* Make sure mobile skin is removed */
             IPSCookie::set("mobileApp", 'false', -1);
             IPSCookie::set("mobileBrowser", 0, -1);
             /* remove user agent bypass */
             IPSCookie::set("uagent_bypass", 0, -1);
             /* Update member row */
             $this->memberData['skin'] = $skinId;
         }
     } else {
         if ($skinId == 'fullVersion') {
             /* Set cookie */
             IPSCookie::set("uagent_bypass", 1, -1);
             IPSCookie::set("mobileBrowser", 0, -1);
         } else {
             if ($skinId == 'unlockUserAgent') {
                 $this->member->updateMySession(array('uagent_bypass' => 1));
                 /* Set cookie */
                 IPSCookie::set("uagent_bypass", 1, -1);
                 IPSCookie::set("mobileBrowser", 0, -1);
             } else {
                 if ($skinId == 'setAsMobile') {
                     $this->member->updateMySession(array('uagent_bypass' => 0));
                     /* Set cookie */
                     IPSCookie::set("uagent_bypass", 0, -1);
                     IPSCookie::set("mobileBrowser", 1, -1);
                 }
             }
         }
     }
     /* Redirect */
     if ($this->settings['query_string_real']) {
         $url = preg_replace('#&k=(?:\\S+?)($|&)#', '\\1', str_replace('&amp;', '&', $this->settings['query_string_real']));
         $url = preg_replace('#&settingNewSkin=(?:\\S+?)($|&)#', '\\1', $url);
         $url = preg_replace('#&setAsMobile=(?:\\S+?)($|&)#', '\\1', $url);
         $this->registry->getClass('output')->silentRedirect($this->settings['board_url'] . '?' . $url, '', true);
     }
     $this->registry->getClass('output')->silentRedirect($this->settings['board_url'], '', true);
 }
Example #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;
 }
 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;
 }
Example #8
0
 /**
  * Figure out what api is being called
  *
  * @return	@e void
  */
 public function dispatch()
 {
     /* Force a cookie to identify as a mobile app */
     if (!$this->request['dontSetCookie']) {
         IPSCookie::set("mobileApp", 'true', -1);
     }
     /* Figure out the action */
     switch ($this->request['api']) {
         case 'getNotifications':
             $this->_handleGetNotifications();
             break;
         case 'toggleNotifications':
             $this->_handleToggleNotifications();
             break;
         case 'toggleNotificationKey':
             $this->_hanldeToggleNotificaionKey();
             break;
         case 'notificationTypes':
             $this->_handleNotificationTypes();
             break;
         case 'login':
             $this->_handleLogin();
             break;
         case 'postImage':
             $this->_handlePostImage();
             break;
         case 'postStatus':
             $this->_handlePostStatus();
             break;
         case 'postTopic':
             $this->_handlePostTopic();
             break;
         case 'postReply':
             $this->_handlePostReply();
             break;
         case 'getStyle':
             $this->_handleGetStyle();
             break;
         case 'getApns':
             $this->_getApns();
             break;
         default:
             $this->_invalidApi();
             break;
     }
 }
 /**
  * Wrapper for loginAuthenticate - returns more information
  *
  * @return	mixed		array [0=Words to show, 1=URL to send to, 2=error message language key]
  */
 public function verifyLogin()
 {
     $url = "";
     $member = array();
     $username = '';
     $email = '';
     $password = trim($this->request['ips_password']);
     $errors = '';
     $core = array();
     $mobileSSO = false;
     $memberData = $this->registry->member()->fetchMemberData();
     /* Mobile app + sso */
     if ($memberData['userAgentType'] == 'mobileApp') {
         $file = IPS_ROOT_PATH . 'sources/classes/session/ssoMobileAppLogIn.php';
         if (is_file($file)) {
             require_once $file;
             if (class_exists('ssoMobileAppLogIn')) {
                 $mobileSSO = true;
                 $logIn = new ssoMobileAppLogIn($this->registry);
                 $done = $logIn->authenticate($this->request['ips_username'], $password);
                 $this->return_code = $done['code'];
                 $this->member_data = IPSMember::load(intval($done['memberId']));
                 $member = $this->member_data;
             }
         }
     }
     /* No mobile log in? Log in normally */
     if (!$mobileSSO) {
         //-----------------------------------------
         // Is this a username or email address?
         //-----------------------------------------
         if (IPSText::checkEmailAddress($this->request['ips_username'])) {
             $email = $this->request['ips_username'];
         } else {
             $username = $this->request['ips_username'];
         }
         //-----------------------------------------
         // Check auth
         //-----------------------------------------
         $this->loginAuthenticate($username, $email, $password);
         $member = $this->member_data;
     }
     //-----------------------------------------
     // Check return code...
     //-----------------------------------------
     if ($this->return_code != 'SUCCESS') {
         if ($this->return_code == 'MISSING_DATA') {
             return array(null, null, 'complete_form');
         }
         if ($this->return_code == 'ACCOUNT_LOCKED') {
             $extra = "<!-- -->";
             if ($this->settings['ipb_bruteforce_unlock']) {
                 if ($this->account_unlock) {
                     $time = time() - $this->account_unlock;
                     $time = $this->settings['ipb_bruteforce_period'] - ceil($time / 60) > 0 ? $this->settings['ipb_bruteforce_period'] - ceil($time / 60) : 1;
                 }
             }
             return array(null, null, $this->settings['ipb_bruteforce_unlock'] ? 'bruteforce_account_unlock' : 'bruteforce_account_lock', $time);
         } else {
             if ($this->return_code == 'MISSING_EXTENSIONS') {
                 return array(null, null, 'missing_extensions');
             } else {
                 if ($this->return_code == 'FLAGGED_REMOTE') {
                     return array(null, null, 'flagged_remote');
                 } else {
                     if ($this->return_code == 'VALIDATING') {
                         if ($this->revalidate_url == 'ADMIN_VALIDATION') {
                             return array(null, null, 'validating_remote', ipsRegistry::getClass('class_localization')->words['admin_validation_msg']);
                         } else {
                             return array(null, null, 'validating_remote', "<a href='{$this->revalidate_url}' target='_blank'>" . ipsRegistry::getClass('class_localization')->words['resend_val'] . "</a>");
                         }
                     } else {
                         return array(null, null, 'wrong_auth');
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Is this a partial member?
     // Not completed their sign in?
     //-----------------------------------------
     if ($member['members_created_remote'] and isset($member['full']) and !$member['full']) {
         return array($this->registry->getClass('class_localization')->words['partial_login'], $this->settings['base_url'] . 'app=core&amp;module=global&amp;section=register&amp;do=complete_login&amp;mid=' . $member['member_id'] . '&amp;key=' . $member['timenow']);
     }
     //-----------------------------------------
     // Generate a new log in key
     //-----------------------------------------
     $_ok = 1;
     $_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
     $_sticky = $_time ? 0 : 1;
     $_days = $_time ? $this->settings['login_key_expire'] : 365;
     if (!$member['member_login_key'] or $this->settings['login_key_expire'] and time() > $member['member_login_key_expire']) {
         $member['member_login_key'] = IPSMember::generateAutoLoginKey();
         $core['member_login_key'] = $member['member_login_key'];
         $core['member_login_key_expire'] = $_time;
     }
     //-----------------------------------------
     // Cookie me softly?
     //-----------------------------------------
     if ($this->request['rememberMe']) {
         IPSCookie::set("member_id", $member['member_id'], 1, 0, FALSE, TRUE);
         IPSCookie::set("pass_hash", $member['member_login_key'], $_sticky, $_days, FALSE, TRUE);
         IPSCookie::set("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'), '1', $_sticky, $_days, FALSE, FALSE);
     } else {
         // Ticket 824266
         // IPSCookie::set( "member_id"   , $member['member_id'], 0 );
         // IPSCookie::set( "pass_hash"   , $member['member_login_key'], 0 );
         IPSCookie::set("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'), '1', 0, 0, FALSE, FALSE);
     }
     //-----------------------------------------
     // Remove any COPPA cookies previously set
     //-----------------------------------------
     IPSCookie::set("coppa", '0', 0);
     //-----------------------------------------
     // Update profile if IP addr missing
     //-----------------------------------------
     if ($member['ip_address'] == "" or $member['ip_address'] == '127.0.0.1') {
         $core['ip_address'] = $this->registry->member()->ip_address;
     }
     //-----------------------------------------
     // Create / Update session
     //-----------------------------------------
     $privacy = $member['g_hide_online_list'] || empty($this->settings['disable_anonymous']) && !empty($this->request['anonymous']) ? 1 : 0;
     $session_id = $this->registry->member()->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
     if (!empty($this->request['referer']) and $this->request['section'] != 'register') {
         if (stripos($this->request['referer'], 'section=register') or stripos($this->request['referer'], 'section=login') or stripos($this->request['referer'], 'section=lostpass') or stripos($this->request['referer'], CP_DIRECTORY . '/')) {
             $url = $this->settings['base_url'];
         } else {
             $url = str_replace('&amp;', '&', $this->request['referer']);
             if ($this->registry->member()->session_type == 'cookie') {
                 $url = preg_replace('#s=(\\w){32}#', "", $url);
             }
         }
     } else {
         $url = $this->settings['base_url'];
     }
     //-----------------------------------------
     // Set our privacy status
     //-----------------------------------------
     $core['login_anonymous'] = intval($privacy) . '&1';
     $core['failed_logins'] = '';
     $core['failed_login_count'] = 0;
     IPSMember::save($member['member_id'], array('core' => $core));
     //-----------------------------------------
     // Clear out any passy change stuff
     //-----------------------------------------
     $this->DB->delete('validating', 'member_id=' . $this->registry->member()->getProperty('member_id') . ' AND lost_pass=1');
     //-----------------------------------------
     // Run member sync
     //-----------------------------------------
     $member['plainPassword'] = $password;
     IPSLib::runMemberSync('onLogin', $member);
     unset($member['plainPassword']);
     //-----------------------------------------
     // Redirect them to either the board
     // index, or where they came from
     //-----------------------------------------
     if (!empty($this->request['return'])) {
         $return = urldecode($this->request['return']);
         if (strpos($return, "http://") === 0 || strpos($return, "https://") === 0) {
             return array($this->registry->getClass('class_localization')->words['partial_login'], $return);
         }
     }
     //-----------------------------------------
     // Still here?
     //-----------------------------------------
     return array($this->registry->getClass('class_localization')->words['partial_login'], $url);
 }
 /**
  * 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);
             }
         }
     }
 }
Example #11
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;
 }
 /**
  * Processes the registration form
  *
  * @access	public
  * @return	void
  */
 public function registerProcessForm()
 {
     $form_errors = array();
     $coppa = $this->request['coppa_user'] == 1 ? 1 : 0;
     $in_password = trim($this->request['PassWord']);
     $in_email = strtolower(trim($this->request['EmailAddress']));
     $_SFS_FOUND = FALSE;
     /* Check */
     if ($this->settings['no_reg'] == 1) {
         $this->registry->output->showError('registration_disabled', 2016, true);
     }
     /* Custom profile field stuff */
     require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
     $custom_fields = new customProfileFields();
     $custom_fields->initData('edit');
     $custom_fields->parseToSave($this->request, 'register');
     /* Check */
     if ($custom_fields->error_messages) {
         $form_errors['general'] = $custom_fields->error_messages;
     }
     /* Check the email address */
     if (!$in_email or strlen($in_email) < 6 or !IPSText::checkEmailAddress($in_email)) {
         $form_errors['email'][$this->lang->words['err_invalid_email']] = $this->lang->words['err_invalid_email'];
     }
     if (trim($this->request['PassWord_Check']) != $in_password) {
         $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
     }
     /* Test email address */
     $this->request['EmailAddress_two'] = strtolower(trim($this->request['EmailAddress_two']));
     $this->request['EmailAddress'] = strtolower(trim($this->request['EmailAddress']));
     if (!IPSText::checkEmailAddress($this->request['EmailAddress_two'])) {
         $form_errors['email'][$this->lang->words['reg_error_email_invalid']] = $this->lang->words['reg_error_email_invalid'];
     } else {
         if ($in_email and $this->request['EmailAddress_two'] != $in_email) {
             $form_errors['email'][$this->lang->words['reg_error_email_nm']] = $this->lang->words['reg_error_email_nm'];
         }
     }
     /* Need username? */
     $uses_name = false;
     foreach ($this->cache->getCache('login_methods') as $method) {
         if ($method['login_user_id'] == 'username') {
             $uses_name = true;
         }
     }
     if (!$uses_name) {
         $_REQUEST['UserName'] = $_REQUEST['members_display_name'];
         $this->request['UserName'] = $this->request['members_display_name'];
     }
     /* Check the username */
     $user_check = IPSMember::getFunction()->cleanAndCheckName($this->request['UserName'], array(), 'name');
     if ($this->settings['auth_allow_dnames']) {
         $disp_check = IPSMember::getFunction()->cleanAndCheckName($this->request['members_display_name'], array(), 'members_display_name');
     }
     if (is_array($user_check['errors']) && count($user_check['errors'])) {
         foreach ($user_check['errors'] as $key => $error) {
             $form_errors[$key][] = $error;
         }
     }
     if ($this->settings['auth_allow_dnames'] and is_array($disp_check['errors']) && count($disp_check['errors'])) {
         foreach ($disp_check['errors'] as $key => $error) {
             $form_errors[$key][] = $error;
         }
     }
     /* CHECK 1: Any errors (missing fields, etc)? */
     if (count($form_errors)) {
         $this->registerForm($form_errors);
         return;
     }
     /* Is this email addy taken? */
     if (IPSMember::checkByEmail($in_email) == TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Load handler... */
     require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php';
     $this->han_login = new han_login($this->registry);
     $this->han_login->init();
     $this->han_login->emailExistsCheck($in_email);
     if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'EMAIL_NOT_IN_USE') {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Are they banned [EMAIL]? */
     if (IPSMember::isBanned('email', $in_email) === TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_ban']] = $this->lang->words['reg_error_email_ban'];
     }
     /* Check the CAPTCHA */
     if ($this->settings['bot_antispam']) {
         if ($this->registry->getClass('class_captcha')->validate() !== TRUE) {
             $form_errors['general'][$this->lang->words['err_reg_code']] = $this->lang->words['err_reg_code'];
         }
     }
     /* Check the Q and A */
     if ($this->settings['registration_qanda']) {
         $qanda = intval($this->request['qanda_id']);
         $pass = false;
         if ($qanda) {
             $data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'where' => 'qa_id=' . $qanda));
             if ($data['qa_id']) {
                 $answers = explode("\n", str_replace("\r", "", $data['qa_answers']));
                 if (count($answers)) {
                     foreach ($answers as $answer) {
                         if (strtolower($answer) == strtolower($this->request['qa_answer'])) {
                             $pass = true;
                             break;
                         }
                     }
                 }
             }
         } else {
             //-----------------------------------------
             // Do we have any questions?
             //-----------------------------------------
             $data = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as questions', 'from' => 'question_and_answer'));
             if (!$data['questions']) {
                 $pass = true;
             }
         }
         if (!$pass) {
             $form_errors['general'][$this->lang->words['err_q_and_a']] = $this->lang->words['err_q_and_a'];
         }
     }
     /* CHECK 2: Any errors ? */
     if (count($form_errors)) {
         $this->registerForm($form_errors);
         return;
     }
     /* Build up the hashes */
     $mem_group = $this->settings['member_group'];
     /* Are we asking the member or admin to preview? */
     if ($this->settings['reg_auth_type']) {
         $mem_group = $this->settings['auth_group'];
     } else {
         if ($coppa == 1) {
             $mem_group = $this->settings['auth_group'];
         }
     }
     /* Create member */
     $member = array('name' => $this->request['UserName'], 'password' => $in_password, 'members_display_name' => $this->settings['auth_allow_dnames'] ? $this->request['members_display_name'] : $this->request['UserName'], 'email' => $in_email, 'member_group_id' => $mem_group, 'joined' => time(), 'ip_address' => $this->member->ip_address, 'time_offset' => $this->request['time_offset'], 'coppa_user' => $coppa, 'members_auto_dst' => intval($this->request['dst']), 'allow_admin_mails' => intval($this->request['allow_admin_mail']), 'hide_email' => $this->request['allow_member_mail'] ? 0 : 1);
     /* Spam Service */
     $spamCode = 0;
     if ($this->settings['spam_service_enabled'] && $this->settings['spam_service_api_key']) {
         /* Query the service */
         $spamCode = IPSMember::querySpamService($in_email);
         /* Action to perform */
         $action = $this->settings['spam_service_action_' . $spamCode];
         /* Perform Action */
         switch ($action) {
             /* Proceed with registraction */
             case 1:
                 break;
                 /* Flag for admin approval */
             /* Flag for admin approval */
             case 2:
                 $member['member_group_id'] = $this->settings['auth_group'];
                 $this->settings['reg_auth_type'] = 'admin';
                 break;
                 /* Approve the account, but ban it */
             /* Approve the account, but ban it */
             case 3:
                 $member['member_banned'] = 1;
                 $member['member_group_id'] = $this->settings['banned_group'];
                 $this->settings['reg_auth_type'] = '';
                 break;
         }
     }
     //-----------------------------------------
     // Create the account
     //-----------------------------------------
     $member = IPSMember::create(array('members' => $member, 'pfields_content' => $this->request));
     //-----------------------------------------
     // Login handler create account callback
     //-----------------------------------------
     $this->han_login->createAccount(array('email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $member['members_display_name']));
     //-----------------------------------------
     // We'll just ignore if this fails - it shouldn't hold up IPB anyways
     //-----------------------------------------
     /*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
     		{
     			$this->registry->output->showError( 'han_login_create_failed', 2017, true );
     		}*/
     //-----------------------------------------
     // Validation
     //-----------------------------------------
     $validate_key = md5(IPSLib::makePassword() . time());
     $time = time();
     if ($coppa != 1) {
         if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin' or $this->settings['reg_auth_type'] == 'admin_user') {
             //-----------------------------------------
             // We want to validate all reg's via email,
             // after email verificiation has taken place,
             // we restore their previous group and remove the validate_key
             //-----------------------------------------
             $this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address']));
             if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
                 IPSText::getTextClass('email')->getTemplate("reg_validate");
                 IPSText::getTextClass('email')->buildMessage(array('THE_LINK' => $this->settings['base_url'] . "app=core&module=global&section=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->settings['base_url'] . "app=core&module=global&section=register&do=05", 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key));
                 IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email'] . $this->settings['board_name'];
                 IPSText::getTextClass('email')->to = $member['email'];
                 IPSText::getTextClass('email')->sendMail();
                 $this->output = $this->registry->output->getTemplate('register')->showAuthorize($member);
             } else {
                 if ($this->settings['reg_auth_type'] == 'admin') {
                     $this->output = $this->registry->output->getTemplate('register')->showPreview($member);
                 }
             }
             if ($this->settings['new_reg_notify']) {
                 $date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
                 IPSText::getTextClass('email')->getTemplate('admin_newuser');
                 IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'MEMBER_NAME' => $member['members_display_name']));
                 IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
                 IPSText::getTextClass('email')->to = $this->settings['email_in'];
                 IPSText::getTextClass('email')->sendMail();
             }
             $this->registry->output->setTitle($this->lang->words['reg_success']);
             $this->registry->output->addNavigation($this->lang->words['nav_reg'], '');
         } else {
             /* We don't want to preview, or get them to validate via email. */
             $stat_cache = $this->caches['stats'];
             if ($member['members_display_name'] and $member['member_id']) {
                 $stat_cache['last_mem_name'] = $member['members_display_name'];
                 $stat_cache['last_mem_id'] = $member['member_id'];
             }
             $stat_cache['mem_count'] += 1;
             $this->cache->setCache('stats', $stat_cache, array('array' => 1, 'deletefirst' => 0));
             if ($this->settings['new_reg_notify']) {
                 $date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
                 IPSText::getTextClass('email')->getTemplate('admin_newuser');
                 IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'MEMBER_NAME' => $member['members_display_name']));
                 IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email1'] . $this->settings['board_name'];
                 IPSText::getTextClass('email')->to = $this->settings['email_in'];
                 IPSText::getTextClass('email')->sendMail();
             }
             IPSCookie::set('pass_hash', $member['member_login_key'], 1);
             IPSCookie::set('member_id', $member['member_id'], 1);
             //-----------------------------------------
             // Fix up session
             //-----------------------------------------
             $privacy = $this->request['Privacy'] ? 1 : 0;
             if ($member['g_hide_online_list']) {
                 $privacy = 1;
             }
             $this->member->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
             $this->registry->output->silentRedirect($this->settings['base_url'] . '&app=core&module=global&section=login&do=autologin&fromreg=1');
         }
     } else {
         /* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
         $this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address']));
         $this->registry->output->redirectScreen($this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&amp;module=global&amp;section=register&amp;do=12');
     }
 }
* Set to 0 to not match with IP address
*/
define('CVG_IP_MATCH', 1);
require_once '../../initdata.php';
//===========================================================================
// MAIN PROGRAM
//===========================================================================
define('IPS_CLASS_PATH', IPS_ROOT_PATH . 'sources/classes/');
require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
require_once IPS_ROOT_PATH . 'sources/base/ipsController.php';
//-----------------------------------------
// Set up cookie stuff
//-----------------------------------------
$registry = ipsRegistry::instance();
$registry->init();
IPSCookie::$sensitive_cookies = array('session_id', 'ipb_admin_session_id', 'member_id', 'pass_hash');
//--------------------------------
//  Set up our vars
//--------------------------------
$registry->DB()->obj['use_shutdown'] = 0;
//--------------------------------
// Set debug mode
//--------------------------------
$registry->DB()->setDebugMode(ipsRegistry::$settings['sql_debug'] == 1 ? intval($_GET['debug']) : 0);
//===========================================================================
// Create the XML-RPC Server
//===========================================================================
require_once IPS_KERNEL_PATH . 'classApiServer.php';
$server = new classApiServer();
$api = $server->decodeRequest();
//===========================================================================
Example #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']);
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #17
0
 /**
  * Processes the registration form
  *
  * @return	@e void
  */
 public function registerProcessForm()
 {
     $this->_resetMember();
     $form_errors = array();
     $coppa = $this->request['coppa_user'] == 1 ? 1 : 0;
     $in_password = trim($this->request['PassWord']);
     $in_email = strtolower(trim($this->request['EmailAddress']));
     /* Did we agree to the t&c? */
     if (!$this->request['agree_tos']) {
         $form_errors['tos'] = array($this->lang->words['must_agree_to_terms']);
     }
     /* Custom profile field stuff */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields = new $classToLoad();
     $custom_fields->initData('edit');
     $custom_fields->parseToSave($_POST, 'register');
     /* Check */
     if ($custom_fields->error_messages) {
         $form_errors['general'] = $custom_fields->error_messages;
     }
     /* Check the email address */
     if (!$in_email or strlen($in_email) < 6 or !IPSText::checkEmailAddress($in_email)) {
         $form_errors['email'][$this->lang->words['err_invalid_email']] = $this->lang->words['err_invalid_email'];
     }
     if (trim($this->request['PassWord_Check']) != $in_password or !$in_password) {
         $form_errors['password'][$this->lang->words['passwords_not_match']] = $this->lang->words['passwords_not_match'];
     }
     /*
     There's no reason for this - http://community.invisionpower.com/resources/bugs.html/_/ip-board/registrations-limit-passwords-to-32-characters-for-no-apparent-reason-r37770
     elseif ( strlen( $in_password ) < 3 )
     {
     	$form_errors['password'][$this->lang->words['pass_too_short']] = $this->lang->words['pass_too_short'];
     }
     elseif ( strlen( $in_password ) > 32 )
     {
     	$form_errors['password'][$this->lang->words['pass_too_long']] = $this->lang->words['pass_too_long'];
     }
     */
     /* Check the username */
     $user_check = IPSMember::getFunction()->cleanAndCheckName($this->request['members_display_name'], array(), 'name');
     $disp_check = IPSMember::getFunction()->cleanAndCheckName($this->request['members_display_name'], array(), 'members_display_name');
     if (is_array($user_check['errors']) && count($user_check['errors'])) {
         foreach ($user_check['errors'] as $key => $error) {
             $form_errors['dname'][$error] = isset($this->lang->words[$error]) ? $this->lang->words[$error] : $error;
         }
     }
     /* this duplicates username error above */
     /*if( is_array( $disp_check['errors'] ) && count( $disp_check['errors'] ) )
     		{
     			foreach( $disp_check['errors'] as $key => $error )
     			{
     				$form_errors['dname'][ $error ]	= isset($this->lang->words[ $error ]) ? $this->lang->words[ $error ] : $error;
     			}
     		}*/
     /* Is this email addy taken? */
     if (IPSMember::checkByEmail($in_email) == TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Load handler... */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
     $this->han_login->emailExistsCheck($in_email);
     if ($this->han_login->return_code and $this->han_login->return_code != 'METHOD_NOT_DEFINED' and $this->han_login->return_code != 'EMAIL_NOT_IN_USE') {
         $form_errors['email'][$this->lang->words['reg_error_email_taken']] = $this->lang->words['reg_error_email_taken'];
     }
     /* Are they banned [EMAIL]? */
     if (IPSMember::isBanned('email', $in_email) === TRUE) {
         $form_errors['email'][$this->lang->words['reg_error_email_ban']] = $this->lang->words['reg_error_email_ban'];
     }
     /* Check the CAPTCHA */
     if ($this->settings['bot_antispam_type'] != 'none') {
         if ($this->registry->getClass('class_captcha')->validate() !== TRUE) {
             $form_errors['general'][$this->lang->words['err_reg_code']] = $this->lang->words['err_reg_code'];
         }
     }
     /* Check the Q and A */
     $qanda = intval($this->request['qanda_id']);
     $pass = true;
     if ($qanda) {
         $pass = false;
         $data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'where' => 'qa_id=' . $qanda));
         if ($data['qa_id']) {
             $answers = explode("\n", str_replace("\r", "", $data['qa_answers']));
             if (count($answers)) {
                 foreach ($answers as $answer) {
                     $answer = trim($answer);
                     if (IPSText::mbstrlen($answer) and mb_strtolower($answer) == mb_strtolower($this->request['qa_answer'])) {
                         $pass = true;
                         break;
                     }
                 }
             }
         }
     } else {
         //-----------------------------------------
         // Do we have any questions?
         //-----------------------------------------
         $data = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as questions', 'from' => 'question_and_answer'));
         if ($data['questions']) {
             $pass = false;
         }
     }
     if (!$pass) {
         $form_errors['general'][$this->lang->words['err_q_and_a']] = $this->lang->words['err_q_and_a'];
     }
     /* CHECK 2: Any errors ? */
     if (count($form_errors)) {
         $this->registerForm($form_errors);
         return;
     }
     /* Build up the hashes */
     $mem_group = $this->settings['member_group'];
     /* Are we asking the member or admin to preview? */
     if ($this->settings['reg_auth_type']) {
         $mem_group = $this->settings['auth_group'];
     } else {
         if ($coppa == 1) {
             $mem_group = $this->settings['auth_group'];
         }
     }
     /* Create member */
     $member = array('name' => $this->request['members_display_name'], 'password' => $in_password, 'members_display_name' => $this->request['members_display_name'], 'email' => $in_email, 'member_group_id' => $mem_group, 'joined' => time(), 'ip_address' => $this->member->ip_address, 'time_offset' => $this->request['time_offset'], 'coppa_user' => $coppa, 'members_auto_dst' => intval($this->settings['time_dst_auto_correction']), 'allow_admin_mails' => intval($this->request['allow_admin_mail']), 'language' => $this->member->language_id);
     /* Spam Service */
     $spamCode = 0;
     $_spamFlag = 0;
     if ($this->settings['spam_service_enabled']) {
         /* Query the service */
         $spamCode = IPSMember::querySpamService($in_email);
         /* Action to perform */
         $action = $this->settings['spam_service_action_' . $spamCode];
         /* Perform Action */
         switch ($action) {
             /* Proceed with registration */
             case 1:
                 break;
                 /* Flag for admin approval */
             /* Flag for admin approval */
             case 2:
                 $member['member_group_id'] = $this->settings['auth_group'];
                 $this->settings['reg_auth_type'] = 'admin';
                 $_spamFlag = 1;
                 break;
                 /* Approve the account, but ban it */
             /* Approve the account, but ban it */
             case 3:
                 $member['member_banned'] = 1;
                 $member['bw_is_spammer'] = 1;
                 $this->settings['reg_auth_type'] = '';
                 break;
                 /* Deny registration */
             /* Deny registration */
             case 4:
                 $this->registry->output->showError('spam_denied_account', '100x001', FALSE, '', 200);
                 break;
         }
     }
     //-----------------------------------------
     // Create the account
     //-----------------------------------------
     $member = IPSMember::create(array('members' => $member, 'pfields_content' => $custom_fields->out_fields), FALSE, FALSE, FALSE);
     //-----------------------------------------
     // Login handler create account callback
     //-----------------------------------------
     $this->han_login->createAccount(array('member_id' => $member['member_id'], 'email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $member['members_display_name'], 'name' => $member['name'], 'members_display_name' => $member['members_display_name']));
     //-----------------------------------------
     // We'll just ignore if this fails - it shouldn't hold up IPB anyways
     //-----------------------------------------
     /*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
     		{
     			$this->registry->output->showError( 'han_login_create_failed', 2017, true );
     		}*/
     //-----------------------------------------
     // Validation
     //-----------------------------------------
     $validate_key = md5(IPSMember::makePassword() . time());
     $time = time();
     if ($coppa != 1) {
         if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin' or $this->settings['reg_auth_type'] == 'admin_user') {
             //-----------------------------------------
             // We want to validate all reg's via email,
             // after email verificiation has taken place,
             // we restore their previous group and remove the validate_key
             //-----------------------------------------
             $this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address'], 'spam_flag' => $_spamFlag));
             if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
                 /* Send out the email. */
                 $message = array('THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'publicNoSession', 'false'), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global&section=register&do=05", 'publicNoSession', 'false'), 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key);
                 IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("reg_validate", $this->member->language_id));
                 IPSText::getTextClass('email')->buildPlainTextContent($message);
                 IPSText::getTextClass('email')->buildHtmlContent($message);
                 IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email'], $this->settings['board_name']);
                 IPSText::getTextClass('email')->to = $member['email'];
                 IPSText::getTextClass('email')->sendMail();
                 $this->output = $this->registry->output->getTemplate('register')->showAuthorize($member);
             } else {
                 if ($this->settings['reg_auth_type'] == 'admin') {
                     $this->output = $this->registry->output->getTemplate('register')->showPreview($member);
                 }
             }
             /* Only send new registration email if the member wasn't banned */
             if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
                 $date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
                 IPSText::getTextClass('email')->getTemplate('admin_newuser');
                 IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
                 IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
                 IPSText::getTextClass('email')->to = $this->settings['email_in'];
                 IPSText::getTextClass('email')->sendMail();
             }
             $this->registry->output->setTitle($this->lang->words['reg_success'] . ' - ' . ipsRegistry::$settings['board_name']);
             $this->registry->output->addNavigation($this->lang->words['nav_reg'], '');
         } else {
             /* We don't want to preview, or get them to validate via email. */
             $stat_cache = $this->cache->getCache('stats');
             if ($member['members_display_name'] and $member['member_id'] and !$this->caches['group_cache'][$member['member_group_id']]['g_hide_online_list']) {
                 $stat_cache['last_mem_name'] = $member['members_display_name'];
                 $stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle($member['members_display_name']);
                 $stat_cache['last_mem_id'] = $member['member_id'];
             }
             $stat_cache['mem_count'] += 1;
             $this->cache->setCache('stats', $stat_cache, array('array' => 1));
             /* Only send new registration email if the member wasn't banned */
             if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
                 $date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
                 IPSText::getTextClass('email')->getTemplate('admin_newuser');
                 IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
                 IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
                 IPSText::getTextClass('email')->to = $this->settings['email_in'];
                 IPSText::getTextClass('email')->sendMail();
             }
             IPSCookie::set('pass_hash', $member['member_login_key'], 1);
             IPSCookie::set('member_id', $member['member_id'], 1);
             //-----------------------------------------
             // Fix up session
             //-----------------------------------------
             $privacy = $member['g_hide_online_list'] || empty($this->settings['disable_anonymous']) && !empty($this->request['Privacy']) ? 1 : 0;
             # Update value for onCompleteAccount call
             $member['login_anonymous'] = $privacy . '&1';
             $this->member->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
             IPSLib::runMemberSync('onCompleteAccount', $member);
             $this->registry->output->silentRedirect($this->settings['base_url'] . '&app=core&module=global&section=login&do=autologin&fromreg=1');
         }
     } else {
         /* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
         $this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address']));
         $this->registry->output->redirectScreen($this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&amp;module=global&amp;section=register&amp;do=12');
     }
 }
 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;
 }
Example #19
0
 /**
  * Topic multi-moderation
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function _multiTopicModify()
 {
     /* init */
     $done = false;
     /* Check these first */
     switch ($this->request['tact']) {
         case 't_approve':
             $this->_topicsManage('approve_unapproved');
             $done = true;
             break;
         case 't_delete_approve':
             $this->_topicsManage('delete_unapproved');
             $done = true;
             break;
         case 't_restore':
             $this->_topicsManage('restore_deleted');
             $done = true;
             break;
         case 't_delete_softed':
             $this->_topicsManage('delete_deleted');
             $done = true;
             break;
     }
     $this->tids = $this->_getIds();
     if (count($this->tids) and $done !== true) {
         switch ($this->request['tact']) {
             case 'close':
                 $this->_multiAlterTopics('close_topic', "state='closed'");
                 break;
             case 'open':
                 $this->_multiAlterTopics('open_topic', "state='open'");
                 break;
             case 'pin':
                 $this->_multiAlterTopics('pin_topic', "pinned=1");
                 break;
             case 'unpin':
                 $this->_multiAlterTopics('unpin_topic', "pinned=0");
                 break;
             case 'approve':
                 $this->_multiAlterTopics('topic_q', $this->registry->getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), ''));
                 break;
             case 'unapprove':
                 $this->_multiAlterTopics('topic_q', $this->registry->getClass('class_forums')->fetchTopicHiddenQuery(array('hidden'), ''));
                 break;
             case 'delete':
                 $this->_multiAlterDeleteSplash();
                 break;
             case 'deletedo':
                 $this->_multiAlterTopics('delete_topic');
                 break;
             case 'sdelete':
                 $this->_multiSoftDeleteTopics(1, $this->request['deleteReason']);
                 break;
             case 'sundelete':
                 $this->_multiSoftDeleteTopics(0);
                 break;
             case 'move':
                 $this->_multiStartCheckedMove();
                 return;
                 break;
             case 'domove':
                 $this->_multiCompleteCheckedMove();
                 break;
             case 'merge':
                 if ($this->_multiTopicMerge() === FALSE) {
                     return;
                 }
                 break;
             default:
                 $this->_multiTopicMmod();
                 break;
         }
     }
     IPSCookie::set('modtids', '', 0);
     /* From search? */
     if ($this->fromSearch and $this->returnUrl) {
         if ($this->request['nr']) {
             $this->registry->output->silentRedirect($this->returnUrl);
         } else {
             $this->registry->output->redirectScreen($this->lang->words['cp_redirect_topics'], $this->returnUrl);
         }
     } else {
         if ($this->request['return']) {
             $_bits = explode(':', $this->request['return']);
             if (count($_bits) and $_bits[0] == 'modcp') {
                 $this->registry->output->redirectScreen($this->lang->words['cp_redirect_posts'], $this->settings['base_url'] . "app=core&amp;module=modcp&amp;fromapp=forums&amp;tab=" . $_bits[1] . 'topics');
             }
         } else {
             if ($this->forum['id']) {
                 $url = "showforum=" . $this->forum['id'];
                 $url = $this->request['st'] ? "showforum=" . $this->forum['id'] . '&amp;page=' . $this->request['page'] : $url;
                 if ($this->request['nr']) {
                     $this->registry->output->silentRedirect($this->settings['base_url'] . $url, $this->forum['name_seo'], 'showforum');
                 } else {
                     $this->registry->output->redirectScreen($this->lang->words['cp_redirect_topics'], $this->settings['base_url'] . $url, $this->forum['name_seo'], 'showforum');
                 }
             }
         }
     }
 }
 //-----------------------------------------
 // Get converge
 //-----------------------------------------
 $converge = $registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'converge_local', 'where' => "converge_active=1 AND converge_product_id=" . $product_id));
 //-----------------------------------------
 // Get member....
 //-----------------------------------------
 $session = $registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'sessions', 'where' => "id='" . $session_id . "' AND member_id=" . $member_id));
 if ($session['member_id']) {
     $member = IPSMember::load($member_id);
     if (md5($member['member_login_key'] . $converge['converge_api_code']) == $key) {
         if ($set_cookies) {
             IPSCookie::set("member_id", $member['member_id'], 1);
             IPSCookie::set("pass_hash", $member['member_login_key'], 1);
         }
         IPSCookie::set("session_id", $session_id, -1);
     }
     //-----------------------------------------
     // Update session
     //-----------------------------------------
     $registry->DB()->update('sessions', array('browser' => $registry->member()->user_agent, 'ip_address' => $registry->member()->ip_address), "id='" . $session_id . "'");
 }
 //-----------------------------------------
 // Is this a partial member?
 // Not completed their sign in?
 //-----------------------------------------
 if ($member['members_created_remote']) {
     $pmember = $registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id={$member['member_id']}"));
     if ($pmember['partial_member_id']) {
         ipsRegistry::getClass('output')->silentRedirect(ipsRegistry::$settings['board_url'] . '/index.' . ipsRegistry::$settings['php_ext'] . '?act=reg&do=complete_login&mid=' . $member['member_id'] . '&key=' . $pmember['partial_date']);
         exit;
 /**
  * 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;
     }
 }
 /**
  * Converts a member session to a guest session
  *
  * @access	public
  * @return	string 		Current session ID
  */
 public function convertMemberToGuest()
 {
     /* Delete old sessions */
     $this->_destroySessions("ip_address='" . $this->_member->ip_address . "' AND id != '{$this->session_id}'");
     /* Update this session directly */
     $this->DB->update('sessions', array('member_name' => '', 'seo_name' => '', 'member_id' => 0, 'running_time' => time(), 'member_group' => $this->settings['guest_group']), "id='" . $this->session_id . "'", TRUE);
     /* Remove from update and delete array */
     unset($this->_sessionsToSave[$this->session_id]);
     unset($this->_sessionsToKill[$this->session_id]);
     /* Set cookie */
     IPSCookie::set("session_id", $this->session_id, -1);
     /* Save markers... */
     $this->registry->classItemMarking->writeMyMarkersToDB();
     IPSDebug::addLogMessage("convertMemberToGuest: {$this->session_id} " . serialize($data), 'sessions-' . $this->_memberData['member_id']);
     /* Set type */
     self::$data_store['_sessionType'] = 'update';
     return $this->session_id;
 }
Example #23
0
 /**
  * Show more dialogue
  *
  * @param	integer		$relid		Relationship ID
  * @return	@e void
  */
 protected function _change()
 {
     $skinId = $this->request['skinId'];
     /* Make sure cookies are set */
     $this->settings['no_print_header'] = 0;
     if (is_numeric($skinId)) {
         /* Rudimentaty check */
         if ($this->registry->output->allSkins[$skinId]['_youCanUse'] and $this->registry->output->allSkins[$skinId]['_gatewayExclude'] !== TRUE) {
             if ($this->memberData['member_id']) {
                 /* Update... */
                 IPSMember::save($this->memberData['member_id'], array('core' => array('skin' => $skinId)));
             } else {
                 IPSCookie::set('guestSkinChoice', $skinId);
             }
             /* Make sure mobile skin is removed */
             IPSCookie::set("mobileApp", 'false', -1);
             IPSCookie::set("mobileBrowser", 0, -1);
             /* Update member row */
             $this->memberData['skin'] = $skinId;
         }
     } else {
         if ($skinId == 'fullVersion') {
             /* Set cookie */
             IPSCookie::set("uagent_bypass", 1, -1);
             IPSCookie::set("mobileBrowser", 0, -1);
             /* Set member pref if not a mobile app */
             if ($this->memberData['userAgentType'] != 'mobileAppLegacy' && $this->memberData['userAgentType'] != 'mobileApp') {
                 /* Got one set by default for this gateway? */
                 foreach ($this->registry->output->allSkins as $data) {
                     /* Can use with this output format? */
                     if ($data['_gatewayExclude'] !== FALSE) {
                         continue;
                     }
                     /* Is default for our current gateway? */
                     if ($data['set_is_default'] && $this->caches['outputformats'][$data['set_output_format']]['gateway_file'] == IPS_PUBLIC_SCRIPT) {
                         $skinId = $data['set_id'];
                         break;
                     }
                 }
                 /* Update... */
                 if ($this->memberData['member_id']) {
                     IPSMember::save($this->memberData['member_id'], array('core' => array('skin' => $skinId)));
                 } else {
                     IPSCookie::set('guestSkinChoice', $skinId);
                 }
             }
         } else {
             if ($skinId == 'unlockUserAgent') {
                 $this->member->updateMySession(array('uagent_bypass' => 1));
                 /* Set cookie */
                 IPSCookie::set("uagent_bypass", 1, -1);
                 IPSCookie::set("mobileBrowser", 0, -1);
             } else {
                 if ($skinId == 'setAsMobile') {
                     $this->member->updateMySession(array('uagent_bypass' => 0));
                     /* Set cookie */
                     IPSCookie::set("uagent_bypass", 0, -1);
                     IPSCookie::set("mobileBrowser", 1, -1);
                 }
             }
         }
     }
     $this->returnJsonArray(array('status' => 'ok'));
 }
 /**
  * Log the user out
  *
  * @access	public
  * @return	void
  */
 public function loginOut()
 {
     //-----------------------------------------
     // Do it..
     //-----------------------------------------
     $this->DB->delete('core_sys_cp_sessions', "session_id='" . $this->request['adsess'] . "'");
     //-----------------------------------------
     // Bash cookie
     //-----------------------------------------
     IPSCookie::set("ipb3AcpSessionId", 'x', -1);
     //-----------------------------------------
     // Redirect...
     //-----------------------------------------
     ipsRegistry::getClass('output')->redirect($this->settings['base_url'] . '/' . CP_DIRECTORY . '/index.php', $this->lang->words['logout_complete']);
 }
 /**
  * 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);
 }
Example #26
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;
 }
Example #27
0
 /**
  * Process Logout
  *
  * @param	int		ID number
  * @param	string	md5( IPS Connect Key (see login method) . ID number )
  * @param	string	Redirect URL, Base64 encoded
  * @param	string	md5( IPS Connect Key . $redirect )
  * @return	mixed	If the redirect URL is provided, this function should redirect the user to that URL
  *					If blank, will output blank screen
  */
 public function logout($id, $key, $redirect, $redirectHash)
 {
     if ($key != md5($this->masterKey . $id)) {
         $this->_return(base64_encode($this->settings['board_url']));
     }
     IPSCookie::set("ipsconnect_" . md5($this->settings['board_url'] . '/interface/ipsconnect/ipsconnect.php'), '0', 1, 0, FALSE, FALSE);
     $member = IPSMember::load(intval($id), 'none', 'id');
     if ($member['member_id']) {
         IPSCookie::set("member_id", "0");
         IPSCookie::set("pass_hash", "0");
         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);
                 }
             }
         }
         $this->member->sessionClass()->convertMemberToGuest();
         $privacy = intval(IPSMember::isLoggedInAnon($member));
         IPSMember::save($member['member_id'], array('core' => array('login_anonymous' => "{$privacy}&0", 'last_activity' => IPS_UNIX_TIME_NOW)));
         IPSLib::runMemberSync('onLogOut', $member);
         $this->han_login->logoutCallback($member);
         /* Run any custom code */
         $this->_runCustom('logout', array($member));
     }
     if ($redirect) {
         $redirect = $redirectHash == md5($this->masterKey . $redirect) ? $redirect : base64_encode($this->settings['board_url']);
     }
     $this->_return($redirect);
 }
Example #28
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;
 }
 /**
  * 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;
 }
 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;
 }