⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 event_handler.class.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 2 页
字号:
{	if($loc_query == 'from_db') //set/get markers fom db	{		$data = $GLOBALS['db']->Execute("SELECT DISTINCT * " .				"FROM ".PREFIX."maps_plugin");		while($markers = $data->fetchRow(ADODB_FETCH_ASSOC))		{		$reset = false;  			/**			 * take care of deleted images, just do not show up a broken			 * image and reset also albid and stage to defaults.			 * sure we could also let this check by db_api, but it's too much 			 * overhead IMHO			 */			$query = $GLOBALS['db']->Execute("SELECT id FROM ".PREFIX."photos " .					"WHERE id = ".$markers['imgid']."" );				if($query->EOF)				{					$reset = $GLOBALS['db']->Execute("UPDATE ".PREFIX."maps_plugin " .						"SET imgid='0', " .						"albid='0', " .						"stage='0' " .						"WHERE imgid=".$markers['imgid']."");					$reset = true;					}									/**			 * allow delete of Markers by admin users			 */			if(in_group("admin"))			{				$add = '[<a href='.TOP_DIR.'/maps_view.php?job=asignalb&id='.$markers['id'].'>'.$this->map_album_add.'</a>]';								$delete = '[<a href='.TOP_DIR.'/plugins/maps/db_handler.php?job=del&id='.$markers['id'].'>'.$this->map_marker_del.'</a>]';							}			else			{				$add = "";				$delete = "";			}			 					if(!empty($markers['imgid']) && !$reset == true)			{					$location = new Location($markers['lat'], $markers['lon'], 			'<div class="someCssClass">' .			'<a href='.TOP_DIR.'/viewer.php?albid='.$markers['albid'].'&stage='.$markers['stage'].' target="_self">' .			'<img src='.TOP_DIR.'/get_thumbs.php?id='.$markers['imgid'].'></img></a><br>' .			'City: '.$markers['city'].'<br>' .			'Street: '.$markers['street'].'<br>' .			'State: '.$markers['state'].'<br>' .			'Country: '.$markers['country'].'<br>' .			''.$delete.' </div>');			}			else			{			$location = new Location($markers['lat'], $markers['lon'], 			'<div class="someCssClass">' .			'City: '.$markers['city'].'<br>' .			'Street: '.$markers['street'].'<br>' .						'State: '.$markers['state'].'<br>' .			'Country: '.$markers['country'].'<br>' .			''.$add.'<br>' .			''.$delete.' </div>');			}				$this->cmap->addLocation($location);		}	}	elseif($loc_query == 'from_query')// set marker from location search	{				/**		 * prefer Google geocode over yahoo if key google is set		 */		if(strlen(read_config('maps_google_key')) > 35)		{			list($lat, $lon, $zip, $city, $street, $state, $country) = 			GeoCode::getLatLonByLocationGoogle($location);		}		else		{			list($lat, $lon, $zip, $city, $street, $state, $country) = 			GeoCode::getLatLonByLocationYahoo($location);		}		$location = new Location($lat, $lon, '<p class="someCssClass">' .				'City: '.$city.'<br>' .				'State: '.$state.'<br>' .				'Country: '.$country.'</p>');		$this->cmap->addLocation($location);	}	else	{		echo "Unknown loc_query received";	}		if($action == "search") //search location request	{				echo "<hr width='90%' noshade>" .		"<form name='maps_search' method='POST' action='maps_view.php'>" .		"<table class='admintable' width='90%' cellspacing='0'>" .		"<tr><td class='maintable'>".$this->map_search_location."</td>" .		"<td class='maintable'>" .			"<input type='text' name='location' align='right' style='width: 300px;' value='".$this->map_location_here."')'>" .			"<td class='maintable' align='center'>" .			"<input type='hidden' name='action' value='edit'>" .			"<input type='hidden' name='loc_query' value='from_query'>" .			"<input type='submit' value='".$this->map_search_loc_button."'>" .		"</table>" .		"</form>";	}	elseif($action == "edit")	{		echo "<hr width='90%' noshade>" .		"<form name='maps_edit' method='POST' action='plugins/maps/db_handler.php'>" .		"<table class='admintable' width='90%' cellspacing='0'>" .		"<tr><td class='maintable'>Latitude<br />" .			"<input type='text' name='lat' align='right' style='width: 70px;' value='".$lat."')'>" .			"<td class='maintable'>Longitude<br />" .			"<input type='text' name='lon' align='right' style='width: 70px;' value='".$lon."')'>" .			"<td class='maintable'>Country<br />" .			"<input type='text' name='country' align='right' style='width: 110px;' value='".$country."')'>" .			"<td class='maintable'>State<br />" .			"<input type='text' name='street' align='right' style='width: 110px;' value='".$street."')'>" .			"<td class='maintable'>Street<br />" .			"<input type='text' name='state' align='right' style='width: 110px;' value='".$state."')'>" .			"<td class='maintable'>Zip<br />" .			"<input type='text' name='zip' align='right' style='width: 40px;' value='".$zip."')'>" .			"<td class='maintable'>City<br />" .			"<input type='text' name='city' align='right' style='width: 90px;' value='".$city."')'>" .			"<td class='maintable' align='center'>";			if(check_permissions('maps'))			{				echo "<input type='hidden' name='action' value='save_location'>".					"<input type='submit' value='".$this->map_add_location."'>";			}		echo "</table></form>";						echo "<a href='maps_view.php'><b>".$this->map_new_search."</b></a>";	}}/** * Init main Yahoo map. All default setting need to be changed here, like * display type, zoom, cart type and others *  * @param none * @return none */function drawNewMap(){	$this->cmap->setContainer(read_config('maps_type')."Map");	$this->cmap->setMapType(strtoupper(read_config('maps_type'))."_MAP"); 	$this->cmap->setDisplayType($this->getDisplayType()); 	if(read_config('maps_type') == 'yahoo')	{		$this->cmap->setKey(read_config('maps_yahoo_id'));		$this->cmap->setZoom(read_config('maps_default_zoom')); 	}	else	{		$this->cmap->setKey(read_config('maps_google_key')); 	}	$this->cmap->drawMap();	}/*** This method is used to format a new config line (HTML) with text field * as input** @param string $string1, short description of option* @param string $textfield_name, name of option in db (linpha_config)* @param string $textfield_value, value of option to show (read from config) * @param string $string2, long description of option* @param string $helplink, name of href to help page* @param int $tfwidth, width of textfield in px (default 100px)* @return string HTML textfield line*/function print_textfield($string1,$textfield_name,$textfield_value,$string2,$helplink,$tfwidth){	echo "<tr>".			"<td class='admintable' width='*'>".$string1."</td>".			"<td class='admintable' width='150' style='padding: 1px;'>" .			"&nbsp;<input type='text' name='".$textfield_name."' style='width: ".$tfwidth.";' align='right' maxlength=100 value='".htmlspecialchars($textfield_value,ENT_QUOTES)."'></td>".			"<td class='admintable' width='*' align='right'>".$string2."</td>".			"<td class='admintable' width='20' align='center' width='20'>";	putHelpButton($helplink);	echo "</td></tr>";}function addAlbum2Location($albid, $stage){	/**	 * get required image id, this is somewhat tricky as viewer.php does 	 * not know about an imgid when showing album folders	 */	$stage = get_stage(); 	$query = $GLOBALS['db']->Execute("SELECT path, name " .			"FROM ".PREFIX.$stage."_lev_album " .			"WHERE id='".linpha_addslashes($albid)."'");	$album_info = $query->FetchRow(ADODB_FETCH_ASSOC);	$prev_path = $album_info['path'];	$album_name = $album_info['name'];		$query = $GLOBALS['db']->Execute("SELECT id FROM ".PREFIX."photos ".			"WHERE prev_path = '".linpha_addslashes($prev_path)."'");	$imgid = $query->FetchRow(ADODB_FETCH_ASSOC);		echo "<h1>".$this->map_assign_album."</h1><hr>" .		"<table class='admintable'><tr><td class='admintable' align='center'>" .		"<span>$album_name</span><br /><br />" .				"&nbsp;&nbsp;&nbsp;&nbsp;" .		"<img src=".TOP_DIR.'/get_thumbs.php?id='.$imgid['0'].''." ></img>" .		"&nbsp;&nbsp;&nbsp;&nbsp;" .		"</td><td class='admintable' align='center'>";	/**	 * show up existing locations	 */	$data = $GLOBALS['db']->Execute("SELECT DISTINCT * " .				"FROM ".PREFIX."maps_plugin " .				"ORDER BY country ASC");	while($markers = $data->fetchRow(ADODB_FETCH_ASSOC))	{		$locations[$markers['id']] = $markers['country']."-".$markers['state']."-".$markers['zip']."-".$markers['city']."-".$markers['id']; 	}	echo "<form name='location' action=".TOP_DIR.'/plugins/maps/db_handler.php'." method='GET'>"; 		form_generate_select("location", "10", "style='width: 400px'","", $locations, "", "300");			echo "<input type='hidden' name='job' value='add'>" .		 	"<input type='hidden' name='albid' value=".$albid.">" .			"<input type='hidden' name='imgid' value=".$imgid['0'].">" .			"<input type='hidden' name='stage' value=".$stage.">" .		"<br /><br /><input type='submit' value='".$this->map_assign_album."'>" .		"</form></td></tr>" .		"<tr><td colspan='3' class='admintable'>" .		"<a href=".TOP_DIR.'/maps_view.php'.">".$this->map_add_location."</a>" . 		"</td></tr></table>";}function addLocation2Album($id){	echo "<h1>".$this->map_assign_album."</h1><hr>" .		"<table class='admintable'><tr> ".		"<td class='admintable' align='center'>";		/**		 * show up existing albums	 	*/	echo "<form name='alb_location' action=".TOP_DIR.'/plugins/maps/db_handler.php'." method='POST'>"; 		build_album_select($with_all_albs_entry = false);	echo "<input type='hidden' name='job' value='loc2alb'>" .		"<input type='hidden' name='id' value=".$id.">" .			"<br /><br /><input type='submit' value='Assign Album'>" .		"</form></td></tr>" .		"</table>";}/** * HYBRID_MAP = 1 * SATELLITE_MAP = 2 * CART_MAP = 3  *   */function getDisplayType(){	$dis_type = read_config('maps_display_type'); // SAT,HYBRID or CART Map	$maps_type = read_config('maps_type'); // Google or Yahoo Map		if($maps_type == "google")	{		switch($dis_type)		{			case '1': $this->display_type = "G_HYBRID_TYPE";break;			case '2': $this->display_type = "G_SATELLITE_TYPE";break;			case '3': $this->display_type = "G_MAP_TYPE";break;		}	}	else	{		switch($dis_type)		{			case '1': $this->display_type = "YAHOO_MAP_HYB";break;			case '2': $this->display_type = "YAHOO_MAP_SAT";break;			case '3': $this->display_type = "YAHOO_MAP_REG";break;		}	}return $this->display_type;	}}//end class?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -