Parašė Kelmas· 2008 Lie. 10 22:07:40
#1
Laba vakara,
Tai vat norėčiau paklausti mūsų rusiukai viena moduką rašė rašė ir darašė, tik yra toks tolkas, kad man neina BASEDIR padaryti gal žinot kaip įterpt prisegų failiuką.
Na o jeigu net siųstis nepaslankatę tai še:
<? header('Content-Type: text/html; charset='.$locale['charset'].''); include INCLUDES."ajax/lang-russian.php"; ?>
<script>
var commid = 0;
var comming = 0;
function createObject() {
var req;
if(window.XMLHttpRequest){
// Firefox, Safari, Opera...
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
// Internet Explorer 5+
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// There is an error creating the object,
// just as an old browser is being used.
alert('Problem creating the XMLHttpRequest object');
}
return req;
}
var http = createObject();
function post() {
var textOut = http.responseText;
document.getElementById('all').innerHTML = textOut;
}
function commid1() {
var textOut = http.responseText;
document.getElementById('all-'+commid).innerHTML = textOut;
}
function show() {
var textOut = http.responseText;
document.getElementById('forum').innerHTML = textOut;
}
function useHttpResponse() {
if (http.readyState == 4) {
setTimeout("post()",1000);
}
}
function useHttpResponse1() {
if (http.readyState == 4) {
setTimeout("commid1()",1000);
}
}
function useHttpResponse2() {
if (http.readyState == 4) {
setTimeout("show()",500);
}
}
function sendEdit(comment_id) {
commid = comment_id;
var newLoad = '<div class="quote"><center><?=$locale['ac103']?><br><img src="includai/ajax/wait.gif"></b></center></div><br>';
document.getElementById('all-'+comment_id).innerHTML = newLoad;
http.open('get', 'includai/ajax/comments.php?action=edit&rand='+Math.random()+'&comment_id='+comment_id, true);
http.onreadystatechange = useHttpResponse1;
http.send(null);
}
function sendExit(comment_id) {
var newLoad = '<div class="quote"><center><?=$locale['ac104']?><br><img src="http://www.l2visiems.net/includai/ajax/wait.gif"></b></center></div><br>';
commid = comment_id;
document.getElementById('all-'+commid).innerHTML = newLoad;
http.open('get', 'includai/ajax/comments.php?action=cansel&rand='+Math.random()+'&comment_id='+comment_id, true);
http.onreadystatechange = useHttpResponse1;
http.send(null);
}
function sendSave(commidke) {
commid = commidke;
comming = 1;
var newLoad = "<div class='quote'><center><?=$locale['ac105']?><br><img src='includai/ajax/wait.gif'></b></center></div><br>";
document.getElementById('allm-'+commid).innerHTML = newLoad;
var comment_message = null;
var disable_smileys = null;
var a = eval("escape(document.inputform"+commid+".comment_message"+commidke+".value)");
var b = eval("document.inputform"+commid+".disable_smileys"+commidke+".checked");
if(b) {
disable_smileys = encodeURIComponent("no");
} else {
disable_smileys = encodeURIComponent("yes");
}
comment_message = encodeURIComponent(a);
http.open('post', 'includai/ajax/comments.php?action=save&rand='+Math.random(), true);
http.onreadystatechange = useHttpResponse1;
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.send('comment_message='+comment_message+'&disable_smileys='+disable_smileys+'&comment_id='+commid);
}
function exText(inputform,elname, wrap1, wrap2) {
if (document.selection) { // for IE
var str = document.selection.createRange().text;
eval("document."+inputform+"."+elname+".focus()");
var sel = document.selection.createRange();
sel.text = wrap1 + str + wrap2;
return;
} else if ((typeof eval("document."+inputform+"."+elname+".selectionStart")) != 'undefined') { // for Mozilla
var txtarea = eval("document."+inputform+"."+elname+"");
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
var oldScrollTop = txtarea.scrollTop;
//if (selEnd == 1 || selEnd == 2)
//selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + wrap1 + s2 + wrap2 + s3;
txtarea.selectionStart = s1.length;
txtarea.selectionEnd = s1.length + s2.length + wrap1.length + wrap2.length;
txtarea.scrollTop = oldScrollTop;
txtarea.focus();
return;
}
}
</script>
Ne durnas ir includinau maincore.php ir pan.. bet tas kad jis vistiek gaunasi errorai.
Redagavo Kelmas· 2008 Lie. 10 22:07:32
Parašė mXt· 2008 Lie. 11 08:07:26
#2
Visu pirma tai koks error, bei ka tu nori su siuo scriptu veikti, kur reikia ka banduyti includinti. Siaip cia JS ne
PHP, tai manau visa problema tame ir bus
Parašė Kelmas· 2008 Lie. 11 08:07:18
#3
Šitas skriptas yra dalis redeguoti komentarams kur išoka js langelis ir pan.
Žinau, kad js bet rusai viska mėgsta ant .php rašyt, includinti reikia visose linkose pvz includai/blabla.php.
O klaida yra tokia kad rašosi BASEDIR/linkai... (Todėl, kad nenuskaito funkcijos.) ;)
Redagavo Kelmas· 2008 Lie. 11 08:07:05