function nxfile_testuser($username, $password) { global $_TABLES; if (DB_getItem($_TABLES['users'], 'uid', "username='******' AND passwd='{$password}'") > 0) { return true; } else { return false; } } switch ($op) { case 'testconnection': header("Cache-Control: no-store, no-cache, must-revalidate"); header("content-type: application/xml"); echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; echo "<data>"; if (nxfile_testuser($username, $password)) { echo "<status>success</status>"; echo "<statusid>1</statusid>"; } else { echo "<status>fail</status>"; echo "<statusid>0</statusid>"; } echo "</data>"; break; default: if (nxfile_testuser($username, $password)) { com_errorlog(nxfile_uploadFile($_FILES['file'], $username, $password)); //fetch the file } break; }
} else { $error = 'There is an error in your timesheet - ensure all numeric fields are filled with numeric data!...'; $output = ''; } break; case 'saveapprovaltimesheet': $maxRowNumber = COM_applyFilter($_POST['max_row_number'], true); $approvalUID = COM_applyFilter($_POST['approved_by'], true); $forWhichUID = COM_applyFilter($_POST['emp'], true); $ts = new nexTime(); for ($cntr = 0; $cntr < $maxRowNumber; $cntr++) { //pick off the approval $chk = COM_applyFilter($_POST['chkapproval' . $cntr], true); $rejectchk = COM_applyFilter($_POST['chkreject' . $cntr], true); $id = COM_applyFilter($_POST['id' . $cntr], true); com_errorlog("id: {$id}, chk: {$chk}"); if ($rejectchk == 0) { if ($chk == 0) { $ret = $ts->unApproveSingleItem($id); } else { $ret = $ts->approveSingleItem($id); } } } if ($ret) { $error = 'Successfully saved your timesheet... '; if ($forWhichUID == 0 || $forWhichUID == $_USER['uid']) { $output = generateTimesheet(); } else { $output = generateTimesheet($forWhichUID, false, true, $forWhichUID); }
$endStamp = strtotime($end_date); } $numberOfDays = intval(($endStamp - $startStamp) / 60 / 60 / 24) + 1; switch ($op) { case 'byemployee': include 'reports/byEmployee.php'; $objWriter = new $CONF_NEXTIME['report_output_format']($objPHPExcel); $reportname = date('Y-m-d H.i') . ' By Employee Report.' . $CONF_NEXTIME['report_extension']; $url = $CONF_NEXTIME['base_path'] . 'reports/output/' . $reportname; $objWriter->save($CONF_NEXTIME['path_to_reports'] . $reportname); $output = "<a href='{$url}' target='_new' onclick='closeByEmployeePanel();'>Click here to view the report</a>"; $error = ""; break; case 'bytask': $nexlistID = COM_applyFilter($_REQUEST['whichtask'], true); com_errorlog($nexlistID); $task = COM_applyFilter($_REQUEST['taskname'], false); include 'reports/byTask.php'; $objWriter = new $CONF_NEXTIME['report_output_format']($objPHPExcel); $reportname = date('Y-m-d H.i') . ' By Task Report.' . $CONF_NEXTIME['report_extension']; $url = $CONF_NEXTIME['base_path'] . 'reports/output/' . $reportname; $objWriter->save($CONF_NEXTIME['path_to_reports'] . $reportname); $output = "<a href='{$url}' target='_new' onclick='closeByTaskPanel();'>Click here to view the report</a>"; $error = ""; break; case 'byproject': $nexlistID = COM_applyFilter($_REQUEST['whichproject'], true); $task = COM_applyFilter($_REQUEST['projectname'], false); include 'reports/byProject.php'; $objWriter = new $CONF_NEXTIME['report_output_format']($objPHPExcel); $reportname = date('Y-m-d H.i') . ' By Project Report.' . $CONF_NEXTIME['report_extension'];