Initial Commit

This commit is contained in:
2024-02-08 12:07:49 -07:00
parent 5813b1109f
commit 43077b57ed
5471 changed files with 682195 additions and 0 deletions
+117
View File
@@ -0,0 +1,117 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.5 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID")));
// Get the widget id always first
if (isset($_GET['id']) && is_numeric($_GET['id'])) $widgetid = $_GET['id'];
if (!file_exists('../config.php')) die('include/[chatcontrol.php] config.php not exist');
require_once '../config.php';
// Language file
$lang = JAK_LANG;
if (isset($_GET['lang']) && !empty($_GET['lang']) && $_GET['lang'] != $lang) $lang = $_GET['lang'];
// Import the language file
if ($lang && file_exists(APP_PATH.'lang/'.strtolower($lang).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($lang).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
$lang = JAK_LANG;
}
// Get the current time
$currentime = time();
// Get the absolute url for the image
$base_url = str_replace('include/', '', BASE_URL);
$switchc = '';
if (isset($_GET['run']) && !empty($_GET['run'])) $switchc = $_GET['run'];
switch($switchc) {
case 'backtochat':
if (isset($_POST['customer']) && !empty($_POST['customer'])) {
// Let's make sure we have an active chat and it is available
$cudetails = jak_string_encrypt_decrypt($_POST['customer'], false);
// Let's explode the string (0 = convid, 1 = uniqueid, 2 = userid, 3 = name, 4 = email, 5 = phone, 6 = avatar)
$cudetails = explode(":#:", $cudetails);
if (isset($cudetails[0]) && is_numeric($cudetails[0])) {
// Update the database
$jakdb->update("sessions", ["status" => 1, "fcontact" => 0, "ended" => 0], ["id" => $cudetails[0]]);
$jakdb->update("checkstatus", ["hide" => 0], ["convid" => $cudetails[0]]);
die(json_encode(array('status' => true)));
}
}
break;
case 'stopchat':
if (isset($_POST['customer']) && !empty($_POST['customer'])) {
// Let's make sure we have an active chat and it is available
$cudetails = jak_string_encrypt_decrypt($_POST['customer'], false);
// Let's explode the string (0 = convid, 1 = uniqueid, 2 = userid, 3 = name, 4 = email, 5 = phone, 6 = avatar)
$cudetails = explode(":#:", $cudetails);
if (isset($cudetails[0]) && is_numeric($cudetails[0])) {
// Let's inform the operator that the user has gone to the feedback form or has ended the chat
if ($jakwidget[$widgetid]['feedback']) {
$jakdb->insert("transcript", [
"name" => $cudetails[3],
"message" => sprintf($jkl['g43'], $cudetails[3]),
"user" => $cudetails[2],
"convid" => $cudetails[0],
"class" => "notice",
"time" => $jakdb->raw("NOW()")]);
// We need to know if we stop the chat without feedback
$feedbackform = "yes";
} else {
// That's it finish the chat and reload
$jakdb->insert("transcript", [
"name" => $cudetails[3],
"message" => sprintf($jkl['g16'], $cudetails[3]),
"user" => $cudetails[2],
"convid" => $cudetails[0],
"class" => "ended",
"time" => $jakdb->raw("NOW()")]);
// Close the chat
$jakdb->update("sessions", ["status" => 0, "ended" => time()], ["id" => $cudetails[0]]);
$jakdb->update("checkstatus", ["hide" => 1], ["convid" => $cudetails[0]]);
$feedbackform = "nope";
}
die(json_encode(array('status' => true, 'feedbackform' => $feedbackform)));
}
}
break;
}
?>
+2547
View File
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH # ||
|| # ----------------------------------------- # ||
|| # Copyright 2019 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[comment_vote.php] config.php not exist');
require_once '../config.php';
if (!JAK_USERISLOGGED) die(json_encode(array("status" => 0)));
if (is_numeric($_GET['vid'])) {
if (isset($_GET['vote']) && ($_GET['vote'] == "up" || $_GET['vote'] == "down")) {
if ($_GET['vote'] == "down") {
$votesql = 'votes - 1';
$jakdb->update("blogcomments", ["votes[-]" => 1], ["id" => $_GET['vid']]);
} else {
$jakdb->update("blogcomments", ["votes[+]" => 1], ["id" => $_GET['vid']]);
}
die(json_encode(array("status" => 1)));
}
die(json_encode(array("status" => 0)));
} else {
die(json_encode(array("status" => 0)));
}
?>
+76
View File
@@ -0,0 +1,76 @@
<?php
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.4 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('include/[support.php] config.php not exist');
require_once '../config.php';
if (!file_exists('../class/ssp.class.php')) die('include/[support.php] ssp.class.php not exist');
require_once '../class/ssp.class.php';
// Get the correct tickets
$where = "t1.opid = ".$_SESSION['opid']." && t1.clientid = ".JAK_CLIENTID;
if (isset($_SESSION["sortdepid"]) && is_numeric($_SESSION["sortdepid"])) $where .= ' AND t1.depid = '.$_SESSION["sortdepid"];
// DB table to use
$table = JAKDB_PREFIX.'support_tickets AS t1';
$table2 = ' LEFT JOIN '.JAKDB_PREFIX.'support_departments AS t2 ON (t1.depid = t2.id)';
$table3 = ' LEFT JOIN '.JAKDB_PREFIX.'ticketpriority AS t3 ON (t1.priorityid = t3.id)';
// Table's primary key
$primaryKey = 't1.id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 't1.id', 'dbjoin' => 'id', 'dt' => 0 ),
array( 'db' => 't1.subject', 'dbjoin' => 'subject', 'dt' => 1, 'formatter' => function( $d, $row ) {
return '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $row['id'], JAK_rewrite::jakCleanurl($row["subject"]))).'" class="btn btn-link btn-default">'.$d.'</a>';
} ),
array( 'db' => 't2.title', 'dbjoin' => 'title', 'dt' => 2 ),
array( 'db' => 't1.name', 'dbjoin' => 'name', 'dt' => 3 ),
array( 'db' => 't1.initiated', 'dbjoin' => 'initiated', 'dt' => 4, 'formatter' => function( $d, $row ) {
return JAK_base::jakTimesince($d, JAK_DATEFORMAT, JAK_TIMEFORMAT);
} ),
array( 'db' => 't1.status', 'dbjoin' => 'status', 'dt' => 5, 'formatter' => function( $d, $row ) {
global $BT_LANGUAGE;
if (isset($_SESSION['jak_lcp_lang']) && file_exists(APP_PATH.'lang/'.$BT_LANGUAGE.'.php')) {
include (APP_PATH.'lang/'.$BT_LANGUAGE.'.php');
} else {
include (APP_PATH.'lang/'.JAK_LANG.'.php');
}
global $HD_SUPPORT_STATUS;
$support_status = '';
if (isset($HD_SUPPORT_STATUS) && !empty($HD_SUPPORT_STATUS)) foreach ($HD_SUPPORT_STATUS as $v) {
if (isset($d) && $d == $v['id']) {
$support_status = '<span class="badge badge-pill badge-'.$v["class"].'">'.$v['title'].'</span>';
break;
}
}
return $support_status.' <span class="badge badge-pill badge-'.$row["class"].'">'.$row["prioritytitle"].'</span>';
} ),
array( 'db' => 't1.subject', 'dbjoin' => 'subject', 'dt' => 6, 'formatter' => function( $d, $row ) {
global $BT_LANGUAGE;
if (isset($_SESSION['jak_lcp_lang']) && file_exists(APP_PATH.'lang/'.$BT_LANGUAGE.'.php')) {
include (APP_PATH.'lang/'.$BT_LANGUAGE.'.php');
} else {
include (APP_PATH.'lang/'.JAK_LANG.'.php');
}
return '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $row['id'], JAK_rewrite::jakCleanurl($row["subject"]))).'" class="btn btn-primary btn-sm">'.$jkl['hd13'].'</a>';
} ),
array( 'db' => 't1.updated', 'dbjoin' => 'updated', 'dt' => 7 ),
array( 'db' => 't3.title AS prioritytitle', 'dbjoin' => 'prioritytitle', 'dt' => 8 ),
array( 'db' => 't3.class', 'dbjoin' => 'class', 'dt' => 9 )
);
die(json_encode(SSP::join( $_GET, $table, $table2, $table3, $primaryKey, $columns, $where, $where )));
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH # ||
|| # ----------------------------------------- # ||
|| # Copyright 2019 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[comment_vote.php] config.php not exist');
require_once '../config.php';
if (!JAK_USERISLOGGED) die(json_encode(array("status" => 0)));
if (is_numeric($_GET['vid'])) {
if (isset($_GET['vote']) && ($_GET['vote'] == "up" || $_GET['vote'] == "down")) {
if ($_GET['vote'] == "down") {
$votesql = 'votes - 1';
$jakdb->update("faq_article", ["votes[-]" => 1], ["id" => $_GET['vid']]);
} else {
$jakdb->update("faq_article", ["votes[+]" => 1], ["id" => $_GET['vid']]);
}
die(json_encode(array("status" => 1)));
}
die(json_encode(array("status" => 0)));
} else {
die(json_encode(array("status" => 0)));
}
?>
File diff suppressed because it is too large Load Diff
+182
View File
@@ -0,0 +1,182 @@
<?php
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2023 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
// Unsharp Mask for PHP - version 2.1.1
//
// Unsharp mask algorithm by Torstein Hønsi 2003-07.
// thoensi_at_netcom_dot_no.
function Image_Sharpen($img, $amount, $radius, $threshold) {
if ($amount > 500) { $amount = 500; }
$amount = $amount * 0.016;
if ($radius > 50) { $radius = 50; }
$radius = $radius * 2;
if ($threshold > 255) { $threshold = 255; }
$radius = abs(round($radius));
if ($radius == 0) { return $img; imagedestroy($img); }
$w = imagesx($img); $h = imagesy($img);
$imgCanvas = imagecreatetruecolor($w, $h);
$imgBlur = imagecreatetruecolor($w, $h);
if (function_exists('imageconvolution')) {
$matrix = array(
array( 1, 2, 1 ),
array( 2, 4, 2 ),
array( 1, 2, 1 )
);
imagecopy($imgBlur, $img, 0, 0, 0, 0, $w, $h);
imageconvolution($imgBlur, $matrix, 16, 0);
} else {
for ($i = 0; $i < $radius; $i++) {
imagecopy($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h);
imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50);
imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50);
imagecopy($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h);
imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333 );
imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25);
}
}
if($threshold>0) {
for ($x = 0; $x < $w-1; $x++) {
for ($y = 0; $y < $h; $y++) {
$rgbOrig = ImageColorAt($img, $x, $y);
$rOrig = (($rgbOrig >> 16) & 0xFF);
$gOrig = (($rgbOrig >> 8) & 0xFF);
$bOrig = ($rgbOrig & 0xFF);
$rgbBlur = ImageColorAt($imgBlur, $x, $y);
$rBlur = (($rgbBlur >> 16) & 0xFF);
$gBlur = (($rgbBlur >> 8) & 0xFF);
$bBlur = ($rgbBlur & 0xFF);
$rNew = (abs($rOrig - $rBlur) >= $threshold)
? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig))
: $rOrig;
$gNew = (abs($gOrig - $gBlur) >= $threshold)
? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig))
: $gOrig;
$bNew = (abs($bOrig - $bBlur) >= $threshold)
? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig))
: $bOrig;
if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) {
$pixCol = ImageColorAllocate($img, intval($rNew), intval($gNew), intval($bNew));
ImageSetPixel($img, $x, $y, $pixCol);
}
}
}
}
else {
for ($x = 0; $x < $w; $x++) {
for ($y = 0; $y < $h; $y++) {
$rgbOrig = ImageColorAt($img, $x, $y);
$rOrig = (($rgbOrig >> 16) & 0xFF);
$gOrig = (($rgbOrig >> 8) & 0xFF);
$bOrig = ($rgbOrig & 0xFF);
$rgbBlur = ImageColorAt($imgBlur, $x, $y);
$rBlur = (($rgbBlur >> 16) & 0xFF);
$gBlur = (($rgbBlur >> 8) & 0xFF);
$bBlur = ($rgbBlur & 0xFF);
$rNew = ($amount * ($rOrig - $rBlur)) + $rOrig;
if($rNew > 255) { $rNew = 255; }
else if($rNew < 0) { $rNew = 0; }
$gNew = ($amount * ($gOrig - $gBlur)) + $gOrig;
if($gNew > 255) {$gNew = 255;}
else if($gNew < 0) { $gNew = 0; }
$bNew = ($amount * ($bOrig - $bBlur)) + $bOrig;
if( $bNew > 255) { $bNew = 255; }
else if ( $bNew < 0 ) { $bNew = 0; }
$rgbNew = ($rNew << 16) + ($gNew <<8) + $bNew;
ImageSetPixel($img, $x, $y, $rgbNew);
}
}
}
imagedestroy($imgCanvas);
imagedestroy($imgBlur);
return $img;
}
function create_thumbnail($targetPath, $targetFile, $sourceFile, $widthNew, $heightNew, $qualityNew)
{
$imgsize = getimagesize($targetFile);
switch(strtolower(substr($targetFile, -3))){
case "jpg":
$image = imagecreatefromjpeg($targetFile);
break;
case "png":
$image = imagecreatefrompng($targetFile);
break;
case "gif":
$image = imagecreatefromgif($targetFile);
break;
default:
exit;
break;
}
$width = $widthNew; // New width of image
$height = $heightNew; // New height of image
// Original size
$src_w = $imgsize[0];
$src_h = $imgsize[1];
// Create new size
if ($widthNew && ($src_w < $src_h)) {
$width = ($heightNew / $src_h) * $src_w;
} else {
$height = ($widthNew / $src_w) * $src_h;
}
$picture = imagecreatetruecolor($width, $height);
imagealphablending($picture, false);
imagesavealpha($picture, true);
$bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h);
// Sharpen Image
$picture = Image_Sharpen($picture, 80, 0.5, 3);
if($bool){
switch(strtolower(substr($targetFile, -3))){
case "jpg":
$bool2 = imagejpeg($picture,$targetPath."/".$sourceFile,$qualityNew);
break;
case "png":
imagepng($picture,$targetPath."/".$sourceFile);
break;
case "gif":
imagegif($picture,$targetPath."/".$sourceFile);
break;
}
}
imagedestroy($picture);
imagedestroy($image);
}
?>
+241
View File
@@ -0,0 +1,241 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2.1 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[available.php] config.php not exist');
require_once '../config.php';
// include the PHP library (if not autoloaded)
require('../class/class.emoji.php');
// Extensive test if that is the real user or not
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || !isset($_SESSION['groupchatid']) || !isset($_SESSION['gcuid'])) die("Nothing to do here");
// The chat window is active
$winactive = true;
if (isset($_GET["active"]) && $_GET["active"] == "false") $winactive = false;
// Current time stamp
$ctime = microtime(true);
// Reset vars
$lastid = $newmsg = $banned = 0;
$delmsg = array();
$chatmsg = $userlist = "";
if (isset($_GET['lastid']) && is_numeric($_GET['lastid']) && $_GET['lastid'] != 0) {
$lastid = $_GET['lastid'];
}
// Get the absolute url for the image
$ava_url = str_replace('include/', '', BASE_URL).JAK_FILES_DIRECTORY;
// We have an offline client call just return nothing
if ($_GET["usract"] == 3) {
die(json_encode(array("status" => 1, "newmsg" => 3)));
} else {
// Get the chat file
$groupchatfile = APP_PATH.JAK_CACHE_DIRECTORY.'/groupchat'.$_SESSION['groupchatid'].'.txt';
// Check if file is available and user is valid
if (file_exists($groupchatfile)) {
// Now check the button id
if (file_exists($cacheopid)) {
// Import the language file
if ($groupchat[$_SESSION['groupchatid']]['lang'] && file_exists(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
}
} else {
// The chat has gone offline show the message
if (!empty($HD_ANSWERS) && is_array($HD_ANSWERS)) foreach ($HD_ANSWERS as $v) {
if ($v["msgtype"] == 12 && $v["lang"] == JAK_LANG) {
$phold = array("%operator%","%client%","%email%");
$replace = array("", $_SESSION['gcname'], JAK_EMAIL);
$offlinemsg = str_replace($phold, $replace, $v["message"]);
}
}
$chatmsg .= '<div class="message system"><span>'.$jkl['g56'].' - '.JAK_base::jakTimesince($ctime, "", JAK_TIMEFORMAT).'</span>'.stripcslashes($offlinemsg).'</div>';
die(json_encode(array("status" => 1, "html" => $chatmsg, "newmsg" => 3, "vislist" => "", "delmsg" => "", "lastid" => $lastid)));
}
// Update the user status every 2 minutes
if (!isset($_SESSION["usrbanned"]) && (!isset($_SESSION["vislasttime"]) || $_SESSION["vislasttime"] < $ctime - 120)) {
$_SESSION["vislasttime"] = $ctime;
$jakdb->update("groupchatuser", ["statusc" => $ctime], ["id" => $_SESSION['gcuid']]);
// We are a operator update the user table as well.
if (isset($_SESSION['gcopid']) && !empty($_SESSION['gcopid'])) {
$jakdb->update("user", ["lastactivity" => time(), "session" => session_id()], ["id" => $_SESSION['gcopid']]);
}
}
if ($winactive) {
// Get the file
$chatfile = file_get_contents($groupchatfile);
// Each line
$chatfile = explode(":!n:", $chatfile);
$modstuff = "";
if (isset($chatfile) && is_array($chatfile)) foreach ($chatfile as $v) {
$chatline = jak_string_encrypt_decrypt($v, false);
// We will go trough each file
$chatline = explode(":#!#:", $chatline);
// Message format: time:#!#:userid:#!#:name:#!#:avatar:#!#:message:#!#:quote;
// Now we check if we have messages after our timeline
if ($lastid < $chatline[0]) {
// We are banned
if (isset($_SESSION["usrbanned"])) {
// We have a mod line
if ($chatline[2] == "*mod*" && $chatline[4] == "react" && $chatline[3] == $_SESSION['gcuid']) {
// remove the banned session
unset($_SESSION["usrbanned"]);
$lastid = $chatline[0];
$newmsg = 1;
// die(json_encode(array("status" => 1, "html" => "", "newmsg" => $newmsg, "lastid" => $lastid)));
}
} else {
// We have a mod line
if ($lastid != 0 && $chatline[2] == "*mod*") {
// At this moment we have only delete.
if ($chatline[4] == "delete") {
$delmsg[] = $chatline[3];
$newmsg = 2;
// ok the user that reads that is banned
} elseif ($chatline[4] == "banned" && $chatline[3] == $_SESSION['gcuid']) {
// Session banned
$_SESSION["usrbanned"] = true;
$lastid = $chatline[0];
$newmsg = 2;
}
} else {
// Unique Message id
$umsgid = $chatline[1].str_replace(".", "_", $chatline[0]);
// Convert urls
$messagedisp = nl2br(replace_urls($chatline[4]));
// Convert emotji
$messagedisp = Emojione\Emojione::toImage($messagedisp);
// We have an operator
if (isset($_SESSION['gcopid'])) {
$modstuff = '<a href="javascript:void(0)" class="edit-remove" data-msgid="'.$umsgid.'"><i class="fa fa-trash"></i></a>';
}
// We have a quoted message
$quoted = "";
if (isset($chatline[5]) && !empty($chatline[5])) {
// Convert urls
$quotemsg = nl2br(replace_urls($chatline[5]));
// Convert emotji
$quotemsg = Emojione\Emojione::toImage($quotemsg);
$quoted = '<blockquote class="blockquote"><i class="fa fa-reply"></i> '.$quotemsg.'</blockquote>';
}
// is mod
$ismod = false;
if (isset($chatline[6]) && $chatline[6] === "true") $ismod = true;
// Now load the time only once a minute
$chattime = "";
if (($lastid + 15) < $chatline[0]) $chattime = '<div class="time">'.JAK_base::jakTimesince($chatline[0], "", JAK_TIMEFORMAT).'</div>';
$chatmsg .= $chattime.'<div class="message'.($ismod ? ' operator' : '').'" id="postid_'.$umsgid.'"><span>'.$chatline[2].'<div class="chat-edit">'.($chatline[1] != $_SESSION['gcuid'] ? '<a href="javascript:void(0)" class="edit-quote" data-msg="'.$chatline[4].'" data-id="'.$umsgid.'"><i class="fa fa-quote-right"></i></a>' : '').$modstuff.'</div></span><div id="msg'.$umsgid.'">'.$quoted.stripcslashes($messagedisp).'</div></div>';
// Get the latest messages
$lastid = $chatline[0];
$newmsg = 1;
}
}
}
}
}
// Ok every two minutes we do load the new user list or if we have a change
if ($newmsg) {
// Remove customers from the last 5 minutes
$listnow = $ctime - 300;
// Remove user that are older than
$jakdb->delete("groupchatuser", ["AND" => ["groupchatid" => $_SESSION['groupchatid'], "statusc[<]" => $listnow]]);
$result = $jakdb->select("groupchatuser", ["id", "name", "usr_avatar", "lastmsg", "banned", "ip", "isop", "created"], ["groupchatid" => $_SESSION['groupchatid'], "ORDER" => ["name" => "ASC"]]);
if (isset($result) && !empty($result)) {
foreach ($result as $u) {
$usermod = $usrip = "";
// We have an operator
if (isset($_SESSION["gcopid"]) && $u["isop"] == 0) {
$usermod = '<a href="javascript:void(0)" class="edit-ban" data-id="'.$u["id"].'"><i class="fa fa-ban"></i></a>';
$usrip = $u["ip"];
}
$userlist .= '<div class="gcuser" id="postid_'.$umsgid.'">
<div class="pic"><img class="pic" src="'.$ava_url.$u['usr_avatar'].'" alt="'.$u["name"].'"></div>
'.($u["banned"] ? '<div class="badge">'.$jkl['g84'].'</div>' : '').'
<div class="name'.($u["isop"] ? ' mod' : '').'">
'.$u["name"].' '.$usermod.'
</div>
<div class="message">
'.($u["lastmsg"] ? sprintf($jkl['g78'], JAK_base::jakTimesince($u["lastmsg"], "", JAK_TIMEFORMAT)) : '-').'<br>
'.sprintf($jkl['g90'], JAK_base::jakTimesince($u["created"], "", JAK_TIMEFORMAT)).'<br>
'.$usrip.'
</div>
</div>';
}
}
}
if ($banned != 0) $newmsg = $banned;
die(json_encode(array("status" => 1, "html" => $chatmsg, "newmsg" => $newmsg, "vislist" => $userlist, "delmsg" => $delmsg, "lastid" => $lastid)));
}
}
die(json_encode(array("status" => 0)));
?>
+119
View File
@@ -0,0 +1,119 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[available.php] config.php not exist');
require_once '../config.php';
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || !isset($_SESSION['groupchatid']) || !isset($_SESSION['gcuid'])) die("Nothing to see here");
if (!$_POST['msg']) die(json_encode(array("status" => 0, "html" => "")));
$row = $jakdb->get("groupchatuser", ["id", "groupchatid", "usr_avatar", "lastmsg", "banned"], ["id" => $_SESSION['gcuid']]);
if (isset($row) && !empty($row)) {
$message = html_entity_decode($_POST['msg']);
$message = strip_tags($message);
$message = filter_var($message, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
// Ok we do need to remove our special signs for placeholder and new lines
$badstuff = array(":#!#:", ":!n:");
$goodstuff = array("", "");
$message = str_replace($badstuff, $goodstuff, $message);
$message = trim($message);
if (isset($message) && !empty($message) && $row['banned'] == 0) {
// Current time
$ctime = microtime(true);
// Flood time
$ftime = $ctime - 5;
// Check for duplicate messages and 5 second flood
if ($row["lastmsg"] > $ftime || (isset($_SESSION["lastmsg"]) && $_SESSION["lastmsg"] == $message)) {
// Now check the button id
if (file_exists($cacheopid)) {
// Import the language file
if ($groupchat[$_SESSION['groupchatid']]['lang'] && file_exists(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
}
}
$errormsg = $jkl['e17'];
if ($row["lastmsg"] > $ftime) $errormsg = $jkl['e18'];
die(json_encode(array("status" => 0, "html" => $errormsg)));
}
// the last message in a session
$_SESSION["lastmsg"] = $message;
// Check if we have a quote
$msgquote = "";
if (isset($_POST['msgquote']) && !empty($_POST['msgquote'])) $msgquote = filter_var($_POST['msgquote'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
// Insert the message into the text file
$groupchatfile = APP_PATH.JAK_CACHE_DIRECTORY.'/groupchat'.$row["groupchatid"].'.txt';
if (file_exists($groupchatfile)) {
// Check file size, if bigger than 500kb save to db and start fresh.
$gcfilesize = filesize($groupchatfile);
if ($gcfilesize > 500000) {
$chatfile = file_get_contents($groupchatfile);
// we have a chatfile
if (isset($chatfile) && !empty($chatfile)) {
// Insert into the database
$jakdb->insert("groupchatmsg", ["groupchatid" => $row["groupchatid"], "opid" => $opcacheid, "chathistory" => $chatfile, "operatorid" => 0, "created" => $jakdb->raw("NOW()")]);
// Finally remove the file and start fresh
unlink($groupchatfile);
}
}
}
// We have an operator
$ismod = "false";
if (isset($_SESSION['gcopid'])) {
$ismod = "true";
}
// Modify the message with a time stamp
$cmsg = jak_string_encrypt_decrypt($ctime.':#!#:'.$row['id'].':#!#:'.$_SESSION['gcname'].':#!#:'.$row["usr_avatar"].':#!#:'.$message.':#!#:'.$msgquote.':#!#:'.$ismod).':!n:';
// Let's inform others that a new client has entered the chat
file_put_contents($groupchatfile, $cmsg, FILE_APPEND);
$jakdb->update("groupchatuser", ["lastmsg" => time()], ["id" => $row['id']]);
die(json_encode(array("status" => 1)));
} else {
die(json_encode(array("status" => 0)));
}
} else {
die(json_encode(array("status" => 0)));
}
?>
+129
View File
@@ -0,0 +1,129 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 jakweb All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[available.php] config.php not exist');
require_once '../config.php';
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || !isset($_SESSION['gcopid'])) die("Nothing to see here");
if (!isset($_POST['action']) || !isset($_POST['id'])) die(json_encode(array("status" => 0)));
// We remove the message
if ($_POST['action'] == "delmsg") {
// Reset some vars
$msgfound = false;
$ctime = microtime(true);
$row = $jakdb->get("groupchatuser", ["id", "groupchatid"], ["id" => $_SESSION['gcuid']]);
// Insert the message into the text file
$groupchatfile = APP_PATH.JAK_CACHE_DIRECTORY.'/groupchat'.$row["groupchatid"].'.txt';
// Get the file
$chatfile = file_get_contents($groupchatfile);
// Each line
$chatfile = explode(":!n:", $chatfile);
if (isset($chatfile) && is_array($chatfile)) foreach ($chatfile as $v) {
$chatline = jak_string_encrypt_decrypt($v, false);
// We will go trough each file
$chatline = explode(":#!#:", $chatline);
if ($_POST['id'] == $chatline[1].str_replace(".", "_", $chatline[0])) {
$msgtoremove = $chatline[0].':#!#:'.$chatline[1].':#!#:'.$chatline[2].':#!#:'.$chatline[3].':#!#:'.$chatline[4].':#!#:'.$chatline[5];
$msgfound = true;
break;
}
}
// Finally remove the file and add the mod line
if ($msgfound) {
// Remove the bad line
file_put_contents($groupchatfile, str_replace(jak_string_encrypt_decrypt($msgtoremove).':!n:', "", file_get_contents($groupchatfile)));
// Modify the message with a time stamp
$cmsg = jak_string_encrypt_decrypt($ctime.':#!#:'.$row['id'].':#!#:*mod*:#!#:'.$_POST['id'].':#!#:delete:#!#:'.$msgtoremove.':#!#:'.true).':!n:';
// Let's inform others that a message has been deleted
file_put_contents($groupchatfile, $cmsg, FILE_APPEND);
die(json_encode(array("status" => 1)));
}
}
// Ban / UnBan a user
if ($_POST['action'] == "banusr") {
// time
$ctime = microtime(true);
// Reset
$chatban = false;
$msgquote = "";
$row = $jakdb->get("groupchatuser", ["id", "groupchatid", "name", "usr_avatar"], ["id" => $_SESSION['gcuid']]);
if (is_numeric($_POST['id']) && $row["id"] != $_POST['id']) {
// Import the language file
if ($groupchat[$_SESSION['groupchatid']]['lang'] && file_exists(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
}
// Get the user
$usr = $jakdb->get("groupchatuser", ["id", "name", "banned"], ["id" => $_POST['id']]);
// update the table
if ($usr["banned"] == 1) {
$jakdb->update("groupchatuser", ["banned" => 0], ["id" => $usr["id"]]);
// The un banned message
$chatban = sprintf($jkl['g80'], $usr["name"]);
$usrban = "react";
} elseif ($usr["banned"] == 0) {
$jakdb->update("groupchatuser", ["banned" => 1], ["id" => $usr["id"]]);
// The un banned message
$chatban = sprintf($jkl['g79'], $usr["name"]);
$usrban = "banned";
}
if ($chatban) {
// Insert the message into the text file
$groupchatfile = APP_PATH.JAK_CACHE_DIRECTORY.'/groupchat'.$row["groupchatid"].'.txt';
// The ban message
$cwmsg = jak_string_encrypt_decrypt($ctime.':#!#:'.$row['id'].':#!#:'.$row['name'].':#!#:'.$row['usr_avatar'].':#!#:'.$chatban.':#!#:'.$msgquote.':#!#:'.true).':!n:';
$ctime = $ctime + 1;
// Modify the message with a time stamp to banned or unbanned
$cwmsg .= jak_string_encrypt_decrypt($ctime.':#!#:'.$row['id'].':#!#:*mod*:#!#:'.$usr['id'].':#!#:'.$usrban.':#!#:'.true).':!n:';
// Let's inform others that a new client has entered the chat
file_put_contents($groupchatfile, $cwmsg, FILE_APPEND);
die(json_encode(array("status" => 1)));
}
}
}
die(json_encode(array("status" => 0)));
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.1 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2020 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
if (!file_exists('../config.php')) die('include/[groupchat.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and and expiring date is true.
if ((isset($jakosub['groupchats']) && $jakosub['groupchats'] == 0) || (isset($jakosub['active']) && $jakosub['active'] == 0)) die(json_encode(array('status' => false, 'error' => "Account expired or no access to group chats.")));
// Some reset
$widgethtml = $floatstyle = '';
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Now check the button id
if (file_exists($cacheopid)) {
// Group Chat is online show it
if (isset($groupchat[$_GET['id']]["active"]) && $groupchat[$_GET['id']]["active"] == 1) {
// Float button? Position
$floatstyle = '';
if ($groupchat[$_GET['id']]['floatpopup'] && !empty($groupchat[$_GET['id']]['floatcss'])) $floatstyle = ' style="position:fixed;z-index:9999;'.$groupchat[$_GET['id']]['floatcss'].'"';
$widgethtml = '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl('groupchat', $_GET['id'], $groupchat[$_GET['id']]['lang'])).'" target="_blank"'.$floatstyle.'><img src="'.str_replace('include/', '', BASE_URL).JAK_FILES_DIRECTORY.'/buttons/'.$groupchat[$_GET['id']]['buttonimg'].'"></a>';
die(json_encode(array('status' => true, 'title' => $groupchat[$_GET['id']]['title'], 'widgethtml' => $widgethtml)));
// Chat is offline show nothing
} else {
die(json_encode(array('status' => false, 'error' => "Group Chat is offline")));
}
} else {
die(json_encode(array('status' => false, 'error' => "No Group Chat available with this ID.")));
}
?>
+94
View File
@@ -0,0 +1,94 @@
<?php
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
header("Access-Control-Allow-Origin: ".$_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Credentials: true');
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
// filter url inputs
function jak_valid_get_cross($value) {
$value = html_entity_decode($value);
$value = preg_replace('/[^\w-.]/', '', $value);
return trim(filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
// Check with callback
function is_valid_callback($input) {
$identifier_syntax
= '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$reserved_words = array('break', 'do', 'instanceof', 'typeof', 'case',
'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue',
'for', 'switch', 'while', 'debugger', 'function', 'this', 'with',
'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum',
'extends', 'super', 'const', 'export', 'import', 'implements', 'let',
'private', 'public', 'yield', 'interface', 'package', 'protected',
'static', 'null', 'true', 'false');
return preg_match($identifier_syntax, $input)
&& ! in_array(mb_strtolower($input, 'UTF-8'), $reserved_words);
}
// Check with callback 2
function is_valid_callback2($input) {
return !preg_match( '/[^0-9a-zA-Z\$_]|^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|volatile|void|while|with|NaN|Infinity|undefined)$/', $input);
}
$callback = false;
$callback = jak_valid_get_cross($_GET['callback']);
if (!isset($callback) || !is_valid_callback($callback) || !is_valid_callback2($callback)) {
header('status: 400 Bad Request', true, 400);
} else {
header('content-type: application/javascript; charset=utf-8');
}
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
if (!file_exists('../config.php')) die('include/[clientchat_cross.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and expiring date is true.
if ((isset($jakosub['groupchats']) && $jakosub['groupchats'] == 0) || (isset($jakosub['active']) && $jakosub['active'] == 0)) die(json_encode(array('status' => false, 'error' => "Account expired or no access to group chats.")));
// Some reset
$widgethtml = $floatstyle = '';
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Now check the button id
if (file_exists($cacheopid)) {
// Group Chat is online show it
if (isset($groupchat[$_GET['id']]["active"]) && $groupchat[$_GET['id']]["active"] == 1) {
// Float button? Position
$floatstyle = '';
if ($groupchat[$_GET['id']]['floatpopup'] && !empty($groupchat[$_GET['id']]['floatcss'])) $floatstyle = ' style="position:fixed;z-index:9999;'.$groupchat[$_GET['id']]['floatcss'].'"';
$widgethtml = '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl('groupchat', $groupchat["id"], $groupchat[$_GET['id']]['lang'])).'" target="_blank"'.$floatstyle.'><img src="'.str_replace('include/', '', BASE_URL).JAK_FILES_DIRECTORY.'/buttons/'.$groupchat[$_GET['id']]['buttonimg'].'"></a>';
die(json_encode(array('status' => true, 'title' => $jakwidget[$_GET['id']]['title'], 'widgethtml' => $widgethtml)));
// Chat is offline show nothing
} else {
die(json_encode(array('status' => false, 'error' => "Group Chat is offline")));
}
} else {
die(json_encode(array('status' => false, 'error' => "No Group Chat available with this ID.")));
}
?>
+1584
View File
File diff suppressed because one or more lines are too long
View File
+41
View File
@@ -0,0 +1,41 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 jakweb All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[available.php] config.php not exist');
require_once '../config.php';
if (!isset($_SESSION['jak_lcpc_email'])) die("Nothing to see here");
$formsuc = false;
if (JAK_CLIENTID && $jakclient->getVar("frontendadmin") == 1) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST) && !empty($_POST)) {
# code...
// Get the page id
$cid = preg_replace("/[^0-9]/", "", $_POST["fieldid"]);
// Get the slug name
$cslug = str_replace($cid, "", $_POST["fieldid"]);
// Get the value
$formsuc = $jakdb->get("translations", "description", ["AND" => ["opid" => $_SESSION['opid'], "cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]]);
die(json_encode(array("status" => true, "content" => $formsuc)));
}
}
}
die(json_encode(array("status" => $formsuc)));
?>
+211
View File
@@ -0,0 +1,211 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
// We set the widget id
if (isset($_GET['id']) && is_numeric($_GET['id'])) $widgetid = $_GET['id'];
if (!file_exists('../config.php')) die('include/[clientchat.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Destroy the session linked
if (isset($_SESSION['islinked'])) unset($_SESSION['islinked']);
// Get the referrer URL
$referrer = selfURL($_GET['currenturl']);
// Some reset
$widgethtml = $slideimg = '';
// Now check the button id
if (isset($_GET['id']) && is_numeric($_GET['id']) && $jakwidget[$widgetid]['id'] == $_GET['id']) {
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Is mobile
if ($ua->isMobile()) {
$clientos = "mobile";
} else {
$clientos = "desktop";
}
// Language file
$lang = $jakwidget[$widgetid]['lang'];
if (isset($_POST['lang']) && !empty($_POST['lang'])) $lang = $_POST['lang'];
// Import the language file
if ($lang && file_exists(APP_PATH.'lang/'.strtolower($lang).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($lang).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
$lang = JAK_LANG;
}
// Set first time visited so we can fire the pro active at the right time
if (isset($_POST['firstvisit']) && !empty($_POST['firstvisit'])) {
$firstvisit = $_POST['firstvisit'];
} else {
$firstvisit = time();
}
// Get the unique session for this customer
if (isset($_POST['rlbid']) && !empty($_POST['rlbid'])) {
$rlbid = $_POST['rlbid'];
} else {
$salt = rand(100, 99999);
$rlbid = $salt.time();
}
// We will update the button stat table
$btstat = $jakdb->update("buttonstats", ["depid" => $jakwidget[$widgetid]['depid'], "opid" => $jakwidget[$widgetid]['opid'], "singleopid" => $jakwidget[$widgetid]['singleopid'], "hits[+]" => 1, "referrer" => $referrer, "ip" => $ipa, "lasttime" => $jakdb->raw("NOW()")], ["session" => $rlbid]);
// Update database first to see who is online!
$geodata = "";
if (!$btstat->rowCount()) {
// get client information
$clientsystem = $ua->getPlatform().' - '.$ua->getBrowser(). " " . $ua->getVersion();
// Country Stuff
$country_name = 'Disabled';
$country_code = 'xx';
$city = 'Disabled';
$country_lng = $country_lat = '';
// we will use the local storage for geo
$removeloc = true;
if (isset($_POST['geo']) && !empty($_POST['geo'])) {
// Always escape any user input, including cookies:
list($city, $country_name, $country_code, $country_lat, $country_lng, $storedtime) = explode('|', strip_tags(jak_string_encrypt_decrypt($_POST['geo'], false)));
// We check if the geo data is older th3n
if (isset($storedtime) && !empty($storedtime) && strtotime('+3 day', $storedtime) < time() || (isset($country_code) && !empty($country_code))) $removeloc = false;
}
if ($removeloc) {
// Now let's check if the ip is ipv4
if ($ipa && !$ua->isRobot()) {
$ipc = curl_init();
curl_setopt($ipc, CURLOPT_URL, "https://ipgeo.jakweb.ch/api/".$ipa);
curl_setopt($ipc, CURLOPT_HEADER, false);
curl_setopt($ipc, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ipc);
curl_close($ipc);
$getinfo = json_decode($response, true);
if (isset($getinfo) && !empty($getinfo)) {
$country_name = ucwords(strtolower(filter_var($getinfo["country"]["name"], FILTER_SANITIZE_FULL_SPECIAL_CHARS)));
$country_code = strtolower(filter_var($getinfo["country"]["code"], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$city = filter_var($getinfo["city"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$country_lng = filter_var($getinfo["location"]["longitude"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$country_lat = filter_var($getinfo["location"]["latitude"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
// Setting a cookie with the data, which is set to expire in a week:
$geodata = jak_string_encrypt_decrypt($city.'|'.$country_name.'|'.$country_code.'|'.$country_lat.'|'.$country_lng.'|'.time());
}
}
}
$jakdb->insert("buttonstats", ["depid" => $jakwidget[$widgetid]['depid'], "opid" => $jakwidget[$widgetid]['opid'], "singleopid" => $jakwidget[$widgetid]['singleopid'], "referrer" => $referrer, "firstreferrer" => $referrer, "agent" => $clientsystem, "hits" => 1, "ip" => $ipa, "country" => $country_name, "countrycode" => $country_code, "latitude" => $country_lat, "longitude" => $country_lng, "session" => $rlbid, "time" => $jakdb->raw("NOW()"), "lasttime" => $jakdb->raw("NOW()")]);
}
// Let's check if we have a online conversation
if (isset($_POST['customer']) && !empty($_POST['customer'])) {
// Let's safely encrypt the chat data from the customer
$cudetails = jak_string_encrypt_decrypt($_POST['customer'], false);
// Let's explode the string (0 = convid, 1 = uniqueid, 2 = userid, 3 = name, 4 = email, 5 = phone, 6 = avatar)
$cudetails = explode(":#:", $cudetails);
// insert new referrer
$jakdb->insert("transcript", ["name" => $cudetails[3], "message" => sprintf($jkl['g55'], $referrer), "user" => $cudetails[2], "convid" => $cudetails[0], "time" => $jakdb->raw("NOW()"), "class" => "notice", "plevel" => 2]);
$lastrefid = $jakdb->id();
$jakdb->update("checkstatus", ["newo" => $lastrefid, "typec" => 0], ["convid" => $cudetails[0]]);
$pageload = JAK_rewrite::jakParseurl('lc', $_POST['cstatus'], $_GET['id'], $lang, $cudetails[0], $cudetails[1]);
// customer is chatting
$ischatting = true;
} else {
// Now let's check if we are on a page where we do not want to show the chat aka Black List
if (isset($HD_BLACKLIST) && !empty($HD_BLACKLIST)) if (filter_var($referrer, FILTER_VALIDATE_URL) && in_array($referrer, $HD_BLACKLIST)) die(json_encode(array('status' => false, 'error' => "Do not show chat on this page.")));
// No one chatting at the moment
$ischatting = false;
}
// We have a holiday mode and hide chat or no one is online and the chat widget is set to hide
if (!isset($_POST['customer']) && JAK_HOLIDAY_MODE == 2) {
die(json_encode(array('status' => false, 'error' => "No operator online and chat settings are set to hide.")));
}
// We have custom vars
$customvars = "";
if (!empty($_POST['name']) || !empty($_POST['email']) || !empty($_POST['msg'])) $customvars = jak_string_encrypt_decrypt(filter_var(jak_input_filter($_POST['name']), FILTER_SANITIZE_FULL_SPECIAL_CHARS).':#:'.filter_var($_POST['email'], FILTER_SANITIZE_EMAIL).':#:'.filter_var(jak_input_filter($_POST['msg']), FILTER_SANITIZE_FULL_SPECIAL_CHARS));
// We have a members only setting
if ($jakwidget[$widgetid]['onlymembers'] == 1 && !$ischatting && empty($customvars)) die(json_encode(array('status' => false, 'error' => "Only for members...")));
// page to load
if (!isset($pageload) && empty($pageload)) {
if (isset($_POST['cstatus']) && $_POST['cstatus'] == "open") {
$pageload = JAK_rewrite::jakParseurl('lc', 'open', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "big") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "profile") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "feedback") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "contactform") {
$pageload = JAK_rewrite::jakParseurl('lc', 'contactform', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} else {
$pageload = JAK_rewrite::jakParseurl('lc', 'closed', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
}
}
// We load the chat window
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="livesupportchat'.$_GET['id'].'" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; float: none; height: 100%; width: 100%; left: 0px; margin: 0px; padding: 0px; position: absolute; right: 0px; top: 0px;" scrolling="no" src="'.str_replace('include/', '', $pageload).'"></iframe>', 'url' => str_replace('include/', '', BASE_URL), 'customvars' => $customvars, 'clientos' => $clientos, 'firstvisit' => $firstvisit, 'lastvisit' => time(), 'geodata' => $geodata, 'rlbid' => $rlbid)));
} else {
die(json_encode(array('status' => false, 'error' => "No Widget available with this ID.")));
}
?>
+258
View File
@@ -0,0 +1,258 @@
<?php
$urlonly = parse_url(filter_var($_GET['crossurl'], FILTER_SANITIZE_URL));
$crossurl = $urlonly["scheme"].'://'.$urlonly["host"].(isset($urlonly['port']) ? ':'.$urlonly['port'] : '');
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
header("Access-Control-Allow-Origin: ".$crossurl);
header('Access-Control-Allow-Credentials: true');
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.5 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
// filter url inputs
function jak_valid_get_cross($value) {
$value = html_entity_decode($value);
$value = preg_replace('/[^\w\-.]/', '', $value);
return trim(filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
// Check with callback
function is_valid_callback($input) {
$identifier_syntax
= '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$reserved_words = array('break', 'do', 'instanceof', 'typeof', 'case',
'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue',
'for', 'switch', 'while', 'debugger', 'function', 'this', 'with',
'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum',
'extends', 'super', 'const', 'export', 'import', 'implements', 'let',
'private', 'public', 'yield', 'interface', 'package', 'protected',
'static', 'null', 'true', 'false');
return preg_match($identifier_syntax, $input)
&& ! in_array(mb_strtolower($input, 'UTF-8'), $reserved_words);
}
// Check with callback 2
function is_valid_callback2($input) {
return !preg_match( '/[^0-9a-zA-Z\$_]|^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|volatile|void|while|with|NaN|Infinity|undefined)$/', $input);
}
$callback = false;
$callback = jak_valid_get_cross($_GET['callback']);
if (!isset($callback) || !is_valid_callback($callback) || !is_valid_callback2($callback)) {
header('status: 400 Bad Request', true, 400);
} else {
header('content-type: application/javascript; charset=utf-8');
}
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
// We set the widget id
if (isset($_GET['id']) && is_numeric($_GET['id'])) $widgetid = $_GET['id'];
if (!file_exists('../config.php')) die('include/[clientchat_cross.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Destroy the session linked
if (isset($_SESSION['islinked'])) unset($_SESSION['islinked']);
// Get the referrer URL
$referrer = $crossurl.(isset($urlonly['path']) ? $urlonly['path'] : '');
// Some reset
$widgethtml = $slideimg = '';
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Is mobile
if ($ua->isMobile()) {
$clientos = "mobile";
} else {
$clientos = "desktop";
}
// Now check the button id
if (isset($_GET['id']) && is_numeric($_GET['id']) && $jakwidget[$_GET['id']]['id'] == $_GET['id']) {
// Language file
$lang = $jakwidget[$widgetid]['lang'];
if (isset($_POST['lang']) && !empty($_POST['lang'])) $lang = $_POST['lang'];
// Import the language file
if ($lang && file_exists(APP_PATH.'lang/'.strtolower($lang).'.php')) {
include_once(APP_PATH.'lang/'.strtolower($lang).'.php');
} else {
include_once(APP_PATH.'lang/'.JAK_LANG.'.php');
$lang = JAK_LANG;
}
// Set first time visited so we can fire the pro active at the right time
if (isset($_POST['firstvisit']) && !empty($_POST['firstvisit'])) {
$firstvisit = $_POST['firstvisit'];
} else {
$firstvisit = time();
}
// Get the unique session for this customer
if (isset($_POST['rlbid']) && !empty($_POST['rlbid'])) {
$rlbid = $_POST['rlbid'];
} else {
$salt = rand(100, 99999);
$rlbid = $salt.time();
}
// Set the session anyway
$_SESSION['rlbid'] = $rlbid;
// We will update the button stat table
$btstat = $jakdb->update("buttonstats", ["depid" => $jakwidget[$widgetid]['depid'], "opid" => $jakwidget[$widgetid]['opid'], "singleopid" => $jakwidget[$widgetid]['singleopid'], "hits[+]" => 1, "referrer" => $referrer, "crossurl" => $crossurl, "ip" => $ipa, "lasttime" => $jakdb->raw("NOW()")], ["session" => $rlbid]);
// Update database first to see who is online!
$geodata = "";
if (!$btstat->rowCount()) {
// get client information
$clientsystem = $ua->getPlatform().' - '.$ua->getBrowser(). " " . $ua->getVersion();
// Country Stuff
$country_name = 'Disabled';
$country_code = 'xx';
$city = 'Disabled';
$country_lng = $country_lat = '';
// we will use the local storage for geo
$removeloc = true;
if (isset($_POST['geo']) && !empty($_POST['geo'])) {
// Always escape any user input, including cookies:
list($city, $country_name, $country_code, $country_lat, $country_lng, $storedtime) = explode('|', strip_tags(jak_string_encrypt_decrypt($_POST['geo'], false)));
// We check if the geo data is older th3n
if (isset($storedtime) && !empty($storedtime) && strtotime('+3 day', $storedtime) < time() || (isset($country_code) && !empty($country_code))) $removeloc = false;
}
if ($removeloc) {
// Now let's check if the ip is ipv4
if ($ipa && !$ua->isRobot()) {
$ipc = curl_init();
curl_setopt($ipc, CURLOPT_URL, "https://ipgeo.jakweb.ch/api/".$ipa);
curl_setopt($ipc, CURLOPT_HEADER, false);
curl_setopt($ipc, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ipc);
curl_close($ipc);
$getinfo = json_decode($response, true);
if (isset($getinfo) && !empty($getinfo)) {
$country_name = ucwords(strtolower(filter_var($getinfo["country"]["name"], FILTER_SANITIZE_FULL_SPECIAL_CHARS)));
$country_code = strtolower(filter_var($getinfo["country"]["code"], FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$city = filter_var($getinfo["city"], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$country_lng = filter_var($getinfo["location"]["longitude"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$country_lat = filter_var($getinfo["location"]["latitude"], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
// Setting a cookie with the data, which is set to expire in a week:
$geodata = jak_string_encrypt_decrypt($city.'|'.$country_name.'|'.$country_code.'|'.$country_lat.'|'.$country_lng.'|'.time());
}
}
}
$jakdb->insert("buttonstats", ["depid" => $jakwidget[$widgetid]['depid'], "opid" => $jakwidget[$widgetid]['opid'], "singleopid" => $jakwidget[$widgetid]['singleopid'], "referrer" => $referrer, "firstreferrer" => $referrer, "crossurl" => $crossurl, "agent" => $clientsystem, "hits" => 1, "ip" => $ipa, "country" => $country_name, "countrycode" => $country_code, "latitude" => $country_lat, "longitude" => $country_lng, "session" => $rlbid, "time" => $jakdb->raw("NOW()"), "lasttime" => $jakdb->raw("NOW()")]);
}
if (isset($_POST['customer']) && !empty($_POST['customer'])) {
// Let's safely encrypt the chat data from the customer
$cudetails = jak_string_encrypt_decrypt($_POST['customer'], false);
// Let's explode the string (0 = convid, 1 = uniqueid, 2 = userid, 3 = name, 4 = email, 5 = phone, 6 = avatar)
$cudetails = explode(":#:", $cudetails);
// insert new referrer
$jakdb->insert("transcript", ["name" => $cudetails[3], "message" => sprintf($jkl['g55'], $referrer), "user" => $cudetails[2], "convid" => $cudetails[0], "time" => $jakdb->raw("NOW()"), "class" => "notice", "plevel" => 2]);
$lastrefid = $jakdb->id();
$jakdb->update("checkstatus", ["newo" => $lastrefid, "typec" => 0], ["convid" => $cudetails[0]]);
$pageload = JAK_rewrite::jakParseurl('lc', $_POST['cstatus'], $_GET['id'], $lang, $cudetails[0], $cudetails[1]);
// customer is chatting
$ischatting = true;
} else {
// Now let's check if we are on a page where we do not want to show the chat aka Black List
if (isset($HD_BLACKLIST) && !empty($HD_BLACKLIST)) if (filter_var($referrer, FILTER_VALIDATE_URL) && in_array($referrer, $HD_BLACKLIST)) die(json_encode(array('status' => false, 'error' => "Do not show chat on this page.")));
// No one chatting at the moment
$ischatting = false;
}
// We have a holiday mode and hide chat or no one is online and the chat widget is set to hide
if (!isset($_POST['customer']) && JAK_HOLIDAY_MODE == 2) {
die(json_encode(array('status' => false, 'error' => "No operator online and chat settings are set to hide.")));
}
// We have custom vars
$customvars = "";
if (!empty($_POST['name']) || !empty($_POST['email']) || !empty($_POST['msg'])) $customvars = jak_string_encrypt_decrypt(filter_var(jak_input_filter($_POST['name']), FILTER_SANITIZE_FULL_SPECIAL_CHARS).':#:'.filter_var($_POST['email'], FILTER_SANITIZE_EMAIL).':#:'.filter_var(jak_input_filter($_POST['msg']), FILTER_SANITIZE_FULL_SPECIAL_CHARS));
// We have a members only setting
if ($jakwidget[$widgetid]['onlymembers'] == 1 && !$ischatting && empty($customvars)) die(json_encode(array('status' => false, 'error' => "Only for members...")));
// page to load
if (!isset($pageload) && empty($pageload)) {
if (isset($_POST['cstatus']) && $_POST['cstatus'] == "open") {
$pageload = JAK_rewrite::jakParseurl('lc', 'open', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "big") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "profile") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "feedback") {
$pageload = JAK_rewrite::jakParseurl('lc', 'big', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} elseif (isset($_POST['cstatus']) && $_POST['cstatus'] == "contactform") {
$pageload = JAK_rewrite::jakParseurl('lc', 'contactform', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
} else {
$pageload = JAK_rewrite::jakParseurl('lc', 'closed', $_GET['id'], $lang, $jakwidget[$widgetid]['depid'], $jakwidget[$widgetid]['opid']);
}
}
// We load the chat window
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="livesupportchat'.$_GET['id'].'" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; float: none; height: 100%; width: 100%; left: 0px; margin: 0px; padding: 0px; position: absolute; right: 0px; top: 0px;" scrolling="no" src="'.str_replace('include/', '', $pageload).'"></iframe>', 'url' => str_replace('include/', '', BASE_URL), 'customvars' => $customvars, 'clientos' => $clientos, 'firstvisit' => $firstvisit, 'lastvisit' => time(), 'geodata' => $geodata, 'rlbid' => $rlbid)));
} else {
die(json_encode(array('status' => false, 'error' => "No Widget available with this ID.")));
}
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.1 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2020 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
if (!file_exists('../config.php')) die('include/[clientchat.php] config.php not exist');
require_once '../config.php';
if (isset($_SESSION["crossurl"])) unset($_SESSION["crossurl"]);
// We do not load any widget code if we are on hosted and and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a embed support area.")));
// Set the session for the embed part
if (!isset($_SESSION["webembed"])) $_SESSION["webembed"] = true;
// Now let's set the category id if we have any
$faqurl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_FAQ_URL));
if (isset($_GET['catid']) && is_numeric($_GET['catid'])) $faqurl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_FAQ_URL, 'c', $_GET['catid']));
// Now get the support frame into the div.
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="hd3support" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; height: 100%; margin: 0px; padding: 0px; width: 100%;" src="'.$faqurl.'"></iframe>')));
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
$urlonly = parse_url(filter_var($_GET['crossurl'], FILTER_SANITIZE_URL));
$crossurl = $urlonly["scheme"].'://'.$urlonly["host"].(isset($urlonly['port']) ? ':'.$urlonly['port'] : '');
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
header("Access-Control-Allow-Origin: ".$crossurl);
header('Access-Control-Allow-Credentials: true');
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
// filter url inputs
function jak_valid_get_cross($value) {
$value = html_entity_decode($value);
$value = preg_replace('/[^\w\-.]/', '', $value);
return trim(filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
// Check with callback
function is_valid_callback($input) {
$identifier_syntax
= '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$reserved_words = array('break', 'do', 'instanceof', 'typeof', 'case',
'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue',
'for', 'switch', 'while', 'debugger', 'function', 'this', 'with',
'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum',
'extends', 'super', 'const', 'export', 'import', 'implements', 'let',
'private', 'public', 'yield', 'interface', 'package', 'protected',
'static', 'null', 'true', 'false');
return preg_match($identifier_syntax, $input)
&& ! in_array(mb_strtolower($input, 'UTF-8'), $reserved_words);
}
// Check with callback 2
function is_valid_callback2($input) {
return !preg_match( '/[^0-9a-zA-Z\$_]|^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|volatile|void|while|with|NaN|Infinity|undefined)$/', $input);
}
$callback = false;
$callback = jak_valid_get_cross($_GET['callback']);
if (!isset($callback) || !is_valid_callback($callback) || !is_valid_callback2($callback)) {
header('status: 400 Bad Request', true, 400);
} else {
header('content-type: application/javascript; charset=utf-8');
}
if (!file_exists('../config.php')) die('include/[clientchat_cross.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot() || $ua->isFacebook()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Set the session for the embed part
if (!isset($_SESSION["webembed"])) $_SESSION["webembed"] = true;
// Now let's set the category id if we have any
$faqurl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_FAQ_URL));
if (isset($_GET['catid']) && is_numeric($_GET['catid'])) $faqurl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_FAQ_URL, 'c', $_GET['catid']));
// Now get the support frame into the div.
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="hd3support" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; height: 100%; margin: 0px; padding: 0px; width: 100%;" scrolling="no" src="'.$faqurl.'"></iframe>')));
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.1 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2020 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_GET['id']) && !is_numeric($_GET['id'])) die(json_encode(array('status' => false, 'error' => "No valid ID.")));
if (!file_exists('../config.php')) die('include/[clientchat.php] config.php not exist');
require_once '../config.php';
if (isset($_SESSION["crossurl"])) unset($_SESSION["crossurl"]);
// We do not load any widget code if we are on hosted and and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot()) die(json_encode(array('status' => false, 'error' => "Robots do not need a embed support area.")));
// Set the session for the embed part
if (!isset($_SESSION["webembed"])) $_SESSION["webembed"] = true;
// Now let's set the category id if we have any
$supporturl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL));
if (isset($_GET['catid']) && is_numeric($_GET['catid'])) $supporturl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 'c', $_GET['catid']));
// Now get the support frame into the div.
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="hd3support" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; height: 100%; margin: 0px; padding: 0px; width: 100%;" src="'.$supporturl.'"></iframe>')));
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
$urlonly = parse_url(filter_var($_GET['crossurl'], FILTER_SANITIZE_URL));
$crossurl = $urlonly["scheme"].'://'.$urlonly["host"].(isset($urlonly['port']) ? ':'.$urlonly['port'] : '');
header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1998 03:10:00 GMT");
header("Access-Control-Allow-Origin: ".$crossurl);
header('Access-Control-Allow-Credentials: true');
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
// filter url inputs
function jak_valid_get_cross($value) {
$value = html_entity_decode($value);
$value = preg_replace('/[^\w\-.]/', '', $value);
return trim(filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
// Check with callback
function is_valid_callback($input) {
$identifier_syntax
= '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$reserved_words = array('break', 'do', 'instanceof', 'typeof', 'case',
'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue',
'for', 'switch', 'while', 'debugger', 'function', 'this', 'with',
'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum',
'extends', 'super', 'const', 'export', 'import', 'implements', 'let',
'private', 'public', 'yield', 'interface', 'package', 'protected',
'static', 'null', 'true', 'false');
return preg_match($identifier_syntax, $input)
&& ! in_array(mb_strtolower($input, 'UTF-8'), $reserved_words);
}
// Check with callback 2
function is_valid_callback2($input) {
return !preg_match( '/[^0-9a-zA-Z\$_]|^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|volatile|void|while|with|NaN|Infinity|undefined)$/', $input);
}
$callback = false;
$callback = jak_valid_get_cross($_GET['callback']);
if (!isset($callback) || !is_valid_callback($callback) || !is_valid_callback2($callback)) {
header('status: 400 Bad Request', true, 400);
} else {
header('content-type: application/javascript; charset=utf-8');
}
if (!file_exists('../config.php')) die('include/[clientchat_cross.php] config.php not exist');
require_once '../config.php';
// We do not load any widget code if we are on hosted and expiring date is true.
if ($jakosub['active'] == 0) die(json_encode(array('status' => false, 'error' => "Account expired.")));
// Get the client browser
$ua = new Browser();
// Is a robot just die
if ($ua->isRobot() || $ua->isFacebook()) die(json_encode(array('status' => false, 'error' => "Robots do not need a live chat.")));
// Set the session for the embed part
if (!isset($_SESSION["webembed"])) $_SESSION["webembed"] = true;
// Now let's set the category id if we have any
$supporturl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL));
if (isset($_GET['catid']) && is_numeric($_GET['catid'])) $supporturl = str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 'c', $_GET['catid']));
// Now get the support frame into the div.
die(json_encode(array('status' => true, 'widgethtml' => '<iframe id="hd3support" seamless="seamless" allowtransparency="true" style="background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; border: 0px none; bottom: 0px; height: 100%; margin: 0px; padding: 0px; width: 100%;" scrolling="no" src="'.$supporturl.'"></iframe>')));
?>
+80
View File
@@ -0,0 +1,80 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[similar_search.php] config.php not exist');
require_once '../config.php';
// Database tables
$jaktable = 'support_departments';
$jaktable2 = 'ticketpriority';
$jaktable3 = 'ticketoptions';
// Reset some vars
$errormsg = $errors = false;
$DEP_CREDIT = 0;
$JAK_PRE_CONTENT = '';
if (isset($_SESSION['jak_lcp_lang']) && file_exists(APP_PATH.'lang/'.$BT_LANGUAGE.'.php')) {
include (APP_PATH.'lang/'.$BT_LANGUAGE.'.php');
} else {
include (APP_PATH.'lang/'.JAK_LANG.'.php');
}
if (isset($_GET['depid']) && !empty($_GET['depid']) && is_numeric($_GET['depid'])) {
// Let us collect the department details.
if (isset($HD_SUPPORT_DEPARTMENTS) && is_array($HD_SUPPORT_DEPARTMENTS)) foreach ($HD_SUPPORT_DEPARTMENTS as $v) {
if ($v["id"] == $_GET['depid']) {
$DEP_CREDIT = $v["credits"];
}
}
if (JAK_CLIENTID) {
// We run on a credit based system?
if (JAK_BILLING_MODE == 1) {
// We need to get the credits
if ($jakclient->getVar("credits") < $DEP_CREDIT) {
$errormsg = sprintf($jkl["hd103"], $jakclient->getVar("credits"), JAK_rewrite::jakParseurl(JAK_CLIENT_URL));
}
// We run the membership based system
} elseif (JAK_BILLING_MODE == 2 && strtotime($jakclient->getVar("paid_until")) < time()) {
$errormsg = sprintf($jkl['hd104'], JAK_rewrite::jakParseurl(JAK_CLIENT_URL));
}
if ($errormsg) {
die(json_encode(array("status" => 0, "errormsg" => $errormsg)));
}
}
// Get all priorities but only if there is any
$TPRIORITY = "";
$PRIORITY_ALL = $jakdb->select($jaktable2, ["id", "title"], ["AND" => ["opid" => $_SESSION['opid'], "depid" => [0, $_GET['depid']], "oponly" => 0], "ORDER" => ["dorder" => "ASC"]]);
if (!empty($PRIORITY_ALL)) $TPRIORITY = $PRIORITY_ALL;
// Get all options but only if there is any
$TOPTIONS = "";
$TOPTIONS_ALL = $jakdb->select($jaktable3, ["id", "title"], ["AND" => ["opid" => $_SESSION['opid'], "depid" => [0, $_GET['depid']], "oponly" => 0], "ORDER" => ["dorder" => "ASC"]]);
if (!empty($TOPTIONS_ALL)) $TOPTIONS = $TOPTIONS_ALL;
// Get the custom fields if any jak_get_custom_fields($location, $opid, $depid, $clientid, $ticketid, $contactid, $lang, $readonly, $admin, $table, $registerform, $errors = NULL)
$custom_fields = jak_get_custom_fields(2, $_SESSION['opid'], $_GET["depid"], JAK_CLIENTID, 0, 0, $BT_LANGUAGE, false, false, false, false, $errors);
// finally get the predefined message if any.
$JAK_PRE_CONTENT = $jakdb->get($jaktable, "pre_content", ["AND" => ["opid" => $_SESSION['opid'], "id" => $_GET['depid']]]);
die(json_encode(array("status" => 1, "ticketpriority" => $TPRIORITY, "ticketoptions" => $TOPTIONS, "customfields" => $custom_fields, "precontent" => $JAK_PRE_CONTENT)));
} else {
die(json_encode(array("status" => 0, "errormsg" => $jkl['e25'])));
}
?>
+430
View File
@@ -0,0 +1,430 @@
<?php
/**
* Class NexmoMessage handles the methods and properties of sending an SMS message.
*
* Usage: $var = new NexoMessage ( $account_key, $account_password );
* Methods:
* sendText ( $to, $from, $message, $unicode = null )
* sendBinary ( $to, $from, $body, $udh )
* pushWap ( $to, $from, $title, $url, $validity = 172800000 )
* displayOverview( $nexmo_response=null )
*
* inboundText ( $data=null )
* reply ( $text )
*
*
*/
class NexmoMessage {
// Nexmo account credentials
private $nx_key = '';
private $nx_secret = '';
/**
* @var string Nexmo server URI
*
* We're sticking with the JSON interface here since json
* parsing is built into PHP and requires no extensions.
* This will also keep any debugging to a minimum due to
* not worrying about which parser is being used.
*/
var $nx_uri = 'https://rest.nexmo.com/sms/json';
/**
* @var array The most recent parsed Nexmo response.
*/
private $nexmo_response = '';
/**
* @var bool If recieved an inbound message
*/
var $inbound_message = false;
// Current message
public $to = '';
public $from = '';
public $text = '';
public $network = '';
public $message_id = '';
// A few options
public $ssl_verify = false; // Verify Nexmo SSL before sending any message
function NexmoMessage ($api_key, $api_secret) {
$this->nx_key = $api_key;
$this->nx_secret = $api_secret;
}
/**
* Prepare new text message.
*
* If $unicode is not provided we will try to detect the
* message type. Otherwise set to TRUE if you require
* unicode characters.
*/
function sendText ( $to, $from, $message, $unicode=null ) {
// Making sure strings are UTF-8 encoded
if ( !is_numeric($from) && !mb_check_encoding($from, 'UTF-8') ) {
trigger_error('$from needs to be a valid UTF-8 encoded string');
return false;
}
if ( !mb_check_encoding($message, 'UTF-8') ) {
trigger_error('$message needs to be a valid UTF-8 encoded string');
return false;
}
if ($unicode === null) {
$containsUnicode = max(array_map('ord', str_split($message))) > 127;
} else {
$containsUnicode = (bool)$unicode;
}
// Make sure $from is valid
$from = $this->validateOriginator($from);
// URL Encode
$from = urlencode( $from );
$message = urlencode( $message );
// Send away!
$post = array(
'from' => $from,
'to' => $to,
'text' => $message,
'type' => $containsUnicode ? 'unicode' : 'text'
);
return $this->sendRequest ( $post );
}
/**
* Prepare new WAP message.
*/
function sendBinary ( $to, $from, $body, $udh ) {
//Binary messages must be hex encoded
$body = bin2hex ( $body );
$udh = bin2hex ( $udh );
// Make sure $from is valid
$from = $this->validateOriginator($from);
// Send away!
$post = array(
'from' => $from,
'to' => $to,
'type' => 'binary',
'body' => $body,
'udh' => $udh
);
return $this->sendRequest ( $post );
}
/**
* Prepare new binary message.
*/
function pushWap ( $to, $from, $title, $url, $validity = 172800000 ) {
// Making sure $title and $url are UTF-8 encoded
if ( !mb_check_encoding($title, 'UTF-8') || !mb_check_encoding($url, 'UTF-8') ) {
trigger_error('$title and $udh need to be valid UTF-8 encoded strings');
return false;
}
// Make sure $from is valid
$from = $this->validateOriginator($from);
// Send away!
$post = array(
'from' => $from,
'to' => $to,
'type' => 'wappush',
'url' => $url,
'title' => $title,
'validity' => $validity
);
return $this->sendRequest ( $post );
}
/**
* Prepare and send a new message.
*/
private function sendRequest ( $data ) {
// Build the post data
$data = array_merge($data, array('username' => $this->nx_key, 'password' => $this->nx_secret));
$post = '';
foreach($data as $k => $v){
$post .= "&$k=$v";
}
// If available, use CURL
if (function_exists('curl_version')) {
$to_nexmo = curl_init( $this->nx_uri );
curl_setopt( $to_nexmo, CURLOPT_POST, true );
curl_setopt( $to_nexmo, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $to_nexmo, CURLOPT_POSTFIELDS, $post );
if (!$this->ssl_verify) {
curl_setopt( $to_nexmo, CURLOPT_SSL_VERIFYPEER, false);
}
$from_nexmo = curl_exec( $to_nexmo );
curl_close ( $to_nexmo );
} elseif (ini_get('allow_url_fopen')) {
// No CURL available so try the awesome file_get_contents
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $post
)
);
$context = stream_context_create($opts);
$from_nexmo = file_get_contents($this->nx_uri, false, $context);
} else {
// No way of sending a HTTP post :(
return false;
}
return $this->nexmoParse( $from_nexmo );
}
/**
* Recursively normalise any key names in an object, removing unwanted characters
*/
private function normaliseKeys ($obj) {
// Determine is working with a class or araay
if ($obj instanceof stdClass) {
$new_obj = new stdClass();
$is_obj = true;
} else {
$new_obj = array();
$is_obj = false;
}
foreach($obj as $key => $val){
// If we come across another class/array, normalise it
if ($val instanceof stdClass || is_array($val)) {
$val = $this->normaliseKeys($val);
}
// Replace any unwanted characters in they key name
if ($is_obj) {
$new_obj->{str_replace('-', '', $key)} = $val;
} else {
$new_obj[str_replace('-', '', $key)] = $val;
}
}
return $new_obj;
}
/**
* Parse server response.
*/
private function nexmoParse ( $from_nexmo ) {
$response = json_decode($from_nexmo);
// Copy the response data into an object, removing any '-' characters from the key
$response_obj = $this->normaliseKeys($response);
if ($response_obj) {
$this->nexmo_response = $response_obj;
// Find the total cost of this message
$response_obj->cost = $total_cost = 0;
if (is_array($response_obj->messages)) {
foreach ($response_obj->messages as $msg) {
if (property_exists($msg, "messageprice")) {
$total_cost = $total_cost + (float)$msg->messageprice;
}
}
$response_obj->cost = $total_cost;
}
return $response_obj;
} else {
// A malformed response
$this->nexmo_response = array();
return false;
}
}
/**
* Validate an originator string
*
* If the originator ('from' field) is invalid, some networks may reject the network
* whilst stinging you with the financial cost! While this cannot correct them, it
* will try its best to correctly format them.
*/
private function validateOriginator($inp){
// Remove any invalid characters
$ret = preg_replace('/[^a-zA-Z0-9]/', '', (string)$inp);
if(preg_match('/[a-zA-Z]/', $inp)){
// Alphanumeric format so make sure it's < 11 chars
$ret = substr($ret, 0, 11);
} else {
// Numerical, remove any prepending '00'
if(substr($ret, 0, 2) == '00'){
$ret = substr($ret, 2);
$ret = substr($ret, 0, 15);
}
}
return (string)$ret;
}
/**
* Display a brief overview of a sent message.
* Useful for debugging and quick-start purposes.
*/
public function displayOverview( $nexmo_response=null ){
$info = (!$nexmo_response) ? $this->nexmo_response : $nexmo_response;
if (!$nexmo_response ) return 'Cannot display an overview of this response';
// How many messages were sent?
if ( $info->messagecount > 1 ) {
$status = 'Your message was sent in ' . $info->messagecount . ' parts';
} elseif ( $info->messagecount == 1) {
$status = 'Your message was sent';
} else {
return 'There was an error sending your message';
}
// Build an array of each message status and ID
if (!is_array($info->messages)) $info->messages = array();
$message_status = array();
foreach ( $info->messages as $message ) {
$tmp = array('id'=>'', 'status'=>0);
if ( $message->status != 0) {
$tmp['status'] = $message->errortext;
} else {
$tmp['status'] = 'OK';
$tmp['id'] = $message->messageid;
}
$message_status[] = $tmp;
}
// Build the output
if (isset($_SERVER['HTTP_HOST'])) {
// HTML output
$ret = '<table><tr><td colspan="2">'.$status.'</td></tr>';
$ret .= '<tr><th>Status</th><th>Message ID</th></tr>';
foreach ($message_status as $mstat) {
$ret .= '<tr><td>'.$mstat['status'].'</td><td>'.$mstat['id'].'</td></tr>';
}
$ret .= '</table>';
} else {
// CLI output
$ret = "$status:\n";
// Get the sizes for the table
$out_sizes = array('id'=>strlen('Message ID'), 'status'=>strlen('Status'));
foreach ($message_status as $mstat) {
if ($out_sizes['id'] < strlen($mstat['id'])) {
$out_sizes['id'] = strlen($mstat['id']);
}
if ($out_sizes['status'] < strlen($mstat['status'])) {
$out_sizes['status'] = strlen($mstat['status']);
}
}
$ret .= ' '.str_pad('Status', $out_sizes['status'], ' ').' ';
$ret .= str_pad('Message ID', $out_sizes['id'], ' ')."\n";
foreach ($message_status as $mstat) {
$ret .= ' '.str_pad($mstat['status'], $out_sizes['status'], ' ').' ';
$ret .= str_pad($mstat['id'], $out_sizes['id'], ' ')."\n";
}
}
return $ret;
}
/**
* Inbound text methods
*/
/**
* Check for any inbound messages, using $_GET by default.
*
* This will set the current message to the inbound
* message allowing for a future reply() call.
*/
public function inboundText( $data=null ){
if(!$data) $data = $_GET;
if(!isset($data['text'], $data['msisdn'], $data['to'])) return false;
// Get the relevant data
$this->to = $data['to'];
$this->from = $data['msisdn'];
$this->text = $data['text'];
$this->network = (isset($data['network-code'])) ? $data['network-code'] : '';
$this->message_id = $data['messageId'];
// Flag that we have an inbound message
$this->inbound_message = true;
return true;
}
/**
* Reply the current message if one is set.
*/
public function reply ($message) {
// Make sure we actually have a text to reply to
if (!$this->inbound_message) {
return false;
}
return $this->sendText($this->from, $this->to, $message);
}
}
?>
View File
+47
View File
@@ -0,0 +1,47 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 1.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2021 jakweb All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('include/[save_content.php] config.php not exist');
require_once '../config.php';
if (!isset($_SESSION['jak_lcpc_email'])) die("Nothing to see here");
$formsuc = false;
if (JAK_CLIENTID && $jakclient->getVar("frontendadmin") == 1) {
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST) && !empty($_POST)) {
# code...
// Get the page id
$cid = preg_replace("/[^0-9]/", "", $_POST["fieldid"]);
// Get the slug name
$cslug = str_replace($cid, "", $_POST["fieldid"]);
// Clean the content
$val = jak_clean_safe_userpost($_POST["content"]);
if ($jakdb->has("translations", ["AND" => ["opid" => $_SESSION['opid'], "cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]])) {
$jakdb->update("translations", ["description" => $val], ["AND" => ["opid" => $_SESSION['opid'],"cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]]);
} else {
$jakdb->insert("translations", ["opid" => $_SESSION['opid'], "description" => $val, "cmsid" => $cid, "cmsslug" => $cslug, "lang" => $BT_LANGUAGE]);
}
// We have stored something
$formsuc = true;
}
}
}
die(json_encode(array("status" => $formsuc)));
?>
+84
View File
@@ -0,0 +1,84 @@
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.2 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[similar_search.php] config.php not exist');
require_once '../config.php';
// Database tables
$jaktable = 'support_tickets';
$jaktable1 = 'faq_article';
$jaktable2 = 'faq_categories';
// Reset vars
$searchmsg = $similar_articles = '';
$searchtickets = array();
$searchfaq = array();
if (isset($_GET['s']) && !empty($_GET['s'])) {
// Sanitise the search string
$searchmsg = html_entity_decode($_GET['s']);
$searchmsg = strip_tags($searchmsg);
$searchmsg = filter_var($searchmsg, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$searchmsg = trim($searchmsg);
if (isset($searchmsg) && !empty($searchmsg)) {
// Let's dig through the database
if (JAK_USERISLOGGED && JAK_CLIENTID != 0) {
$searchtickets = $jakdb->select($jaktable, ["id", "subject", "content", "initiated", "updated", "ended"], ["AND" => ["OR" => ["subject[~]" => $searchmsg, "content[~]" => $searchmsg]], "opid" => $opcacheid, "private" => 0, "clientid[!]" => JAK_CLIENTID, "ORDER" => ["updated" => "DESC"], "LIMIT" => 10]);
$searchfaq = $jakdb->select($jaktable1, ["id", "title", "content", "lang"], ["AND" => ["OR" => ["title[~]" => $searchmsg, "content[~]" => $searchmsg]], "opid" => $opcacheid, "active" => 1, "ORDER" => ["dorder" => "DESC"], "LIMIT" => 10]);
} else {
$searchtickets = $jakdb->select($jaktable, ["id", "subject", "content", "initiated", "updated", "ended"], ["AND" => ["OR" => ["subject[~]" => $searchmsg, "content[~]" => $searchmsg]], "opid" => $opcacheid, "private" => 0, "ORDER" => ["updated" => "DESC"], "LIMIT" => 10]);
$searchfaq = $jakdb->select($jaktable1, ["[>]faq_categories" => ["catid" => "id"]], ["id", "title", "content", "lang"], ["AND" => ["OR" => ["title[~]" => $searchmsg, "content[~]" => $searchmsg]], "opid" => $opcacheid, "active" => 1, "guesta" => 1, "ORDER" => ["dorder" => "DESC"], "LIMIT" => 10]);
}
if (isset($searchtickets) && !empty($searchtickets) || isset($searchfaq) && !empty($searchfaq)) {
$similar_articles .= '<div class="list-group">';
if (!empty($searchtickets)) foreach ($searchtickets as $t) {
# code...
$similar_articles .= '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $t["id"], JAK_rewrite::jakCleanurl($t["subject"]))).'" target="_blank" class="list-group-item list-group-item-light"><div class="d-flex w-100 justify-content-between"><h5 class="mb-1 mt-0">'.$t["subject"].'</h5><small>'.JAK_base::jakTimesince($t["updated"], JAK_DATEFORMAT, JAK_TIMEFORMAT).'</small></div><p class="mb-1">'.jak_cut_text($t["content"], 100, "...").'</p></a>';
}
if (!empty($searchfaq)) foreach ($searchfaq as $f) {
# code...
$similar_articles .= '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_FAQ_URL, 'a', $f["id"], JAK_rewrite::jakCleanurl($f["title"]))).'" target="_blank" class="list-group-item list-group-item-dark"><div class="d-flex w-100 justify-content-between"><h5 class="mb-1 mt-0">'.$f["title"].'</h5><small>'.strtoupper($f["lang"]).'</small></div><p class="mb-1">'.jak_cut_text($f["content"], 100, "...").'</p></a>';
}
$similar_articles .= '</div>';
}
if (!empty($similar_articles)) {
die(json_encode(array("status" => 1, "articles" => $similar_articles)));
} else {
die(json_encode(array("status" => 0)));
}
}
die(json_encode(array("status" => 0)));
} else {
die(json_encode(array("status" => 0)));
}
?>
+93
View File
@@ -0,0 +1,93 @@
<?php
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / Version 2.0.5 # ||
|| # ----------------------------------------- # ||
|| # Copyright 2022 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('include/[support.php] config.php not exist');
require_once '../config.php';
if (!file_exists('../class/ssp.class.php')) die('include/[support.php] ssp.class.php not exist');
require_once '../class/ssp.class.php';
// Get the correct tickets
$where = 't1.opid = '.$_SESSION['opid'];
if (JAK_CLIENTID) {
if ($jakclient->getVar("support_dep") == 0) {
// ["AND" => ["OR" => ["support_tickets.private" => 0, "support_tickets.clientid" => JAK_CLIENTID], "support_departments.guesta" => 1]]
$where .= " AND (t1.private = 0 OR t1.clientid = ".JAK_CLIENTID.")";
} else {
// ["AND" => ["OR" => ["support_tickets.private" => 0, "support_tickets.depid" => [$jakclient->getVar("support_dep")], "support_tickets.clientid" => JAK_CLIENTID], "support_departments.guesta" => 1]]
$where .= " AND (t1.private = 0 OR t1.clientid = ".JAK_CLIENTID." OR t1.depid IN('".explode(",", $jakclient->getVar("support_dep"))."'))";
}
} elseif (JAK_USERID) {
if ($jakuser->getVar("support_dep") == 0) {
// ["AND" => ["OR" => ["support_tickets.private" => 0, "support_tickets.clientid" => JAK_CLIENTID], "support_departments.guesta" => 1]]
$where .= '';
} else {
// ["AND" => ["OR" => ["support_tickets.private" => 0, "support_tickets.depid" => [$jakclient->getVar("support_dep")], "support_tickets.clientid" => JAK_CLIENTID], "support_departments.guesta" => 1]]
$where .= " AND t1.depid IN('".explode(",", $jakuser->getVar("support_dep"))."')";
}
} else {
$where .= " AND t1.private = 0 AND t2.guesta = 1";
}
if (isset($_SESSION["sortdepid"]) && is_numeric($_SESSION["sortdepid"])) $where .= ' AND t1.depid = '.$_SESSION["sortdepid"];
// DB table to use
$table = JAKDB_PREFIX.'support_tickets AS t1';
$table2 = ' LEFT JOIN '.JAKDB_PREFIX.'support_departments AS t2 ON (t1.depid = t2.id)';
$table3 = ' LEFT JOIN '.JAKDB_PREFIX.'ticketpriority AS t3 ON (t1.priorityid = t3.id)';
// Table's primary key
$primaryKey = 't1.id';
// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
array( 'db' => 't1.id', 'dbjoin' => 'id', 'dt' => 0 ),
array( 'db' => 't1.subject', 'dbjoin' => 'subject', 'dt' => 1, 'formatter' => function( $d, $row ) {
return '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $row['id'], JAK_rewrite::jakCleanurl($row["subject"]))).'" class="btn btn-link btn-default">'.$d.'</a>';
} ),
array( 'db' => 't2.title', 'dbjoin' => 'title', 'dt' => 2 ),
array( 'db' => 't1.name', 'dbjoin' => 'name', 'dt' => 3 ),
array( 'db' => 't1.initiated', 'dbjoin' => 'initiated', 'dt' => 4, 'formatter' => function( $d, $row ) {
return JAK_base::jakTimesince($d, JAK_DATEFORMAT, JAK_TIMEFORMAT);
} ),
array( 'db' => 't1.status', 'dbjoin' => 'status', 'dt' => 5, 'formatter' => function( $d, $row ) {
if (isset($BT_LANGUAGE) && isset($_SESSION['jak_lcp_lang']) && file_exists(APP_PATH.'lang/'.$BT_LANGUAGE.'.php')) {
include (APP_PATH.'lang/'.$BT_LANGUAGE.'.php');
} else {
include (APP_PATH.'lang/'.JAK_LANG.'.php');
}
global $HD_SUPPORT_STATUS;
$support_status = '';
if (isset($HD_SUPPORT_STATUS) && !empty($HD_SUPPORT_STATUS)) foreach ($HD_SUPPORT_STATUS as $v) {
if (isset($d) && $d == $v['id']) {
$support_status = '<span class="badge badge-pill badge-'.$v["class"].'">'.$v['title'].'</span>';
break;
}
}
return $support_status.' <span class="badge badge-pill badge-'.$row["class"].'">'.$row["prioritytitle"].'</span>';
} ),
array( 'db' => 't1.subject', 'dbjoin' => 'subject', 'dt' => 6, 'formatter' => function( $d, $row ) {
if (isset($BT_LANGUAGE) && isset($_SESSION['jak_lcp_lang']) && file_exists(APP_PATH.'lang/'.$BT_LANGUAGE.'.php')) {
include (APP_PATH.'lang/'.$BT_LANGUAGE.'.php');
} else {
include (APP_PATH.'lang/'.JAK_LANG.'.php');
}
return '<a href="'.str_replace('include/', '', JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $row['id'], JAK_rewrite::jakCleanurl($row["subject"]))).'" class="btn btn-primary btn-sm">'.$jkl['hd13'].'</a>';
} ),
array( 'db' => 't1.updated', 'dbjoin' => 'updated', 'dt' => 7 ),
array( 'db' => 't3.title AS prioritytitle', 'dbjoin' => 'prioritytitle', 'dt' => 8 ),
array( 'db' => 't3.class', 'dbjoin' => 'class', 'dt' => 9 )
);
die(json_encode(SSP::join( $_GET, $table, $table2, $table3, $primaryKey, $columns, $where, $where )));
?>