[Paulscriptsmods-checkin] ajax_shout/root js.php, NONE, 1.1.2.1 static.js, NONE, 1.1.2.1 ajax.php,
Status: Beta
Brought to you by:
paulsohier
From: Paul S. <pau...@us...> - 2007-10-03 20:06:15
|
Update of /cvsroot/paulscriptsmods/ajax_shout/root In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27129 Modified Files: Tag: phpbb3_ver ajax.php Added Files: Tag: phpbb3_ver js.php static.js Log Message: Commiting this already, its a rather BIG commit, but will make HoL happy when validating. note, This commit means really that ALL users that have installed the MOD currently are required to use the provided update. This is because ajax.php DONT handle the JS anymore. Index: ajax.php =================================================================== RCS file: /cvsroot/paulscriptsmods/ajax_shout/root/ajax.php,v retrieving revision 1.21.2.34 retrieving revision 1.21.2.35 diff -C2 -d -r1.21.2.34 -r1.21.2.35 *** ajax.php 3 Oct 2007 19:59:53 -0000 1.21.2.34 --- ajax.php 3 Oct 2007 20:06:15 -0000 1.21.2.35 *************** *** 31,1103 **** $mode = request_var('m', 'index'); - $ajax_mode = array('add', 'del', 'view', 'check', 'smilies', 'delete', 'number'); - $err = false; - if (in_array($mode, $ajax_mode)) - { - @ob_end_clean(); - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT'); - header('Cache-Control: no-cache, must-revalidate'); [...1076 lines suppressed...] switch ($mode) { *************** *** 1331,1338 **** break; } ! if (in_array($mode, $ajax_mode)) ! { ! echo '<error></error></xml>'; ! } /** --- 272,278 ---- break; } ! ! echo '<error></error></xml>'; ! /** --- NEW FILE: static.js --- /** * * @package Ajax Shoutbox * @version $Id: static.js,v 1.1.2.1 2007/10/03 20:06:15 paulsohier Exp $ * @copyright (c) 2007 Paul Sohier * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ var div,hin,huit,hin2, hsmilies, hinfo, hdelete, hnr; var config = new Array(); var post_info = timer_in = last = null; var display_shoutbox = false; var start = first = true; var smilies = false; var count = 0; function err_msg(title) { var err = new Error(title); if (!err.message) { err.message = title; } err.name = "E_USER_ERROR";//Php error?!? :D return err; } function validate_overige(xml) { try { if (xml.childNodes.length == 0) { return tn(''); } else if (xml.childNodes.length == 1 && xml.childNodes[0].nodeValue != null) { // With a tag in it, its bigger as 1? return tn(xml.childNodes[0].nodeValue); } else { var div = ce('span'); loop: for (var i = 0; i < xml.childNodes.length; i++) { switch (xml.childNodes[i].nodeType) { case 3: div.appendChild(document.createTextNode(xml.childNodes[i].nodeValue)); break; case 9: case 8: case 10: case 11: // continue; break; case 1: if (xml.childNodes[i].childNodes.length == 0 && xml.childNodes[i].nodeName != 'br' && xml.childNodes[i].nodeName != 'img' && xml.childNodes[i].nodeName != 'hr') { break; } // This is a difficult one :) switch (xml.childNodes[i].nodeName) { case 'br': div.appendChild(ce('br')); break; case 'blockquote': var q = ce('blockquote'); q.className = 'quote'; q.appendChild(validate_overige(xml.childNodes[i])); add_style(xml.childNodes[i], q); div.appendChild(q); break; case 'a': var a = ce('a'); a.href = xml.childNodes[i].getAttribute('href'); a.appendChild(validate_overige(xml.childNodes[i])); add_style(xml.childNodes[i], a); div.appendChild(a); break; case 'img': var img = ce('img'); img.alt = xml.childNodes[i].getAttribute('alt'); img.src = xml.childNodes[i].getAttribute('src'); img.border = 0; add_style(xml.childNodes[i], img); div.appendChild(img); break; case 'strong': case 'b': var b = ce('strong'); b.appendChild(validate_overige(xml.childNodes[i])); add_style(xml.childNodes[i], b); div.appendChild(b); break; case 'hr': var hr = ce('hr'); div.appendChild(hr); break; case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': var h = ce(xml.childNodes[i].nodeName); h.appendChild(validate_overige(xml.childNodes[i])); add_style(xml.childNodes[i], h); div.appendChild(h); break; case 'span': var s = ce('span'); s.appendChild(validate_overige(xml.childNodes[i])); add_style(xml.childNodes[i], s); div.appendChild(s); break; default: { throw err_msg('<?php echo $user->lang['INVALID_EL']; ?>' + xml.childNodes[i].nodeName); } } break; } } } return div; } catch (e) { handle(e); return div; } } function add_style(el, s) { var c = el.getAttribute('class'); if (c != null) { s.className = c; } f = el.getAttribute('style'); if (f == null) { return; } if (f.indexOf(';') == -1) { f += ';'; } f = f.split(';'); for (var j = 0; j < f.length; j++) { f2 = f[j].split(':'); if (f2[0]) { f2[0] = trim(f2[0]); } if (f2[1]) { f2[1] = trim(f2[1]); } switch (f2[0]) { case 'font-style': s.style.fontStyle = f2[1]; break; case 'font-weight': s.style.fontWeight = f2[1]; break; case 'font-size': try { s.style.fontSize = f2[1]; } catch (e){} break; case 'line-height': s.style.lineHeigt = f2[1]; break; case 'color': s.style.color = f2[1]; break; case 'text-decoration': s.style.textDecoration = f2[1]; break; } } } function trim(value) { value = value.replace(/^\s+/,''); value = value.replace(/\s+$/,''); return value; } function http() { try { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { try { http_request = new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { } } } if (!http_request) { throw err_msg(no_ajax()); } return http_request; } catch (e) { handle(e); return false; } } function message(msg, color) { try { if (document.getElementById('msg_txt') != null) { document.getElementById('msg_txt').innerHTML = ''; var tmp = ce('p'); tmp.appendChild(tn(msg)); if (color) { tmp.style.color = 'red'; } document.getElementById('msg_txt').appendChild(tmp); } else { div.innerHTML = ''; var tmp = ce('p'); tmp.appendChild(tn(msg)); if (color) { tmp.style.color = 'red'; } div.appendChild(tmp); } } catch (e) { handle(e); return false; } } function ce(e) { return document.createElement(e); } function tn(e) { return document.createTextNode(e); } --- NEW FILE: js.php --- <?php /** * * @package Ajax Shoutbox * @version $Id: js.php,v 1.1.2.1 2007/10/03 20:06:15 paulsohier Exp $ * @copyright (c) 2007 Paul Sohier * @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** * @ignore */ define('IN_PHPBB', true); define('AJAX_DEBUG', false); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); [...1029 lines suppressed...] handle(e); return; } } hin2.send(null); } } function no_ajax() { return '<?php echo $user->lang['NO_AJAX']; ?>'; } function cp() { var sep = ce('span'); sep.className = 'page-sep'; sep.appendChild(tn('<?php echo $user->lang['COMMA_SEPARATOR'];?>')); return sep; } |