예제 #1
0
파일: debug_lib.php 프로젝트: caseyi/BLIS
 public static function isOldIe()
 {
     $browser_info = DebugLib::browserInfo();
     if (key($browser_info) == 'msie' && $browser_info[key($browser_info)] != '8.0') {
         return true;
     }
     return false;
 }
예제 #2
0
function query_blind($query)
{
    global $con;
    $result = mysql_query($query, $con);
    //if($LOG_QUERIES == true)
    DebugLib::logQuery($query, db_get_current(), $_SESSION['username']);
    DebugLib::logDBUpdates($query, db_get_current());
    return $result;
}
예제 #3
0
	public function getDatePicker($name_list, $id_list, $value_list, $show_format=true, $lab_config=null)
	{
		# Returns a date picker element based on passed parameters
		# Element ID ise determined using random number generator
		$date_format = "";
		$date_format_js = "";
		$start_date = "";
		if($lab_config == null)
		{
			# Logged in as technician: Use session variable to fetch format
			$date_format = $_SESSION['dformat'];
		}
		else
		{
			# Logged in as admin
			$date_format = $lab_config->dateFormat;
		}
		$order_list = array(0, 1, 2); # Y-m-d
		switch($date_format)
		{
			case "d-m-Y":
				$order_list[0] = 2;
				$order_list[1] = 1;
				$order_list[2] = 0;
				$date_format_js = "dd-mm-yyyy";
				$start_date = "01-01-1950";
				break;
			case "m-d-Y":
				$order_list[0] = 1;
				$order_list[1] = 2;
				$order_list[2] = 0;
				$date_format_js = "mm-dd-yyyy";
				$start_date = "01-01-1950";
				break;
			case "Y-m-d":
				$order_list[0] = 0;
				$order_list[1] = 1;
				$order_list[2] = 2;
				$date_format_js = "yyyy-mm-dd";
				$start_date = "1950-01-01";
				break;			
		}
		$date_format_js_parts = explode("-", $date_format_js);
		$picker_id = rand();
		if(DebugLib::isOldIe() === true || strpos($_SERVER['PHP_SELF'], "reports_tat.php") !== false)
		{
			# Show only date fields and not datepicker
			?>
			<input type='text' name='<?php echo $name_list[$order_list[0]]; ?>' id='<?php echo $id_list[$order_list[0]]; ?>' value="<?php echo $value_list[$order_list[0]]; ?>" size='4' maxlength='4' />-
			<input type='text' name='<?php echo $name_list[$order_list[1]]; ?>' id='<?php echo $id_list[$order_list[1]]; ?>' value="<?php echo $value_list[$order_list[1]]; ?>" size='4' maxlength='4' />-
			<input type='text' name='<?php echo $name_list[$order_list[2]]; ?>' id='<?php echo $id_list[$order_list[2]]; ?>' value="<?php echo $value_list[$order_list[2]]; ?>" size='4' maxlength='4' />
			<?php
			if($show_format == true)
			{
			?>
				<br>
				<small><sup>
				&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[0]; ?>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[1]; ?>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[2]; ?>)
				</sup></small>
			<?php
			}
			return;
		}
		?>
		<SCRIPT type="text/javascript" charset="utf-8">
		Date.format = '<?php echo $date_format_js; ?>';
		$(function()
		{
			$('#<?php echo $picker_id; ?>').datePicker({startDate:'<?php echo $start_date; ?>'});
		});

		$(function()
		{
			$('#<?php echo $picker_id; ?>')
				.datePicker({createButton:false})
				.bind(
					'click',
					function()
					{
						$(this).dpDisplay();
						this.blur();
						return false;
					}
				)
				.bind(
					'dateSelected',
					function(e, selectedDate, $td)
					{
						var date_selected = $('#<?php echo $picker_id; ?>').val();
						var date_parts = date_selected.split('-');
						$('#<?php echo $id_list[$order_list[0]]; ?>').attr("value", date_parts[0]);
						$('#<?php echo $id_list[$order_list[1]]; ?>').attr("value", date_parts[1]);
						$('#<?php echo $id_list[$order_list[2]]; ?>').attr("value", date_parts[2]);
					}
				);
		});
		
		</SCRIPT>
				
		<style type='text/css'>
		a.dp-choose-date {
			float: left;
			width: 16px;
			height: 16px;
			padding: 0;
			margin: 5px 3px 0;
			display: block;
			text-indent: -2000px;
			overflow: hidden;
			background: url('includes/img/calendar_icon.gif') no-repeat; 
		}
		a.dp-choose-date.dp-disabled {
			background-position: 0 -20px;
			cursor: default;
		}
		/* makes the input field shorter once the date picker code
		* has run (to allow space for the calendar icon
		*/
		input.dp-applied {
			width: 140px;
			float: right;
		}
		</style>
		
		<input type='text' name='<?php echo $name_list[$order_list[0]]; ?>' id='<?php echo $id_list[$order_list[0]]; ?>' value="<?php echo $value_list[$order_list[0]]; ?>" size='4' maxlength='4' />-
		<input type='text' name='<?php echo $name_list[$order_list[1]]; ?>' id='<?php echo $id_list[$order_list[1]]; ?>' value="<?php echo $value_list[$order_list[1]]; ?>" size='4'  maxlength='4' />-
		<input type='text' name='<?php echo $name_list[$order_list[2]]; ?>' id='<?php echo $id_list[$order_list[2]]; ?>' value="<?php echo $value_list[$order_list[2]]; ?>" size='4'  maxlength='4' />
		
		<INPUT name="<?php echo $picker_id; ?>" id="<?php echo $picker_id; ?>" class="date-pick dp-applied" style='display:none'/>
		
		<?php
		if($show_format == true)
		{
		?>
			<br>
			<small><sup>
			&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[0]; ?>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[1]; ?>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;(<?php echo $date_format_js_parts[2]; ?>)
			</sup></small>
		<?php
		}
		?>
		
	<?php
	}
예제 #4
0
파일: db_lib.php 프로젝트: nchopra/C4G-BLIS
 public static function switchRestore($db_name)
 {
     # Reverts back to saved DB instance
     global $DEBUG;
     if ($DEBUG) {
         echo "In switchRestore({$db_name})<br>";
         echo DebugLib::getCallerFunctionName(debug_backtrace()) . "<br>";
     }
     db_change($db_name);
 }
예제 #5
0
#    program; if not, write to:                                                              #
#                                                                                            #
#                        Free Software Foundation, Inc.,                                     #
#                        59 Temple Place, Suite 330,                                         #
#                        Boston, MA 02111-1307 USA                                           #
##############################################################################################
//TODO main.php- template this first ..
include_once "includes/timer.class.php";
$BenchmarkTimer = new c_Timer();
$BenchmarkTimer->start();
// Start benchmarking immediately
//Now, include the configuration.
require_once "library.php";
if ($debug === true) {
    include_once "includes/benchmark.class.php";
    $benchmark = new DebugLib();
    $benchmark->scratch_dir = $scratch_dir;
}
if ($debug) {
    $benchmark->memory_checkpoint(__LINE__, __FILE__);
}
include_once 'includes/mysql.class.php';
$db = new DbMysql();
//instantiate the database object
$db->connect($db_server, $db_user, $db_pass, $db_name, $db_persistent);
$db->prefix = $prefix;
if ($debug) {
    $benchmark->memory_checkpoint(__LINE__, __FILE__);
}
#  Include Configs & Variables
#################################################################################################