-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.js.php
41 lines (39 loc) · 1.33 KB
/
common.js.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
ob_start("ob_gzhandler");
ob_start("compress");
header("Content-type: text/javascript;charset: UTF-8");
header("Cache-Control: must-revalidate");
function compress($buffer) {
return $buffer;
}
$logged_cookie_key = "wordpress_logged_in_".htmlspecialchars($_GET['hash']);
?>
var admin_user_cookie = "<?php array_key_exists($logged_cookie_key, $_COOKIE)?$tmp=$_COOKIE[$logged_cookie_key]:$tmp="";echo $tmp;?>";
function readCosBetaCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return unescape( decodeURI(c.substring(nameEQ.length,c.length)));
}
return '';
}
function setovalue(o,v){
if(document.getElementById(o) !=null )document.getElementById(o).value=v.replace('+',' ');
}
function setCommForm(){
if (admin_user_cookie.length > 2) {
setovalue('author',admin_user_cookie.split("|")[0]);
setovalue('email',adminmail.replace("{_}","@") );
setovalue('url',adminurl );
}
else if(readCosBetaCookie(author_cookie).length>2){
setovalue('author',readCosBetaCookie(author_cookie) );
setovalue('email',readCosBetaCookie(email_cookie) );
setovalue('url',readCosBetaCookie(url_cookie) );
}
else{
setovalue('author','');setovalue('email','');setovalue('url','');
}
}