Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > ZenTracker
Reply
  #1  
Old 12th September 2022, 14:57
Giorgatzelos's Avatar
Giorgatzelos Giorgatzelos is offline
Senior Member
 
Join Date: Nov 2009
Greece
Posts: 300
Default Reinstalled zentracker after years. some things not working
hi i reinstalled zen after many years on a new vps server. noticed that some things (had the same issues i think before but optix had set the server and debugged the website on my (at the time) vps. First i cant upload any image through the filedrop square javascript area.

filedrop.js

PHP Code:
(function($){

    
jQuery.event.props.push("dataTransfer");
    var 
opts = {},
        
default_opts = {
            
url'',
            
refresh1000,
            
paramname'userfile',
            
maxfiles25,
            
maxfilesize1// MBs
            
data: {},
            
drop: empty,
            
dragEnter: empty,
            
dragOver: empty,
            
dragLeave: empty,
            
docEnter: empty,
            
docOver: empty,
            
docLeave: empty,
            
beforeEach: empty,
            
afterAll: empty,
            
rename: empty,
            
error: function(errfilei){alert(err);},
            
uploadStarted: empty,
            
uploadFinished: empty,
            
progressUpdated: empty,
            
speedUpdated: empty
        },
        
errors = ["BrowserNotSupported""TooManyFiles""FileTooLarge"],
        
doc_leave_timer,
        
stop_loop false,
        
files_count 0,
        
files;

    $.
fn.filedrop = function(options) {
        
opts = $.extend( {}, default_optsoptions );
        
        
this.bind('drop'drop).bind('dragenter'dragEnter).bind('dragover'dragOver).bind('dragleave'dragLeave);
        $(
document).bind('drop'docDrop).bind('dragenter'docEnter).bind('dragover'docOver).bind('dragleave'docLeave);
    };
     
    function 
drop(e) {
        
opts.drop(e);
        
files e.dataTransfer.files;
        if (
files === null || files === undefined) {
            
opts.error(errors[0]);
            return 
false;
        }
        
        
files_count files.length;
        
upload();
        
e.preventDefault();
        return 
false;
    }
    
    function 
getBuilder(filenamefiledataboundary) {
        var 
dashdash '--',
            
crlf '\r\n',
            
builder '';

        $.
each(opts.data, function(ival) {
            if (
typeof val === 'function'val val();
            
builder += dashdash;
            
builder += boundary;
            
builder += crlf;
            
builder += 'Content-Disposition: form-data; name="'+i+'"';
            
builder += crlf;
            
builder += crlf;
            
builder += val;
            
builder += crlf;
        });
        
        
builder += dashdash;
        
builder += boundary;
        
builder += crlf;
        
builder += 'Content-Disposition: form-data; name="'+opts.paramname+'"';
        
builder += '; filename="' filename '"';
        
builder += crlf;
        
        
builder += 'Content-Type: application/octet-stream';
        
builder += crlf;
        
builder += crlf
        
        
builder += filedata;
        
builder += crlf;
        
        
builder += dashdash;
        
builder += boundary;
        
builder += dashdash;
        
builder += crlf;
        return 
builder;
    }

    function 
progress(e) {
        if (
e.lengthComputable) {
            var 
percentage Math.round((e.loaded 100) / e.total);
            if (
this.currentProgress != percentage) {
                
                
this.currentProgress percentage;
                
opts.progressUpdated(this.indexthis.filethis.currentProgress);
                
                var 
elapsed = new Date().getTime();
                var 
diffTime elapsed this.currentStart;
                if (
diffTime >= opts.refresh) {
                    var 
diffData e.loaded this.startData;
                    var 
speed diffData diffTime// KB per second
                    
opts.speedUpdated(this.indexthis.filespeed);
                    
this.startData e.loaded;
                    
this.currentStart elapsed;
                }
            }
        }
    }
    
    
    
    function 
upload() {
        
stop_loop false;
        if (!
files) {
            
opts.error(errors[0]);
            return 
false;
        }
        var 
filesDone 0,
            
filesRejected 0;
        
        if (
files_count opts.maxfiles) {
            
opts.error(errors[1]);
            return 
false;
        }

        for (var 
i=0i<files_counti++) {
            if (
stop_loop) return false;
            try {
                if (
beforeEach(files[i]) != false) {
                    if (
=== files_count) return;
                    var 
reader = new FileReader(),
                        
max_file_size 1048576 opts.maxfilesize;
                        
                    
reader.index i;
                    if (
files[i].size max_file_size) {
                        
opts.error(errors[2], files[i], i);
                        
filesRejected++;
                        continue;
                    }
                    
                    
reader.onloadend send;
                    
reader.readAsBinaryString(files[i]);
                } else {
                    
filesRejected++;
                }
            } catch(
err) {
                
opts.error(errors[0]);
                return 
false;
            }
        }
        
        function 
send(e) {
            
// Sometimes the index is not attached to the
            // event object. Find it by size. Hack for sure.
            
if (e.target.index == undefined) {
                
e.target.index getIndexBySize(e.total);
            }
            
            var 
xhr = new XMLHttpRequest(),
                
upload xhr.upload,
                
file files[e.target.index],
                
index e.target.index,
                
start_time = new Date().getTime(),
                
boundary '------multipartformboundary' + (new Date).getTime(),
                
builder;
                
            
newName rename(file.name);
            if (
typeof newName === "string") {
                
builder getBuilder(newNamee.target.resultboundary);
            } else {
                
builder getBuilder(file.namee.target.resultboundary);
            }
            
            
upload.index index;
            
upload.file file;
            
upload.downloadStartTime start_time;
            
upload.currentStart start_time;
            
upload.currentProgress 0;
            
upload.startData 0;
            
upload.addEventListener("progress"progressfalse);
            
            
xhr.open("POST"opts.urltrue);
            
xhr.setRequestHeader('content-type''multipart/form-data; boundary=' 
                
boundary);
                
            
xhr.sendAsBinary(builder);  
            
            
opts.uploadStarted(indexfilefiles_count);  
            
            
xhr.onload = function() { 
                if (
xhr.responseText) {
            var 
now = new Date().getTime(),
            
timeDiff now start_time,
            
result opts.uploadFinished(indexfilejQuery.parseJSON(xhr.responseText), timeDiff);
            
filesDone++;
            if (
filesDone == files_count filesRejected) {
              
afterAll();
            }
            if (
result === falsestop_loop true;
                }
            };
        }
    }
    
    function 
getIndexBySize(size) {
        for (var 
i=0files_counti++) {
            if (
files[i].size == size) {
                return 
i;
            }
        }
        
        return 
undefined;
    }
    
    function 
rename(name) {
        return 
opts.rename(name);
    }
    
    function 
beforeEach(file) {
        return 
opts.beforeEach(file);
    }
    
    function 
afterAll() {
        return 
opts.afterAll();
    }
    
    function 
dragEnter(e) {
        
clearTimeout(doc_leave_timer);
        
e.preventDefault();
        
opts.dragEnter(e);
    }
    
    function 
dragOver(e) {
        
clearTimeout(doc_leave_timer);
        
e.preventDefault();
        
opts.docOver(e);
        
opts.dragOver(e);
    }
     
    function 
dragLeave(e) {
        
clearTimeout(doc_leave_timer);
        
opts.dragLeave(e);
        
e.stopPropagation();
    }
     
    function 
docDrop(e) {
        
e.preventDefault();
        
opts.docLeave(e);
        return 
false;
    }
     
    function 
docEnter(e) {
        
clearTimeout(doc_leave_timer);
        
e.preventDefault();
        
opts.docEnter(e);
        return 
false;
    }
     
    function 
docOver(e) {
        
clearTimeout(doc_leave_timer);
        
e.preventDefault();
        
opts.docOver(e);
        return 
false;
    }
     
    function 
docLeave(e) {
        
doc_leave_timer setTimeout(function(){
            
opts.docLeave(e);
        }, 
200);
    }
     
    function empty(){}
    
    try {
        if (
XMLHttpRequest.prototype.sendAsBinary) return;
        
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
            function 
byteValue(x) {
                return 
x.charCodeAt(0) & 0xff;
            }
            var 
ords = Array.prototype.map.call(datastrbyteValue);
            var 
ui8a = new Uint8Array(ords);
            
this.send(ui8a.buffer);
        }
    } catch(
e) {}
     
})(
jQuery); 
second there is a problem with navigation links when i click some menus it doesnt do anything. e.g if i delete the sondages# from the browser link (see pic no3) the link is working.if i dont the it doesnt.

can anybody help please?

Bump: i fixed the navigation issues by disabling the https and ssl certificates
Attached Thumbnails
Screenshot 2022-09-12 at 3.43.50 PM.png   Screenshot 2022-09-12 at 3.49.15 PM.png  
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 01:13. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.