HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/posscale/subdomains/ccm/includes/php/helpers.inc.php
<?

			////////////////////////////////////////////

	////////////////////////////////////////////

	// 	// HTML Objects

	//  //



	// AJAX post_hyperlink

	function ajax_href($caption, $target, $params, $result, $effect=0, $onclick='')

	{

		return '<a href="#" onclick="post(\''.$target.'\', \''.$params.'\', \''.$result.'\', '.$effect.'); '.$onclick.' return false;">'.$caption.'</a>';	

	}

	

	

	// hyperlink

	function href($caption, $href, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		

		return '<a href="'.$href.'"  '.$properties.'>'.$caption.'</a>';	

	}

	

	

	// Click to dial number hyperlink

	function o_phone($number)

	{

		if($_SESSION['user']['snomc2d'][0])

		{

			return '<a style="cursor:url(includes/images/phone.cur), crosshair;" href="#" onclick="post(\'index.php\', \'action=snom_dial&number='.$number.'\', \'hover1\', 0); return false;">'.$number.'</a>';	

		}

		else

		{

			return $number;

		}

	}

	

	// Click to email number hyperlink

	function o_email($email, $caption="")

	{

		if(empty($caption))

		{

			$caption = $email;

		}

		

		return '<a href="mailto:'.$email.'">'.$caption.'</a>';	

	}

	

	// HTML Line Breaks

	function br($count=1)

	{

		return str_repeat('<br />', $count);

	}	

	

	

	// Non Breaking Spaces

	function nbsp($count=1)

	{

		return str_repeat('&nbsp;', $count);

	}	



	

	// Heading Tags

	function heading($caption, $size=1)

	{

		return '<h'.$size.'>'.$caption.'</h'.$size.'>';

	}

	

	

	// Image Tag

	function img($image)

	{

		// if $image is an array

		if(is_array($image))

		{

			// convert the array keys=>values to html attr=>values

			foreach($image AS $attr=>$value1)

			{

				$properties .= ' '.$attr.'='.'"'.$value1.'"';

			}

			// return the image with properties

			return '<img'.$properties.'>';

		}

		else

		{

			// just return the image

			return '<img src="'.$image.'">';

		}

	}

	

	

	// Unordered List

	function ul($contents, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		// return the div and contents

		return '<ul '.$properties.'>'.$contents.'</ul>';

	}

	

	// List Item

	function li($contents, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		// return the div and contents

		return '<li '.$properties.'>'.$contents.'</li>';

	}

	

	

	// Div

	function div($contents, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		// return the div and contents

		return '<div '.$properties.'>'.$contents.'</div>';

	}

	

	

	// Table

	function table($contents, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		// return the table and contents

		return '<table '.$properties.'>'.$contents.'</table>';

	}

	

	

	// Table Cells

	function tr($data, $heading=0, $odd_options=array(), $even_options=array(), $head_options=array())

	{

		// convert the array keys=>values to html attr=>values

		foreach($odd_options AS $attr=>$value1)

		{

			$odd .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		// convert the array keys=>values to html attr=>values

		foreach($even_options AS $attr=>$value1)

		{

			$even .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		// convert the array keys=>values to html attr=>values

		foreach($head_options AS $attr=>$value1)

		{

			$head .= ' '.$attr.'='.'"'.$value1.'"';

		}



		// for each table row (t)

		for($t=0; $t<count($data); $t++)

		{

			// return the tr tag

			$return .= "<tr>";

			

			// foreach table cell (i)

			for($i=0; $i<count($data[$t]); $i++)

			{

				// check what type of heading row/column is selected

				switch($heading)

				{

					// if type 1 (headings across top row)

					case 1:

						// if dealing with the 1st row

						if($t==0)

						{

							// output heading

							$this_tag = "th";

						}

						else

						{	

							// otherwise output normal cell

							$this_tag = "td";

						}

						break;

						

					// if type 2 (headings down first column)

					case 2:

						// if dealing with the 1st column of this row

						if($i==0)

						{

							// output heading

							$this_tag = "th";

						}

						else

						{	

							// otherwise output normal cell

							$this_tag = "td";

						}

						break;

					

					// in all other cases													

					default:

						// just ouput normal cells

						$this_tag = "td";

				}

				

				// open the th/td tag

				$return .= "<".$this_tag;

				

				// if we are dealing with a td

				if($this_tag=="td")

				{

					// if row is odd

					if($t&1)

					{ 

						// output odd attributes

						$return .= $odd; 

					}

					else

					{ 

						// otherwise output even attributes

						$return .= $even; 

					}

				}

				// else, we are dealing with a th

				else

				{

					// therefore output the heading attributes

					$return .= $head;

				}

				

				// close the open tag and output the contents of the cell and close the th/td tag

				$return .= ">".$data[$t][$i]."</".$this_tag.">";

				

				// continue lopp until all cells in this row are outputed

			}

			

			// end the row and continue loop until finished

			$return .= "</tr>";

		}

		

		// return the rows		

		return $return;

	}

			////////////////////////////////////////////

	////////////////////////////////////////////

	// 	// Form Objects

	//  //

    	

	// Form

	function f_form($action, $on_submit, $contents, $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			// convert the array keys=>values to html attr=>values

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}	

		// return the table and contents

		return '<form action="'.$action.'" onSubmit="'.$on_submit.'"'.$properties.'>'.$contents.'</form>';

	}



	

	// Input Field

	function f_input($name, $value='', $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	

		return '<input type="text" value="'.$value.'" name="'.$name.'"'.$properties.'>';

	}

	

	

	

	// Password Field

	function f_password($name, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	

		return '<input type="password" name="'.$name.'"'.$properties.'>';

	}

	

	

	// Hidden Field

	function f_hidden($name, $value='', $html_attributes=array())

	{



		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}



		return '<input type="hidden" value="'.$value.'" name="'.$name.'"'.$properties.'>';

	}

	

	

	// Submit

	function f_submit($value='', $html_attributes=array())

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

	

		return '<input type="submit" value="'.$value.'"'.$properties.'>';

	}

	

	

	// Textarea

	function f_textarea($name, $value='', $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	

		return '<textarea name="'.$name.'"'.$properties.'>'.$value.'</textarea>';

	}





	// Input Field - AJAX Quick Search

	function f_quicksearch($target, $params, $result, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	//$result

		return '<input onkeyup="post(\''.$target.'\', \''.$params.'&str=\'+this.value, \''.$result.'\', 0)" type="text" value="'.$value.'"'.$properties.'>';

	}

	

	

	// Yes / No

	function f_yes_no($name, $value=0, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

		

		if($value==1){ $checked = "checked "; }else{ $checked = ""; }

		$retun .= '<label><input style="width:20px;" '.$checked.'type="radio" value="1" name="'.$name.'"'.$properties.'> Yes</label>';

		

		if($value!=1){ $checked = "checked "; }else{ $checked = ""; }

		$retun .= '<label><input style="width:20px;" '.$checked.'type="radio" value="0" name="'.$name.'"'.$properties.'> No</label>';

		

		return $retun;

	}



	

	// Auto Complete

	function f_auto_complete($name, $target, $params, $function, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	

		$return .= '<input id="'.$name.'" type="text" name="'.$name.'"'.$properties.'>';

		$return .= '<div id="'.$name.'_choices" class="autocomplete"></div>';

		$return .= '<script type="text/javascript">';

		$return .= 'new Ajax.Autocompleter(	"'.$name.'", "'.$name.'_choices", "'.$target.'", {	parameters: \''.$params.'\', paramName: "q", minChars: 1, afterUpdateElement : '.$name.'_update });';

		$return .= 'function '.$name.'_update(text, li) { '.$function.' }';

		$return .= '</script>';

		return $return;

	}

	

	

	

	// Select

	function f_select($name, $options, $value, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

		

		$return .= '<select  name="'.$name.'"'.$properties.'>';

		

		foreach($options as $key => $val)

		{

			if($value==$key){ $selected = " selected"; }else{ $selected = ""; }

			$return .= '<option'.$selected.' value="'.$key.'"'.$properties.'>'.$val.'</option>';

		}

		

		$return .= '</select>';

		

		return $return;

	}



	function f_optgroup($label, $contents)

	{

		$return  = "<optgroup label='".$label."'>";	

		$return .= $contents;	

		$return .= "</optgroup>";	

		

		return $return;

	}

	

	function f_option($caption, $value="")

	{

		return "<option value='".$value."'>".$caption."</option>";

	}

	

	

	// Date Field

	function f_date($name, $value='', $html_attributes=array(), $tooltip=FALSE)

	{

		if(empty($value))

		{

			$value = date('F j, Y');

		}

		

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

	

		$return  = '<input onclick="new CalendarDateSelect( $(this), {year_range:10,time:true} );" type="text" value="'.date('F j, Y',strtotime($value)).'" name="'.$name.'"'.$properties.'>';

  	//$return .= '<img alt="Calendar" onclick="new CalendarDateSelect( $(this).previous(), {year_range:10} );" src="includes/images/calendar.gif" style="border:0px; cursor:pointer;" />';

		

		return $return;

	}

	

	

	// Checkbox

	function f_yes_no_c($name, $caption="", $value=0, $html_attributes=array(), $tooltip=FALSE)

	{

		foreach($html_attributes AS $attr=>$value1)

		{

			$properties .= ' '.$attr.'='.'"'.$value1.'"';

		}

		

		if(is_numeric($tooltip))

		{

			$properties .= ' onfocus="tooltip('.$tooltip.');"';

		}

		

		if($value==1){ $checked = "checked "; }else{ $checked = ""; }

		$retun .= '<label><input style="width:20px;" '.$checked.'type="checkbox" value="1" name="'.$name.'"'.$properties.'>'.$caption.'"</label>';



		

		return $retun;

	}



	

	

	###########

########

# TBA

# # -yes / no-

# # select

# # radio

# # checkbox

# # -date-

# # email

# # -hidden-

# # button

# # -submit-























			////////////////////////////////////////////

	////////////////////////////////////////////

	// 	// AJAX / Javascript Helpers

	//  //

	

	// ajax sortable list

	function a_sl($output=TRUE, $post, $element, $items, $result='', $update_function="void", $edit=FALSE, $edit_result="", $delete=FALSE, $delete_result="")

	{

		if(!$output)

		{

			ob_start();

		}

		

		?>

			<ul id="<?=$element?>" style="cursor:move;">

				<?

					for($i=0; $i<count($items['id']); $i++)

					{

						?>

							<li id="item_<?=$items['id'][$i]?>" class="row<? if($i&1){ echo 1; }else{ echo 2; }?>">

								<? if($edit){ ?><a href="#" onclick="<?=$element?>_edit('<?=$items['id'][$i]?>'); return false;">E</a><? } ?>

								<? if($delete){ ?><a href="#" onclick="<?=$element?>_delete('<?=$items['id'][$i]?>', '<?=$items['caption'][$i]?>'); return false;">D</a><? } ?>

								<?=$items['caption'][$i]?>

							</li>

						<?

					}

				?>

			</ul>

			<script language="JavaScript">

			<!--

				Sortable.create('<?=$element?>',

				{

					onUpdate:function() 

					{

						new Ajax.Updater('<?=$result?>', '<?=$post?>', 

						{

							onComplete:function(request) 

							{

								new Effect.Shake('<?=$element?>',{});

							},

							parameters:Sortable.serialize('<?=$element?>')+'&action=us_<?=$update_function?>',

							evalScripts:true,

							asynchronous:true

						})

					}

				})

				<? 

					if($edit)

					{ 

						?>				

							function <?=$element?>_edit(id)

							{

								new Ajax.Updater('<?=$edit_result?>', '<?=$post?>', 

								{

									onComplete:function(request) 

									{

										new Effect.Shake('<?=$edit_result?>',{});

									},

									parameters:'id=' + id + '&action=e_<?=$update_function?>',

									evalScripts:true,

									asynchronous:true

								})

							}

						<?

					}

					if($delete)

					{ 

						?>				

							function <?=$element?>_delete(id, name)

							{

								if(confirm("Do you really wish to delete '" + name + "'?"))

								{

									new Ajax.Updater('<?=$delete_result?>', '<?=$post?>', 

									{

										onComplete:function(request) 

										{

											new Effect.Shake('<?=$delete_result?>',{});

										},

										parameters:'id=' + id + '&action=d_<?=$update_function?>',

										evalScripts:true,

										asynchronous:true

									})

									$('item_' + id).remove();

								}

							}

						<?

					}

				?>

			//-->	

			</script>

		<?

	

		if(!$output)

		{

			$return = ob_get_contents();

			ob_end_clean();

			return $return;

		}		

		else

		{

			return TRUE;

		}

	}

?>