Esempio n. 1
0
    $use_store_id = 0;
    if ($_SESSION['store_id'] == 0 && $_SESSION['selected_store_id'] > 0) {
        $use_store_id = $_SESSION['selected_store_id'];
    } elseif ($_SESSION['store_id'] > 0) {
        $use_store_id = $_SESSION['store_id'];
    }
    if (move_uploaded_file($_FILES['upl_' . $upcounter]['tmp_name'], $move_destination)) {
        if ((substr_count($finfo['extension'], "pdf") > 0 || substr_count($finfo['extension'], "PDF") > 0) && $public == 1) {
            $move_destination_png = $move_destination;
            $move_destination_png = str_replace(".pdf", ".png", $move_destination_png);
            $move_destination_png = str_replace(".PDF", ".png", $move_destination_png);
            $imagick = new Imagick();
            $imagick->setResolution(300, 300);
            $imagick->readImage($move_destination);
            $imagick->setImageFormat("png");
            $imagick->writeImage($move_destination_png);
            $new_filename = $move_destination_png;
        }
        $sql = "\n\t\t\tinsert into attached_files\n\t\t\t\t(xref_id,\n\t\t\t\tfilename,\n\t\t\t\tfilesize,\n\t\t\t\tlinedate_added,\n\t\t\t\tsection_id,\n\t\t\t\taccess_level,\n\t\t\t\tdeleted,\n\t\t\t\tuser_id,\n\t\t\t\tmerchant_id,\n\t\t\t\tstore_id,\n\t\t\t\tpublic_name,\n\t\t\t\tpublic_flag)\n\t\t\t\t\n\t\t\tvalues ('" . sql_friendly($_SESSION['upload_params'][$upcounter]['xref_id']) . "',\n\t\t\t\t'" . sql_friendly($new_filename) . "',\n\t\t\t\t0,\n\t\t\t\tnow(),\n\t\t\t\t'" . sql_friendly($_SESSION['upload_params'][$upcounter]['section_id']) . "',\n\t\t\t\t'" . sql_friendly($_SESSION['access_level']) . "',\n\t\t\t\t0,\n\t\t\t\t'" . sql_friendly($_SESSION['user_id']) . "',\n\t\t\t\t'" . sql_friendly($use_merchant_id) . "',\n\t\t\t\t'" . sql_friendly($use_store_id) . "',\n\t\t\t\t'" . sql_friendly(get_filename_without_unique($new_filename)) . "',\n\t\t\t\t'" . sql_friendly($public) . "')\n\t\t";
        simple_query($sql);
        $rslt['status_code'] = 1;
        $rslt['msg'] = 'success!';
        $rslt['filename_new'] = $new_filename;
        $rslt['filename_original'] = $_FILES['upl_' . $upcounter]['name'];
        $rslt['extra_params'] = $_SESSION['upload_params'][$upcounter]['extra_params'];
        return_result($rslt);
    }
}
$rslt['status_code'] = 0;
$rslt['msg'] = 'No files found.';
return_result($rslt);
Esempio n. 2
0
<? include('application.php'); ?>
<?

?>
<? include('header.php'); ?>
<?
	$fname = "CCE_WebappWireframe_Home (1)-552fd77c43c7b.png";
	echo get_filename_without_unique($fname);
	die;
	/*
	This is screen is missing some functionality (similar to Compliance Officer screen). The view for a single Store Location should look like this:
	https://docs.google.com/drawings/d/1461THo9KDIj7jK52mScuhWIo2Ra3FJ4ufUg0TCIJLnU/edit?usp=sharing. 
	The view for a Merchant with multiple Store Locations should like this:  
	https://docs.google.com/drawings/d/1fXCNQ5bWF-tanc0Ng8-J4FiF_kf04iBwt5243tNZcY0/edit?usp=sharing. 
	And clicking on one of the locations should look like this: 
	https://docs.google.com/drawings/d/1tSVhmBD7tjMj-qDIITMTFww02vZhNEkkJtWFisHEAnk/edit?usp=sharing or look the same as the single Store Location.
	*/
	
	$test_user="******";
	$test_pass="";
	
 	echo "(".$test_user." : ".$test_pass.") Decoder Ring=<b>'".mrr_encryptor($test_pass,$test_user)."'</b>";
?>		
<script>
	$().ready(function() {
		
		$( ".tooltip" ).tooltip();
		$( ".accordion" ).accordion();
		$('input[type=button]').button();
	});
	
Esempio n. 3
0
	function load_waiting_files() 
	{			
		$mrr_adder="";
		$allow_all=0;
		
		//find merchant template first...acts as a default.
     	if($_SESSION['merchant_id'] == 0 && $_SESSION['selected_merchant_id'] > 0)
     	{
     		$mrr_adder.=" and attached_files.merchant_id='".sql_friendly($_SESSION['selected_merchant_id'])."'";
     	}
     	elseif($_SESSION['merchant_id'] > 0)
     	{
     		$mrr_adder.=" and attached_files.merchant_id='".sql_friendly($_SESSION['merchant_id'])."'";
     	}
     	
     	if($_SESSION['access_level']>=80)		$allow_all=1;
     	
     	//find store template next...override merchant if set.
     	if($_SESSION['store_id'] == 0 && $_SESSION['selected_store_id'] > 0)
     	{
     		$mrr_adder.=" and attached_files.store_id='".sql_friendly($_SESSION['selected_store_id'])."'";
     	}     	
     	elseif($_SESSION['store_id'] > 0)
     	{
     		$mrr_adder.=" and attached_files.store_id='".sql_friendly($_SESSION['store_id'])."'";
     	}
		
		
		$rval="";
		$tab="";
		
		$tab.="
		<div class='mrr_sector_container'>
			<table cellpadding='0' cellspacing='0' border='0' style='width:100%'>
			
			<tbody>
		";			//<th valign='top'><b>Expire</b></th>
		/* 	width='100%'
			
			<thead>
			<tr>
					<th valign='top'><b>File<b></th>
					<th valign='top'><b>Processing</b></th>
					<th valign='top'><b>Display Date</b></th>					
					<th valign='top'><b>Public Name</b></th>
					<th valign='top'><b>Access Level</b></th>
					<th valign='top'><b>For Customer</b></th>
					<th valign='top'><b>For Store</b></th>
					<th valign='top'><b>For User</b></th>
					<th valign='top'><b>&nbsp;</b></td>
			</tr>
			</thead>
		*/
		
		$sql = "
			select *			
			from attached_files
			where deleted = 0
				and section_id = '".sql_friendly(SECTION_WAITING)."'				
				and access_level<='".sql_friendly($_SESSION['access_level'])."'
				".($_SESSION['access_level'] < 60 ? " and xref_id = '".sql_friendly($_SESSION['user_id'])."'" : "")."
				".$mrr_adder."
				and processed_flag=0
			order by id asc
		";
		$data = simple_query($sql);
		$cntr=0;	
		
		$closer="";
		//if(mysqli_num_rows($data) == 1)		$closer="  dialog.dialog(\"close\");";
		
		while($row = mysqli_fetch_array($data)) 
		{
			
			$rval .= "
				<FileEntry>
					<File><![CDATA[".$row['filename']."]]></File>
					<DateAdded><![CDATA[".date("m/d/Y h:i a", strtotime($row['linedate_added']))."]]></DateAdded>
				</FileEntry>
			";
			
			
			$date2="";		if($row['linedate_display_start'] !="0000-00-00 00:00:00")		$date2="".date("m/d/Y", strtotime($row['linedate_display_start']))."";
			//$date3="";		if($row['linedate_display_end'] !="0000-00-00 00:00:00")		$date3="".date("m/d/Y", strtotime($row['linedate_display_end']))."";
			
			//if($date2=="")		$date2=date("m/d/Y",time());
					
			$selbx1=get_access_select_box($_SESSION['access_level'],  "file_".$row['id']."_access_level",  $row['access_level'], 0, "", "");
			$selbx2=get_user_select_box("file_".$row['id']."_user_id",  $row['xref_id'], 0, "", "");
			$selbx3=get_merchant_select_box("file_".$row['id']."_merchant_id",  $row['merchant_id'], 0, "All", " file_id='$row[id]' class='file_merchant_selector'",$allow_all);
			$selbx4=get_store_select_box("file_".$row['id']."_store_id",  $row['store_id'], $row['merchant_id'], 0, "All", " file_id='$row[id]' class='file_store_selector'",$row['merchant_id']);
			
			
			$prime_item=$row['template_item_id'];			
			$sub_item=$row['template_item_id_sub'];
			$group_id=$prime_item;
			
			if($sub_item==0 && $prime_item > 0)
			{
				$group_id=get_template_item_sub_id_from_item($prime_item);
				if($group_id > 0)	
				{
					$prime_item=$group_id;
					$sub_item=$row['template_item_id'];
					
					//update the system to store the group id and the sub id separately....					
					$sqlu = "
						update attached_files set 
							template_item_id='".sql_friendly($group_id)."',
							template_item_id_sub='".sql_friendly($sub_item)."'
						where id='".sql_friendly($row['id'])."'
					";
					simple_query($sqlu);
				}
			}
						
			$selbx5=get_template_item_select_box("file_".$row['id']."_template_id", $prime_item,$row['store_id'], $row['merchant_id'], 0, "", " file_id='$row[id]' class='file_template_selector'",0,0);
			$selbx6=get_template_item_select_box("file_".$row['id']."_sub_id", $sub_item, $row['store_id'], $row['merchant_id'], 0, "", " file_id='$row[id]' class='file_template_sub_selector'",$group_id,1);	// onChange='update_mrr_selectors(4);'
					
			
			$test_file=strtolower($row['filename']);
			
			$preview="".$row['filename']."";
			
			if($row['public_flag'] > 0) 
			{
				$preview="<a href='/documents/".$row['filename']."' target='_blank' >".$row['filename']."</a>";
			}
			else
			{
				$preview="<a href='javascript:void(0);' onClick='view_attached_file(".$row['section_id'].",".$row['xref_id'].",".$row['id'].");'>".$row['filename']."</a>";
			}
					
			
			if(trim($row['public_name'])=="")		$row['public_name']="".trim(get_filename_without_unique($row['filename']))."";
					
			$tab.="
				<tr class='".($cntr%2==0 ? "even" : "odd")." waiting_list' id='attachment_row_".$row['id']."'>					
					<td valign='top' style='width:410px;'>
						<div class='mrr_v_spacer'>
							<div class='mrr_v_spacer_label1'>Filename:</div>
							".$preview."
						</div>
						<div class='mrr_v_spacer'>
							<div class='mrr_v_spacer_label1'>Upload Date:</div>
							".date("n/j/Y h:i a", strtotime($row['linedate_added']))."
						</div>

						<div class='mrr_v_spacer'>
							<div class='mrr_v_spacer_label1'>Document Date:</div>
							<input name='file_".$row['id']."_display_date' id='file_".$row['id']."_display_date' value='".$date2."' class='linedate short100' onChange='mrr_update_waiting_file(".$row['id'].",0);'>
						</div>
						<div class='mrr_v_spacer'>
							<div class='mrr_v_spacer_label1'>Document Name:</div>
							<input name='file_".$row['id']."_public_name' id='file_".$row['id']."_public_name' value=\"".$row['public_name']."\" class='tooltipx large' onChange='mrr_update_waiting_file(".$row['id'].",0);' title='This is a friendly name like \"My TXT Document\" or \"Compliance Letter\"'>
						</div>
					</td>
					<td valign='top' style='width:300px;' nowrap>
						
						<div class='mrr_v_spacer'><div class='mrr_v_spacer_label'>Customer:</div> ".$selbx3."</div>
						<div class='mrr_v_spacer'><div class='mrr_v_spacer_label'>Store:</div> ".$selbx4."</div>				
						<div class='mrr_v_spacer'><div class='mrr_v_spacer_label'>Document Type:</div> ".$selbx5."</div>
						<div class='mrr_v_spacer'><div class='mrr_v_spacer_label'>Doc. Sub-Type:</div> ".$selbx6."</div>
						<div class='mrr_v_spacer' style='text-align:right;'>
							<label for='file_".$row['id']."_processed' class='tooltip' title='To Remove File from waiting list, check the box.  This will not delete the file.'></label>
							<input type='button' class='buttonize btn btn-default add_new_btn' value='Delete' onClick='mrr_delete_waiting_file(".$row['id'].",1);".$closer."'>
							<input type='button' class='buttonize btn btn-default add_new_btn' value='Save' onClick='mrr_update_waiting_file(".$row['id'].",1);".$closer."'>
						</div>
					</td>
				</tr>

			";		
			$cntr++;
		}
		$tab.="</tbody>
		</table>
		<div id='dialog_delete_file' title='Remove this File?' style='display:none;'>
          	<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 20px 0;'></span>This File will be permanently removed and cannot be recovered without reloading the file. Are you sure you want to delete it?</p>
          </div>
                   
		</div>";		
		
		if($cntr==0)		$tab="<b>No files are waiting to be processed at this time. Please check back later.</b>";
		
		$tab.="<input type='hidden' name='tot_files_waiting' id='tot_files_waiting' value='".$cntr."'><input type='hidden' name='tot_files_processed' id='tot_files_processed' value='0'>";
		
		display_xml_response("<rslt>1</rslt>$rval<mrrTab><![CDATA[".$tab."]]></mrrTab>");
	}