1/** 2 * @package SimplePortal 3 * 4 * @author SimplePortal Team 5 * @copyright 2014 SimplePortal Team 6 * @license BSD 3-clause 7 * 8 * @version 2.3.7 9 */ 10 11// Define the version of SMF that we are using. 12if (typeof(smf_editorArray) == "undefined") 13 portal_smf_version = 1.1; 14else 15 portal_smf_version = 2; 16 17function sp_collapse_object(id, has_image) 18{ 19 mode = document.getElementById("sp_object_" + id).style.display == '' ? 0 : 1; 20 document.getElementById("sp_object_" + id).style.display = mode ? '' : 'none'; 21 22 if (typeof(has_image) == "undefined" || has_image == true) 23 document.getElementById("sp_collapse_" + id).src = smf_images_url + (mode ? '/collapse.gif' : '/expand.gif'); 24} 25 26function sp_image_resize() 27{ 28 var possible_images = document.getElementsByTagName("img"); 29 for (var i = 0; i < possible_images.length; i++) 30 { 31 if (possible_images[i].className != (portal_smf_version == 1.1 ? "sp_article" : "bbc_img sp_article")) 32 continue; 33 34 var temp_image = new Image(); 35 temp_image.src = possible_images[i].src; 36 37 if (temp_image.width > 300) 38 { 39 possible_images[i].height = (300 * temp_image.height) / temp_image.width; 40 possible_images[i].width = 300; 41 } 42 else 43 { 44 possible_images[i].width = temp_image.width; 45 possible_images[i].height = temp_image.height; 46 } 47 } 48 49 if (typeof(window_oldSPImageOnload) != "undefined" && window_oldSPImageOnload) 50 { 51 window_oldSPImageOnload(); 52 window_oldSPImageOnload = null; 53 } 54} 55 56function sp_submit_shout(shoutbox_id, sSessionVar, sSessionId) 57{ 58 if (window.XMLHttpRequest) 59 { 60 shoutbox_indicator(shoutbox_id, true); 61 62 var shout_body = ""; 63 64 if (portal_smf_version == 1.1) 65 shout_body = escape(textToEntities(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); 66 else 67 shout_body = escape(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B"); 68 69 sendXMLDocument(smf_prepareScriptUrl(sp_script_url) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&shout=' + shout_body + '&' + sSessionVar + '=' + sSessionId, onShoutReceived); 70 71 document.getElementById('new_shout_' + shoutbox_id).value = ''; 72 73 return false; 74 } 75} 76 77function sp_delete_shout(shoutbox_id, shout_id, sSessionVar, sSessionId) 78{ 79 if (window.XMLHttpRequest) 80 { 81 shoutbox_indicator(shoutbox_id, true); 82 83 sendXMLDocument(smf_prepareScriptUrl(sp_script_url) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&delete=' + shout_id + '&' + sSessionVar + '=' + sSessionId, onShoutReceived); 84 85 return false; 86 } 87} 88 89function sp_refresh_shout(shoutbox_id, last_refresh) 90{ 91 if (window.XMLHttpRequest) 92 { 93 shoutbox_indicator(shoutbox_id, true); 94 95 getXMLDocument(smf_prepareScriptUrl(sp_script_url) + 'action=portal;sa=shoutbox;shoutbox_id=' + shoutbox_id + ';time=' + last_refresh + ';xml', onShoutReceived); 96 97 return false; 98 } 99} 100 101// Function to handle the receiving of new shout data from the xml request. 102function onShoutReceived(XMLDoc) 103{ 104 var shouts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout"); 105 var shoutbox_id, updated, error, warning, reverse, shout, id, author, time, timeclean, delete_link, content, is_me, new_body = ''; 106 107 shoutbox_id = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shoutbox")[0].childNodes[0].nodeValue; 108 updated = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("updated")[0].childNodes[0].nodeValue; 109 110 if (updated == 1) 111 { 112 error = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("error")[0].childNodes[0].nodeValue; 113 warning = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("warning")[0].childNodes[0].nodeValue; 114 reverse = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("reverse")[0].childNodes[0].nodeValue; 115 116 if (warning != 0) 117 new_body += '<li class="shoutbox_warning smalltext">' + warning + '</li>'; 118 119 if (error != 0) 120 setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body + '<li class="smalltext">' + error + '</li>'); 121 else 122 { 123 for (var i = 0; i < shouts.length; i++) 124 { 125 shout = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout")[i]; 126 id = shout.getElementsByTagName("id")[0].childNodes[0].nodeValue; 127 author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue; 128 time = shout.getElementsByTagName("time")[0].childNodes[0].nodeValue; 129 timeclean = shout.getElementsByTagName("timeclean")[0].childNodes[0].nodeValue; 130 delete_link = shout.getElementsByTagName("delete")[0].childNodes[0].nodeValue; 131 content = shout.getElementsByTagName("content")[0].childNodes[0].nodeValue; 132 is_me = shout.getElementsByTagName("is_me")[0].childNodes[0].nodeValue; 133 134 new_body += '<li class="smalltext">' + (is_me == 0 ? '<strong>
134' + author + ':</strong> ' : '') + content + '<br />' + (delete_link != 0 ? ('<span class="shoutbox_delete">' + delete_link + '</span>') : '') + '<span class="smalltext shoutbox_time">' + time + '</span></li>'; 135 } 136 137 setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body); 138 139 if (reverse != 0) 140 document.getElementById('shouts_' + shoutbox_id).scrollTop = document.getElementById('shouts_' + shoutbox_id).scrollHeight; 141 else 142 document.getElementById('shouts_' + shoutbox_id).scrollTop = 0; 143 } 144 } 145 146 shoutbox_indicator(shoutbox_id, false); 147 148 return false; 149} 150 151function shoutbox_indicator(shoutbox_id, turn_on) 152{ 153 document.getElementById('shoutbox_load_' + shoutbox_id).style.display = turn_on ? '' : 'none'; 154} 155 156function sp_catch_enter(key) 157{ 158 var keycode; 159 160 if (window.event) 161 keycode = window.event.keyCode; 162 else if (key) 163 keycode = key.which; 164 165 if (keycode == 13) 166 return true; 167} 168 169function sp_show_ignored_shout(shout_id) 170{ 171 document.getElementById('ignored_shout_' + shout_id).style.display = ''; 172 document.getElementById('ignored_shout_link_' + shout_id).style.display = 'none'; 173} 174 175function sp_show_history_ignored_shout(shout_id) 176{ 177 document.getElementById('history_ignored_shout_' + shout_id).style.display = ''; 178 document.getElementById('history_ignored_shout_link_' + shout_id).style.display = 'none'; 179} 180 181function style_highlight(something, mode) 182{ 183 something.style.backgroundImage = 'url(' + smf_images_url + (mode ? '/bbc/bbc_hoverbg.gif)' : '/bbc/bbc_bg.gif)'); 184} 185 186function smf_prepareScriptUrl(sUrl) 187{ 188 return sUrl.indexOf('?') == -1 ? sUrl + '?' : sUrl + (sUrl.charAt(sUrl.length - 1) == '?' || sUrl.charAt(sUrl.length - 1) == '&' || sUrl.charAt(sUrl.length - 1) == ';' ? '' : ';'); 189} 190 191// This function is for SMF 1.1.x as well as SMF 2RC1.2 and below. 192function sp_compat_showMoreSmileys(postbox, sTitleText, sPickText, sCloseText, smf_theme_url, smf_smileys_url) 193{ 194 if (this.oSmileyPopupWindow) 195 this.oSmileyPopupWindow.close(); 196 197 this.oSmileyPopupWindow = window.open('', 'add_smileys', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes');
198 this.oSmileyPopupWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html>'); 199 this.oSmileyPopupWindow.document.write('\n\t<head>\n\t\t<title>' + sTitleText + '</title>\n\t\t<link rel="stylesheet" type="text/css" href="' + smf_theme_url + '/style.css" />\n\t</head>'); 200 this.oSmileyPopupWindow.document.write('\n\t<body style="margin: 1ex;">\n\t\t<table width="100%" cellpadding="5" cellspacing="0" border="0" class="tborder">\n\t\t\t<tr class="titlebg"><td align="left">' + sPickText + '</td></tr>\n\t\t\t<tr class="windowbg"><td align="left">'); 201 202 for (i = 0; i < sp_smileys.length; i++) 203 { 204 sp_smileys[i][2] = sp_smileys[i][2].replace(/"/g, '"'); 205 sp_smileys[i][0] = sp_smileys[i][0].replace(/"/g, '"'); 206 this.oSmileyPopupWindow.document.write('<a href="javascript:void(0);" onclick="window.opener.replaceText(\' ' + (portal_smf_version == 1.1 ? sp_smileys[i][0] : smf_addslashes(sp_smileys[i][0])) + '\', window.opener.document.getElementById(\'new_shout_' + postbox + '\')); window.focus(); return false;"><img src="' + smf_smileys_url + '/' + sp_smileys[i][1] + '" id="sml_' + sp_smileys[i][1] + '" alt="' + sp_smileys[i][2] + '" title="' + sp_smileys[i][2] + '" style="padding: 4px;" border="0" /></a> '); 207 } 208
209 this.oSmileyPopupWindow.document.write('</td></tr>\n\t\t\t<tr><td align="center" class="windowbg"><a href="javascript:window.close();">' + sCloseText + '</a></td></tr>\n\t\t</table>'); 210 this.oSmileyPopupWindow.document.write('\n\t</body>\n</html>'); 211 this.oSmileyPopupWindow.document.close(); 212} 213 214// This function is for SMF 2 RC2 and above. 215function sp_showMoreSmileys(postbox, sTitleText, sPickText, sCloseText, smf_theme_url, smf_smileys_url) 216{ 217 if (this.oSmileyPopupWindow != null && 'closed' in this.oSmileyPopupWindow && !this.oSmileyPopupWindow.closed) 218 { 219 this.oSmileyPopupWindow.focus(); 220 return; 221 } 222 223 if (sp_smileyRowsContent == undefined) 224 { 225 var sp_smileyRowsContent = ''; 226 for (i = 0; i < sp_smileys.length; i++) 227 { 228 sp_smileys[i][2] = sp_smileys[i][2].replace(/"/g, '"'); 229 sp_smileys[i][0] = sp_smileys[i][0].replace(/"/g, '"'); 230 sp_smileyRowsContent += '<a href="javascript:void(0);" onclick="window.opener.replaceText(\' ' + sp_smileys[i][0].php_addslashes() + '\', window.opener.document.getElementById(\'new_shout_' + postbox + '\')); window.focus(); return false;"><img src="' + smf_smileys_url + '/' + sp_smileys[i][1] + '" id="sml_' + sp_smileys[i][1] + '" alt="' + sp_smileys[i][2] + '" title="' + sp_smileys[i][2] + '" style="padding: 4px;" border="0" /></a> '; 231 } 232 233 } 234 235 this.oSmileyPopupWindow = window.open('', 'add_smileys', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes'); 236 237 // Paste the template in the popup. 238 this.oSmileyPopupWindow.document.open('text/html', 'replace'); 239 this.oSmileyPopupWindow.document.write(sp_moreSmileysTemplate.easyReplace({ 240 smileyRows: sp_smileyRowsContent 241 })); 242 243 this.oSmileyPopupWindow.document.close(); 244}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.