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

📄 event_handler.class.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/** Copyright (c) 2004 Heiko Rutenbeck <bzrudi@tuxpower.de>** This program is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or*  (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* GNU General Public License for more details.** You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/if(!defined('TOP_DIR')) { define('TOP_DIR','../..'); }include_once(TOP_DIR.'/plugins/maps/map.main.class.php');/** * This class take care of all possible operations in the maps plugin. *  * @author bzrudi */class EventHandler{var $display_type;/** * Constructor */function EventHandler(){		/**	* Init globaly new instance of CMAP, the maps base class we need	*/	$this->cmap = new CMap();		/**	 * Force langfile reload	 */		@require(language_file());	$this->plugin_info = $lang_plugins['maps'];		$this->maps_setup_info_header = "$maps_setup_info_header";	$this->maps_setup_yahoo_id = "$maps_setup_yahoo_id";	$this->maps_setup_google_key = "$maps_setup_google_key";	$this->maps_setup_php_version_warning = "$maps_setup_php_version_warning";	$this->maps_select_type = "$maps_select_type";	$this->maps_select_type_info = "$maps_select_type_info";	$this->maps_select_display_type = "$maps_select_display_type";	$this->maps_select_display_type_info = "$maps_select_display_type_info";	$this->submit_button = "$submit_button_folder";	$this->maps_zoom_level = "$maps_zoom_level";	$this->maps_zoom_level_info = "$maps_zoom_level_info";	$this->maps_zoom_location = "$maps_zoom_location";	$this->maps_zoom_location_info = "$maps_zoom_location_info";	$this->maps_google_ctrl_size = "$maps_google_ctrl_size";	$this->maps_google_ctrl_size_info = "$maps_google_ctrl_size_info";	$this->dir_perms = "$dir_perms";	$this->str_change_perm = "$str_change_perm";	$this->maps_str = "$maps_str";	$this->map_type_ctrl = "$map_type_ctrl";	$this->map_type_ctrl_info = "$map_type_ctrl_info";	$this->map_slide_ctrl = "$map_slide_ctrl";	$this->map_slide_ctrl_info = "$map_slide_ctrl_info";	$this->map_pan_ctrl = "$map_pan_ctrl";	$this->map_pan_ctrl_info = "$map_pan_ctrl_info";	$this->map_auto_popup = "$map_auto_popup";	$this->map_auto_popup_info = "$map_auto_popup_info";	$this->map_album_add = "$map_album_add";	$this->map_marker_del = "$map_marker_del";	$this->map_search_location = "$map_search_location";	$this->map_location_here = "$map_location_here";	$this->map_new_search = "$str_new_search";	$this->map_search_loc_button = "$map_search_loc_button";	$this->map_add_location = "$map_add_location";	$this->map_assign_album = "$map_assign_album";}/** * init DB */function initDB(){	if($this->createInitialDB())	{				$new_loc = $GLOBALS['db']->Execute("INSERT INTO " .				"".PREFIX."maps_plugin " .				"(lat, lon, country, state, zip, city) " .				"VALUES ('51.52', '-0.1', 'UNITED KINGDOM', " .				"'England', '00000', 'London')");		if($new_loc): update_config('1', 'maps_setup_ok'); endif;	}	else	{		echo "Failed create DB -> check eventHandler::createInitialDB()";	}}// end initDB/** * This method creates the initial GPS database table * @param none * @return bool Database create ok or not  * @author bzrudi */function createInitialDB(){		if(read_config('db_type') == "sqlite")	{	$initdb = $GLOBALS['db']->Execute("CREATE TABLE ".PREFIX."maps_plugin (" .			"id INTEGER PRIMARY KEY, " .			"lat FLOAT DEFAULT '0.0', " .			"lon FLOAT DEFAULT '0.0', " .			"imgid INTEGER DEFAULT '0', " .			"albid INTEGER DEFAULT '0', " .			"stage INTEGER DEFAULT '0', " .			"country VARCHAR(255), " .			"state VARCHAR(255), " .			"street VARCHAR(255), " .			"zip VARCHAR(15), " .			"city VARCHAR(50), " .			"gpselevation INT DEFAULT '0', " .			"gpstime VARCHAR(100), " .			"gpscomment VARCHAR(255), " .			"gpsdescription  VARCHAR(255), " .			"gpsname VARCHAR(255), " .			"gpssymbol VARCHAR(255), " .			"marker VARCHAR(255) )");	}	elseif(read_config('db_type') == "mysql")	{	$initdb = $GLOBALS['db']->Execute("CREATE TABLE ".PREFIX."maps_plugin (" .			"id INTEGER AUTO_INCREMENT, " .			"lat FLOAT DEFAULT '0.0', " .			"lon FLOAT DEFAULT '0.0', " .			"imgid INT DEFAULT '0', " .			"albid INT DEFAULT '0', " .			"stage INT DEFAULT '0', " .			"country VARCHAR(255), " .			"state VARCHAR(255), " .			"street VARCHAR(255), " .			"zip VARCHAR(15), " .			"city VARCHAR(50), " .			"gpselevation INT DEFAULT '0', " .			"gpstime VARCHAR(100), " .			"gpscomment VARCHAR(255), " .			"gpsdescription  VARCHAR(255), " .			"gpsname VARCHAR(255), " .			"gpssymbol VARCHAR(255), " .			"marker VARCHAR(255), " .			"PRIMARY KEY (id) )");	}	elseif(read_config('db_type') == "pgsql")	{	$initdb = $GLOBALS['db']->Execute("CREATE TABLE ".PREFIX."maps_plugin (" .			"id SERIAL PRIMARY KEY, " .			"lat FLOAT DEFAULT '0.0', " .			"lon FLOAT DEFAULT '0.0', " .			"imgid INT DEFAULT '0', " .			"albid INT DEFAULT '0', " .			"stage INT DEFAULT '0', " .			"country VARCHAR(255), " .			"state VARCHAR(255), " .			"street VARCHAR(255), " .			"zip VARCHAR(15), " .			"city VARCHAR(50), " .			"gpselevation INT DEFAULT '0', " .			"gpstime VARCHAR(100), " .			"gpscomment VARCHAR(255), " .			"gpsdescription  VARCHAR(255), " .			"gpsname VARCHAR(255), " .			"gpssymbol VARCHAR(255), " .			"marker VARCHAR(255) )");	}	else	{		echo "Unknown Database Type, Aborting Now!";	}		if($initdb){		return true;	}else{		return false;	}				}//end createInitialDB/** * This method sets up the maps admin page, once setup is complete *  * @param none * @author bzrudi */function mapsPluginAdminPage(){	/**	 * prepare selects	 */	$maps_type = array('yahoo' => "Yahoo Maps", 'google' => "Google Maps");	$maps_display_type = array('1' => "Hybrid", '2' => "Satellite", '3' => "Regular");	$maps_google_ctl_size = array('1' => "Large", '0' => "Small");	$maps_zoom = array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5',				'6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10',				'11' => '11', '12' => '12', '13' => '13', '14' => '14', 				'15' => '15', '16' => '16');		$loc = $GLOBALS['db']->Execute("SELECT DISTINCT city " .				"FROM ".PREFIX."maps_plugin ");	while($data = $loc->fetchRow()){$locations[$data['0']] = $data['0'];}					echo "<h1>".$this->maps_setup_info_header."</h1><hr noshade>" .	"<form name='mapssetup' method='POST' action='".TOP_DIR.'/plugins/maps/db_handler.php'."'>" .	"<table class='admintable' width='100%' cellspacing='0'>" .	"<tr><th class='maintable' colspan='4'>".$this->maps_setup_info_header."</th></tr>";	$this->print_textfield($this->maps_setup_yahoo_id,'maps_yahoo_id',read_config('maps_yahoo_id'),"<--".$this->maps_setup_yahoo_id."",'yahooid','200');	$this->print_textfield($this->maps_setup_google_key,'maps_google_key',read_config('maps_google_key'),"<--".$this->maps_setup_google_key."",'googlekey','200');	echo "<tr><td class='maintable'>".$this->maps_select_type."</td>" .		"<td class='maintable'>";		form_generate_select("maps_type","1"," style='width:200'",read_config('maps_type'),$maps_type);	echo "</td><td class='maintable' align='right'>".$this->maps_select_type_info."</td>" .		"<td class='maintable'>&nbsp;</td></tr>";	echo "<tr><td class='maintable'>".$this->maps_select_display_type."</td>" .		"<td class='maintable'>";		form_generate_select("maps_display_type","1"," style='width:200'",read_config('maps_display_type'),$maps_display_type);	echo "</td><td class='maintable' align='right'>".$this->maps_select_display_type_info."</td>" .		"<td class='maintable'>&nbsp;</td></tr>";	echo "<tr><td class='maintable'>".$this->maps_google_ctrl_size."</td>" .		"<td class='maintable'>";		form_generate_select("maps_google_ctrl_size","1"," style='width:200'",read_config('maps_google_ctrl_size'),$maps_google_ctl_size);	echo "</td><td class='maintable' align='right'>".$this->maps_google_ctrl_size_info."</td>" .		"<td class='maintable'>&nbsp;</td></tr>";		echo "<tr><td class='maintable'>".$this->maps_zoom_level."</td>" .		"<td class='maintable'>";		form_generate_select("maps_default_zoom","1"," style='width:200'",read_config('maps_default_zoom'),$maps_zoom);	echo "</td><td class='maintable' align='right'>".$this->maps_zoom_level_info."</td>" .		"<td class='maintable'>&nbsp;</td></tr>";	echo "<tr><td class='maintable'>".$this->maps_zoom_location."</td>" .		"<td class='maintable'>";		form_generate_select("maps_default_zoom_location","1"," style='width:200'",read_config('maps_default_zoom_location'),$locations);	echo "</td><td class='maintable' align='right'>".$this->maps_zoom_location_info."</td>" .		"<td class='maintable'>&nbsp;</td></tr>";			print_radio("".$this->map_type_ctrl."",'maps_yahoo_type_control',read_config('maps_yahoo_type_control'),"".$this->map_type_ctrl."",'maptypes');	print_radio("".$this->map_slide_ctrl."",'maps_yahoo_slide_control',read_config('maps_yahoo_slide_control'),"".$this->map_slide_ctrl_info."",'mapslide');	print_radio("".$this->map_pan_ctrl."",'maps_yahoo_pan_control',read_config('maps_yahoo_pan_control'),"".$this->map_pan_ctrl_info."",'mappan');	print_radio("".$this->map_auto_popup."",'maps_marker_auto_popup',read_config('maps_marker_auto_popup'),"".$this->map_auto_popup_info."",'mapmarkerpop');	echo "<tr><td class='maintable' colspan='4' align='center'>".		"<input type='hidden' name='job' value='settings'>".		"<input type='submit' value=".$this->submit_button.">	</table>	</form>	";		echo "<h1>".$this->dir_perms."</h1><hr noshade>";	echo "".$this->str_change_perm." ".$this->maps_str." <br /><br />";	print_permissions('maps',TOP_DIR.'/admin.php?page=maps&amp;plugins=1');			}/** * This method retreives lat and longitude information as well as some other  * information using the yahoo geocode api.   *  * @param string location to search * @author bzrudi */function getLocationCoordinates($loc_query, $action, $location)

⌨️ 快捷键说明

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