inherit
218140
0
Feb 26, 2021 17:49:17 GMT -8
Aeryes
97
January 2015
aeryes
|
Post by Aeryes on Feb 3, 2016 11:15:22 GMT -8
Hi there,
I am currently trying to integrate my chat box (not the shoutbox) onto the forum and it is asking me this:
No matter what I try I cannot figure out what the variable is I should be putting into the code...
This is the line that I need to alter
Then, if I want to do extended integration I need to add this line of code after implementing the standard integration code (does that mean this line goes after the part I've highlighted in green above?)
In this code, I need to Change $avatar_url and $profile_url to the correct variables for the context.... but I need those variables too >.<
Sorry if my post is making little sense, I'm just super confused
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Feb 4, 2016 15:08:18 GMT -8
I did this awhile back and while it is possible to generate an MD5 using javascript, the problem here is that cbox has no concept of the dual naming system such as the one Proboards uses. By that I mean if your goal is to be sure that the person posting in the cbox is a person who can login to your forum with that name then you MUST use that person's user name (aka the login name) and not the name everybody knows them by (the display name). If you allow them to use their display name then anybody can go into their own profile and change the name to match whoever they wish to impersonate. If cbox allowed the use of the user name to verify but also allowed displaying the name using the display name alias then it would be hunky dory. Cbox does allow you to also import their avatar when they post which might help to identify someone with an arcane name such as user411 but that too can easily be spoofed. Proboards doesn't offer PHP and and the templating system does not yet offer any cryptographic methods such as MD5 (fingers crossed for future). Proboards does however offer a javascript data object in the browser so basically to accomplish this you would use javascript in the browser to calculate the MD5 and construct the url, here's a snippet from a plugin a I wrote a few months ago (although I abandoned it after cbox ignored my repeated requests regarding support for "display names" vs "user names") var boxID, cbox_code = data.cbox_code; if( /[&?]boxid=(\d+)/.test(data.cbox_code)){ boxID = RegExp.$1; if( boxID in cbox_instances){ //if same cbox already exists on page then name/id needs to be modified in order to coexist cbox_code = cbox_code.replace(/(name|id)="([^"]+)"/, '$1="$2-'+dataIndex+'"') cbox_instances[boxID].push(cbox_wrapper); }else{ cbox_instances[boxID] = [cbox_wrapper] } //pre-register users if(data.key){ var nme = encodeURIComponent( (settings.ascii?pb.data('user').username:pb.data('user').name+"("+pb.data('user').username+")") ); var nmekey = pb.data("user").is_logged_in || settings.posting_options.indexOf("noguests")==-1 ? md5(data.key + (settings.ascii?pb.data('user').username:pb.data('user').name+"("+pb.data('user').username+")")) : ""; var avatar_url = settings.posting_options.indexOf("avatar")!=-1 ? encodeURI((pb.data("user").avatar ? pb.data("user").avatar.match(/src="([^"]+)"/)[1] : pb.data('default_avatar'))):""; //relative url into FQDN var profile_url = settings.posting_options.indexOf("profile")!=-1 ? encodeURI($('<a href="' + (pb.data("user").url||"/") +'">a</a>').prop('href')): ""; cbox_code = cbox_code.replace(/&sec=form/g, "&sec=form&nme="+nme+"&nmekey="+nmekey+"&pic=" + avatar_url + "&lnk=" + profile_url + "&ekey=" + md5(data.key + String.fromCharCode(9) + avatar_url + String.fromCharCode(9) + profile_url) ); } cbox_wrapper.html(cbox_code); } note: the md5 function was imported from one of the numerous library implementations found on Github (just do a search and pick one or use the one listed in this post) If the fact that you need to use username and not displayname does not bother you and you want to take a look at the plugin then send me a PM since it is not fit for public consumption, it has wires hanging out with loose screws and missing access panels and a high chance of getting electrocuted if you do not know what you're doing. [ more info]
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 19, 2016 1:08:55 GMT -8
I got a request to release the plugin mentioned above so here it is: CBOX Integrate.editable.pbpAs noted, it is not user friendly and definitely not finished so it is mainly for the curious or experimental types not someone looking for a polished product. As noted above, there exists an incompatibility between the way cbox and proboards handle accounts so development of the plugin was abandoned and the "bot" tab isn't even wired.
|
|