139 lines
3.6 KiB
PHP
Executable File
139 lines
3.6 KiB
PHP
Executable File
<?php
|
|
include_once 'path.php';
|
|
|
|
$uname = $_POST['uname'];
|
|
$email = $_POST['email'];
|
|
$contact = $_POST['number'];
|
|
$ticket = $_POST['ticketnum'];
|
|
$msg = $_POST['msg'];
|
|
|
|
if($userName == '') {
|
|
$userName = $uname;
|
|
}
|
|
|
|
machineBasedContent($machine);
|
|
$machineDet = getSystemDetails();
|
|
$DSMDetails = getDSMInfo();
|
|
$currVersion ='';
|
|
if(!empty($appVersion))
|
|
$currVersion = trim(str_replace("Version","",$appVersion));
|
|
$errorInfoPath = Scheduler::$nasUser_dir ."$userName/sendErrorInfo.txt";
|
|
$logPath = Scheduler::$nasUser_dir . "$userName/.trace/log_$currVersion.txt";
|
|
$traceLogPath = Scheduler::$nasUser_dir . "$userName/.trace/traceLog_$currVersion.txt";
|
|
|
|
if($_SESSION['isProxyEnabled'] == true) {
|
|
$proxy = "yes";
|
|
} else {
|
|
$proxy = "No";
|
|
}
|
|
|
|
$sendto = urlencode("support@idrive.com");
|
|
$subject = "IDrive {$appName} User Feedback {$ticket}";
|
|
|
|
$log = "";
|
|
$tlog = "";
|
|
|
|
if(file_exists($logPath)) {
|
|
$log = file_get_contents($logPath);
|
|
}
|
|
|
|
if(file_exists($traceLogPath)) {
|
|
$tlog = file_get_contents($traceLogPath);
|
|
}
|
|
|
|
if($_SESSION['totalQuota'] == '' || $_SESSION['totalQuota'] == 0) {
|
|
$_SESSION['totalQuota'] = 0;
|
|
$_SESSION['usedQuota'] = 0;
|
|
}
|
|
$user = $_SESSION['nasUser'];
|
|
if($_SESSION['nasUser']=='root')
|
|
$user = 'admin';
|
|
|
|
$content = "<<< Feedback from " . $appTitle . " - : " . $appVersion . ">>>
|
|
Release Date: " . $releaseDate . "
|
|
Machine Details: " . $machineDet . "
|
|
NAS Details: " . $DSMDetails . "
|
|
Browser: " . $_SERVER['HTTP_USER_AGENT'] . "
|
|
Computer Name: " . gethostname() . "
|
|
Profile Name: " . $user . "
|
|
Proxy server: " . $proxy . "
|
|
IDrive Username: " . $userName . "
|
|
Total Quota: " . $_SESSION['totalQuota'] . " GB
|
|
Used space: " . $_SESSION['usedQuota'] . " GB
|
|
E-mail address: " . $email . "
|
|
Contact phone number: " . $contact . "
|
|
|
|
Technical issues/comments/suggestions:
|
|
|
|
" . $msg;
|
|
|
|
if($log != '') {
|
|
$content .= "
|
|
|
|
IDrive " . LOG_FILE . "
|
|
-----------------------------------------------
|
|
|
|
" . $log;
|
|
}
|
|
|
|
if($tlog != '') {
|
|
$content .= "
|
|
|
|
|
|
IDrive " . TRACE_LOG_FILE . "
|
|
-----------------------------------------------
|
|
|
|
" . $tlog;
|
|
}
|
|
|
|
saveErrorInfo();
|
|
$content = urlencode($content); # Encoding the email content
|
|
$subject = urlencode($subject);
|
|
$postFields = "Email=$sendto&subject=$subject&content=$content&user_email=$email";
|
|
$ret = getCurlOutput(getHash("08"), $postFields);
|
|
|
|
if($ret['status'] == true) {
|
|
echo "Error Report has been sent.";
|
|
} else {
|
|
echo "Unable to send error report. Please try again later.";
|
|
Scheduler::Log("Send Mail Result: {$ret['output']}, Curl error: {$ret['error']}");
|
|
}
|
|
|
|
function saveErrorInfo()
|
|
{
|
|
GLOBAL $userName, $email, $contact, $errorInfoPath, $permissionVal;
|
|
|
|
$arr = array('username' => $userName, 'email' => $email, 'number' => $contact);
|
|
$arrEncode = json_encode($arr);
|
|
file_put_contents($errorInfoPath, $arrEncode);
|
|
@chmod($errorInfoPath, $permissionVal);
|
|
}
|
|
|
|
function getSystemDetails()
|
|
{
|
|
$value = exec("uname -msr");
|
|
return $value;
|
|
}
|
|
|
|
function getDSMInfo()
|
|
{
|
|
$dsmVersionInfo = array();
|
|
$versionData = file("/etc.defaults/VERSION");
|
|
foreach($versionData as $line){
|
|
$keyValuePair = preg_split('/=/', $line);
|
|
$dsmVersionInfo[trim($keyValuePair[0])] = trim($keyValuePair[1]);
|
|
}
|
|
|
|
$dsmVersionInfo["majorversion"] =(int)trim($dsmVersionInfo["majorversion"],'"');
|
|
$dsmVersionInfo["minorversion"] =(int)trim($dsmVersionInfo["minorversion"],'"');
|
|
$dsmVersionInfo["smallfixnumber"] =(int)trim($dsmVersionInfo["smallfixnumber"],'"');
|
|
$dsmVersionInfo["buildnumber"] =(int)trim($dsmVersionInfo["buildnumber"],'"');
|
|
$machineInfo = `uname -a`;
|
|
$data = $machineInfo."DSM Version: ";
|
|
return $data.$dsmVersionInfo["majorversion"].".".$dsmVersionInfo["minorversion"].".".$dsmVersionInfo["smallfixnumber"].".".$dsmVersionInfo["buildnumber"];
|
|
}
|
|
|
|
|
|
|
|
|