<?php
if($_REQUEST['clg']=='get_user_options'){
	$sql="SELECT id,first_name,last_name FROM users WHERE deleted=0";
	$result=outright_run_sql($sql);
	$options="<option></option>";
	foreach($result as $res){
		$options.="<option value='".$res['id']."'>".$res['first_name']." ".$res['last_name']."</option>";
	}
	echo $options;
}

if($_REQUEST['clg']=='get_suitecrm_log_file_data'){
	//~ echo $_REQUEST['lines'];
	
	$file = file("suitecrm.log");
for ($i = max(0, count($file)-$_REQUEST['lines']); $i < count($file); $i++) {
  echo $file[$i] . "\n";
}
}


if($_REQUEST['clg']=='check_new_log'){
	$sql="SELECT id FROM outr_global_logger WHERE deleted=0 AND reload_log='unseen'";
    $result=outright_run_sql_one_row($sql);
    if(empty($result)){
		$msg="no";
	}else{
		$sql2 =" UPDATE  outr_global_logger SET reload_log='seen' WHERE deleted=0 AND reload_log='unseen'";
		outright_run_sql($sql2);
		$msg="yes";
	}
	
	echo $msg;
}
