|
From: Florin C B. <ory...@us...> - 2013-06-17 18:19:32
|
Update of /cvsroot/mxbb/mx_weather/admin In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19930/admin Added Files: admin_mx_weather.php index.htm Log Message: --- NEW FILE: admin_mx_weather.php --- <?php /*************************************************************************** * @begin May, 2002 * @package mxBB Portal Module - mx_weather * @version $Id: admin_mx_weather.php,v 1.1 2013/06/17 18:19:29 orynider Exp $ * @copyright (c) 2002 [ory...@rd..., OryNider] MX-System * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ***************************************************************************/ // ====================================================== // [ ADMINCP COMMON INITIALIZATION ] // ====================================================== $no_page_header = TRUE; // Add our entry to the Administration Control Panel... if( !empty($setmodules) ) { $file = basename(__FILE__); $module['Module_Weather']['General_Module_Settings'] = 'modules/mx_weather/admin/' . $file; return; } // Setup basic portal stuff... @define('IN_ADMIN', 1); $mx_root_path = '../../../'; $module_root_path = "../"; // // Start session management // define('PAGE_WEATHER_ADMIN', -51); //$userdata = session_pagestart($user_ip, PAGE_WEATHER_ADMIN); //mx_init_userprefs($userdata); // // End session management // // // Security and page header... // // require($mx_root_path . 'extension.inc'); $phpEx = substr(strrchr(__FILE__, '.'), 1); require($mx_root_path . '/admin/pagestart.'.$phpEx); // // Send page header... // include_once($mx_root_path . 'admin/page_header_admin.'.$phpEx); // // Include common module stuff... // include($module_root_path . 'includes/constants.'.$phpEx); include($module_root_path . 'includes/functions.'.$phpEx); // ====================================================== // [ MAIN PROCESS ] // ====================================================== /* if( !$userdata['session_logged_in'] ) { $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; header($header_location . mx_append_sid("../login.$phpEx?redirect=admin/")); exit; } else if( $userdata['user_level'] != ADMIN ) { mx_message_die(GENERAL_MESSAGE, $lang['Not_admin']); } */ function list_import_file() { global $db; $dir = @opendir( "../db/" ); $import_file = array(); $i = 0; while( $file = @readdir($dir) ) { if( preg_match("/^Weather_.*?\." . "sql" . "$/", $file) ) { $import_file[$i][file] = $file; $import_file[$i][display] = str_replace("Weather_","",basename($file)); $import_file[$i][display] = str_replace(".sql","",$import_file[$i][display]); $import_file[$i][display] = str_replace("_"," - ",$import_file[$i][display]); $i = $i +1; } } $nbr_option = $i; $weather_select = '<select name="weather_import_file">'; for($i = 0; $i < $nbr_option; $i++ ) { $info_display = rtrim( $import_file[$i][display]); $pos_div = strpos($info_display, "-"); $region = $info_display; $subdiv = ''; $sql_where = " WHERE (weather_region = '" . $region . "' OR weather_country = '" . $region . "')"; if ( $pos_div != 0) { $region = substr( $info_display ,0, $pos_div -1 ); $subdiv = ltrim( substr( $info_display, $pos_div +1 )); $sql_where = " WHERE (weather_region = '" . $region . "' OR weather_country = '" . $region . "') AND weather_subdiv = '" . $subdiv . "'"; } $sql = "SELECT DISTINCT weather_region, weather_country, weather_subdiv FROM " . WEATHER_TABLE . $sql_where; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Couldn't get list of Weather option", "", __LINE__, __FILE__, $sql); } if( $db->sql_numrows($result) == 0 ) { $weather_select .= '<option value="' . $import_file[$i][file] . '">' . $import_file[$i][display] . '</option>'; } } $weather_select .= "</select>"; @closedir($dir); return $weather_select; } function renumber_order() { global $db; $sql = "SELECT * FROM " . CONFIG_WEATHER_DET_TABLE; $sql .= " WHERE user_id = 0 ORDER BY weather_order ASC"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't get list of Weather option", "", __LINE__, __FILE__, $sql); } $i = 10; $inc = 10; while( $row = $db->sql_fetchrow($result) ) { $sql = "UPDATE " . CONFIG_WEATHER_DET_TABLE . " SET weather_order = $i WHERE user_id = 0 AND weather_id = '" . $row[weather_id] . "'"; if( !$db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql); } $i += 10; } } // // remove_remarks will strip the sql comment lines out of an uploaded sql file // if (!function_exists('mx_remove_remarks')) { function mx_remove_remarks(&$sql) { return preg_replace('/(\n){2,}/', "\n", preg_replace('/^#.*/m', "\n", $sql)); } } if (!function_exists('mx_remove_comments')) { function mx_remove_comments(&$sql) { return preg_replace('/(\n){2,}/', "\n", preg_replace('/^--.*/m', "\n", $sql)); } } // // split_sql_file will split an uploaded sql file into single sql statements. // Note: expects trim() to have already been run on $sql. // if (!function_exists('split_sql_file')) { function split_sql_file($sql, $delimiter) { $sql = str_replace("\r" , '', $sql); $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); $data = array_map('trim', $data); // The empty case $end_data = end($data); if (empty($end_data)) { unset($data[key($data)]); } return $data; } } // // For replacing {L_*} strings with preg_replace_callback // if (!function_exists('adjust_language_keys_callback')) { function adjust_language_keys_callback($matches) { if (!empty($matches[1])) { global $lang, $db; return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]); } } } // ********************************************************************** // Read language definition // ********************************************************************** if (!file_exists($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) { require($module_root_path . 'language/lang_english/lang_main.'.$phpEx); } else { require($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx); } if (!file_exists($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx)) { require($module_root_path . 'language/lang_english/lang_admin.'.$phpEx); } else { require($module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.'.$phpEx); } //include_once($mx_root_path . 'admin/page_header_admin.'.$phpEx); //include_once($phpbb_root_path.'includes/sql_parse.'.$phpEx); // // Limit // $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; // // Region // if( isset($HTTP_GET_VARS['weather_region']) || isset($HTTP_POST_VARS['weather_region']) ) { $weather_region_sel = ( !empty($HTTP_GET_VARS['weather_region'])) ? $HTTP_GET_VARS['weather_region'] : $HTTP_POST_VARS['weather_region']; $weather_region_sel = str_replace("\'","'",$weather_region_sel); } else { $sql = "SELECT DISTINCT weather_region, weather_country, weather_subdiv FROM " . WEATHER_TABLE . " ORDER BY weather_region, weather_country, weather_subdiv"; if ( !($result = $db->sql_query($sql)) ) { mx_message_die(GENERAL_ERROR, "Couldn't query weather table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $weather_region_sel = ( empty( $row['weather_subdiv']) ) ? "weather_region ='" . $row['weather_region'] . "' and weather_country ='" . $row['weather_country'] . "'" : "weather_region ='" . $row['weather_region'] . "' and weather_country ='" . $row['weather_country'] . "' and weather_subdiv ='" . $row['weather_subdiv'] . "'"; } if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) { $mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; } else { if ( isset($HTTP_POST_VARS['submit'])) { $mode = "update"; } else if ( isset($HTTP_POST_VARS['add_city'])) { $mode = "add_city"; } else if ( isset($HTTP_POST_VARS['save'])) { $mode = "save_city"; } else if ( isset($HTTP_POST_VARS['import_city'])) { $mode = "import_city"; } else { $mode = ""; } } if( $mode != "" ) { switch($mode) { case 'update': $new = array(); $new['weather_unit_default'] = $mx_request_vars->post('weather_unit_default', MX_TYPE_NO_TAGS, ''); $new['weather_city_default'] = $mx_request_vars->post('weather_city_default', MX_TYPE_NO_TAGS, ''); $new['weather_zipcode_default'] = $mx_request_vars->post('weather_zipcode_default', MX_TYPE_NO_TAGS, ''); $new['weather_country_default'] = $mx_request_vars->post('weather_country_default', MX_TYPE_NO_TAGS, ''); $new['partner_id_default'] = $mx_request_vars->post('partner_id_default', MX_TYPE_NO_TAGS, ''); $new['license_key_deault'] = $mx_request_vars->post('license_key_deault', MX_TYPE_NO_TAGS, ''); if (!$result = $db->sql_query("SELECT user_id from ".CONFIG_WEATHER_TABLE)) { switch (PORTAL_BACKEND) { case 'internal': case 'phpbb2': $config_array = array_merge(array('user_id' => (int) '0',), $new); $sql = "INSERT INTO ".CONFIG_WEATHER_TABLE." (". implode(', ', array_keys($config_array)). ") VALUES (". implode(', ', array_values($config_array)). ")"; break; case 'phpbb3': $sql = "INSERT INTO ".CONFIG_WEATHER_TABLE.$db->sql_build_array('INSERT', array_merge(array('user_id' => (int) '0',), $new)); break; } } else { //$weather_unit_default = $HTTP_POST_VARS['weather_unit_default']; $sql = "UPDATE " . CONFIG_WEATHER_TABLE . " SET " . $db->sql_build_array('UPDATE', $new); //$sql = "UPDATE " . CONFIG_WEATHER_TABLE . " SET weather_unit_default = '$weather_unit_default' WHERE user_id = 0" ; } if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not update data from weather table", $lang['Error'], __LINE__, __FILE__, $sql); } break; case 'save_city': $weather_region = $HTTP_POST_VARS['weather_region_e']; $weather_country = $HTTP_POST_VARS['weather_country_e']; $weather_subdiv = $HTTP_POST_VARS['weather_subdiv_e']; $weather_city = $HTTP_POST_VARS['weather_city_e']; $weather_code = $HTTP_POST_VARS['weather_code_e']; if ( isset($HTTP_POST_VARS['id'] ) ) { $sql = "UPDATE " . WEATHER_TABLE . " set weather_region = '" . $weather_region . "'" . " , weather_country = '" . $weather_country . "'" . " , weather_subdiv = '" . $weather_subdiv . "'" . " , weather_city = '" . $weather_city . "'" . " , weather_id = '" . $weather_code . "'" . " WHERE weather_id = '" . $HTTP_POST_VARS['id'] . "'"; } else { $sql = "INSERT INTO " . WEATHER_TABLE . "(weather_region, weather_country, weather_subdiv, weather_city, weather_id ) VALUES ('" . $weather_region . "','" . $weather_country . "','" . $weather_subdiv . "','" . $weather_city . "','" . $weather_code . "')" ; } if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not add data in weather table", $lang['Error'], __LINE__, __FILE__, $sql); } break; case 'add': $weather_id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : 0; $sql = "SELECT max(weather_order) weather_order FROM " . CONFIG_WEATHER_DET_TABLE . " WHERE user_id = 0"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't get list of Weather option", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $weather_order = $row[weather_order] + 10; $sql = "INSERT INTO " . CONFIG_WEATHER_DET_TABLE . " (user_id, weather_id, weather_order ) VALUES ( 0, '" . $weather_id . "' , ". $weather_order." ) "; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not add data from weather table", $lang['Error'], __LINE__, __FILE__, $sql); } break; case 'import_city': $available_dbms = array( "mysql" => array( "LABEL" => "MySQL 3.x", "SCHEMA" => "mysql", "DELIM" => ";", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_remarks" ), "mysql4" => array( "LABEL" => "MySQL 4.x", "SCHEMA" => "mysql", "DELIM" => ";", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_remarks" ), "mysqli" => array( "LABEL" => "MySQL with MySQLi Extension", "SCHEMA" => "mysql_41", "DELIM" => ";", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_remarks" ), "mysql6" => array( "LABEL" => "MySQL 6.x", "SCHEMA" => "mysql_61", "DELIM" => ";", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_remarks" ), "postgres" => array( "LABEL" => "PostgreSQL 7.x", "SCHEMA" => "postgres", "DELIM" => ";", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_comments" ), "mssql" => array( "LABEL" => "MS SQL Server 7/2000", "SCHEMA" => "mssql", "DELIM" => "GO", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_comments" ), "msaccess" => array( "LABEL" => "MS Access [ ODBC ]", "SCHEMA" => "", "DELIM" => "", "DELIM_BASIC" => ";", "COMMENTS" => "" ), "mssql-odbc" => array( "LABEL" => "MS SQL Server [ ODBC ]", "SCHEMA" => "mssql", "DELIM" => "GO", "DELIM_BASIC" => ";", "COMMENTS" => "mx_remove_comments" ) ); $weather_import_file = "../db/" . $HTTP_POST_VARS['weather_import_file']; $mx_remove_remarks = $available_dbms[$dbms]['COMMENTS']; $delimiter = $available_dbms[$dbms]['DELIM']; $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; $sql_query = @file_get_contents($weather_import_file); //$sql_query = @fread(@fopen($weather_import_file, 'r'), @filesize($weather_import_file)); // // Ok, build the SQL statement // //$sql_query = preg_replace('#mx_#i', $mx_table_prefix, $sql_query); //$sql_query = preg_replace('/mx_table_/', $mx_table_prefix, $sql_query); $sql_query = preg_replace('/%mx_%/', $mx_table_prefix, $sql_query); //print_r($sql_query); if($sql_query != "") { // Strip out sql comments... $sql_query = $mx_remove_remarks($sql_query); //$pieces = split_sql_file($sql_query, ";"); $pieces = split_sql_file($sql_query, $delimiter); /* $sql_count = count($pieces); for($i = 0; $i < $sql_count; $i++) { $sql = trim($pieces[$i]); if(!empty($sql) and $sql[0] != "#") { if(VERBOSE == 1) { echo "Executing: $sql\n<br>"; flush(); } //$sql = trim(str_replace('|', ';', $sql)); // // If it works, we know the target system has been upgraded // to this particular level, so we skip to the next check. // $result = $db->sql_query($sql); if(!$result && ( !(SQL_LAYER == 'postgresql' && eregi("drop table", $sql) ) ) ) { //$error = $db->sql_error(); //$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); mx_message_die(GENERAL_ERROR, "Error importing Weather sql dump file " . $weather_import_file . "", "", __LINE__, __FILE__, $sql); } unset($sql_query); } } */ foreach ($pieces as $sql) { //$sql = trim(str_replace('|', ';', $sql)); // // If it works, we know the target system has been upgraded // to this particular level, so we skip to the next check. // $result = $db->sql_query($sql); if(!$result && ( !(SQL_LAYER == 'postgresql' && eregi("drop table", $sql)))) { //$error = $db->sql_error(); //$this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__); mx_message_die(GENERAL_ERROR, "Error importing Weather sql dump file " . $weather_import_file . "", "", __LINE__, __FILE__, $sql); } } unset($sql_query); } break; case 'edit': case 'add_city': $weather_id = ( isset($HTTP_GET_VARS['id']) ) ? $HTTP_GET_VARS['id'] : 0; $template->set_filenames(array( "body" => "admin/mx_weather_edit_body.tpl") ); $s_hidden_fields = ''; if( $mode == "edit" ) { if( $weather_id ) { $sql = "SELECT * FROM " . WEATHER_TABLE . " WHERE weather_id = '$weather_id'"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not query weather table", "Error", __LINE__, __FILE__, $sql); } $weather_info = $db->sql_fetchrow($result); $s_hidden_fields .= '<input type="hidden" name="id" value="' . $weather_id . '" />'; $weather_region = $weather_info['weather_region']; $weather_country = $weather_info['weather_country']; $weather_subdiv = $weather_info['weather_subdiv']; $weather_city = $weather_info['weather_city']; $weather_code = $weather_info['weather_id']; } else { mx_message_die(GENERAL_MESSAGE, "No Weather selected"); } } else { $sql = "SELECT DISTINCT weather_region, weather_country, weather_subdiv FROM " . WEATHER_TABLE . " WHERE $weather_region_sel"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not query weather table", "Error", __LINE__, __FILE__, $sql); } $weather_info = $db->sql_fetchrow($result); $weather_region = $weather_info['weather_region']; $weather_country = $weather_info['weather_country']; $weather_subdiv = $weather_info['weather_subdiv']; $weather_city = ''; $weather_code = ''; } $template->assign_vars(array( "L_WEATHER_TITLE" => $lang['Weather_Settings'], "L_WEATHER_TEXT" => "Add or Edit a City", "L_WEATHER_REGION" => $lang['Region'], "L_WEATHER_COUNTRY" => $lang['Country'], "L_WEATHER_SUBDIV" => $lang['SubDiv'], "L_WEATHER_CITY" => $lang['City'], "L_WEATHER_CODE" => $lang['Code'], "L_SUBMIT" => $lang['Submit'], "WEATHER_REGION" => $weather_region, "WEATHER_COUNTRY" => $weather_country, "WEATHER_SUBDIV" => $weather_subdiv, "WEATHER_CITY" => $weather_city, "WEATHER_CODE" => $weather_code, "S_WEATHER_ACTION" => mx_append_sid("admin_mx_weather.$phpEx"), "S_HIDDEN_FIELDS" => $s_hidden_fields ) ); $template->pparse("body"); include_once( $mx_root_path . 'admin/page_footer_admin.'.$phpEx); break; case 'delete': if( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) ) { $weather_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id']; } else { $weather_id = 0; } if( $weather_id ) { $sql = "DELETE FROM " . CONFIG_WEATHER_DET_TABLE . " WHERE weather_id = '$weather_id'"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not remove data from weather table", $lang['Error'], __LINE__, __FILE__, $sql); } renumber_order(); } else { mx_message_die(GENERAL_MESSAGE, "No Weather selected"); } break; case 'delete_city': if( isset($HTTP_POST_VARS['id']) || isset($HTTP_GET_VARS['id']) ) { $weather_id = ( isset($HTTP_POST_VARS['id']) ) ? $HTTP_POST_VARS['id'] : $HTTP_GET_VARS['id']; } else { $weather_id = 0; } if( $weather_id ) { $sql = "DELETE FROM " . WEATHER_TABLE . " WHERE weather_id = '$weather_id'"; if(!$result = $db->sql_query($sql)) { mx_message_die(GENERAL_ERROR, "Could not remove data from weather table", $lang['Error'], __LINE__, __FILE__, $sql); } } else { mx_message_die(GENERAL_MESSAGE, "No weather selected"); } break; case 'order': // // Change order of menus in the DB // $move = intval($HTTP_GET_VARS['move']); $weather_id = $HTTP_GET_VARS[POST_URL]; $sql = "UPDATE " . CONFIG_WEATHER_DET_TABLE . " SET weather_order = weather_order + $move WHERE user_id = 0 AND weather_id = '$weather_id'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Couldn't change weather order", "", __LINE__, __FILE__, $sql); } renumber_order(); break; default: mx_message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__); break; } } $template->set_filenames(array( "body" => "admin/mx_weather_list_body.tpl") ); // ********************************************************************** // Read module config // ********************************************************************** $config = read_weather_config(0); $template->assign_vars(array( "S_CONFIG_ACTION" => mx_append_sid("admin_mx_weather.$phpEx"), "L_YES" => $lang['Yes'], "L_NO" => $lang['No'], "L_WEATHER_SETTINGS" => $lang['Weather_Settings'], "L_WEATHER_UNIT_DEFAULT" => $lang['Weather_Unit_Default'], "WEATHER_UNIT_DEFAULT" => $config['weather_unit_default'], "WEATHER_UNIT_SELECT" => weather_unit_select( $config['weather_unit_default'], 'weather_unit_default' ), "WEATHER_REGION_SELECT" => weather_region_select($weather_region_sel, 'weather_region'), "WEATHER_IMPORT_FILE" => list_import_file(), "L_WEATHER_CITY_DEFAULT" => $lang['weather_city_default'], "WEATHER_CITY_DEFAULT" => $config['weather_city_default'], "L_WEATHER_ZIPCODE_DEFAULT" => $lang['weather_zipcode_default'], "WEATHER_ZIPCODE_DEFAULT" => $config['weather_zipcode_default'], "L_WEATHER_COUNTRY_DEFAULT" => $lang['weather_country_default'], "WEATHER_COUNTRY_DEFAULT" => $config['weather_country_default'], "L_PARTNER_ID_DEFAULT" => $lang['partner_id_default'], "PARTNER_ID_DEFAULT" => $config['partner_id_default'], "L_LICENSE_KEY_DEAULT" => $lang['license_key_deault'], "LICENSE_KEY_DEAULT" => $config['license_key_deault'], "L_SUBMIT" => $lang['Submit'], "L_RESET" => $lang['Reset'], ) ); $sql = "SELECT t.* FROM " . CONFIG_WEATHER_DET_TABLE . " c , " . WEATHER_TABLE . " t WHERE c.user_id = 0 and c.weather_id = t.weather_id ORDER BY weather_order"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Could not query weather table", $lang['Error'], __LINE__, __FILE__, $sql); } $weather_rows = $db->sql_fetchrowset($result); $weather_count = count($weather_rows); $template->assign_vars(array( "L_WEATHER_TITLE" => $lang['Weather_Settings'], "L_WEATHER_TEXT" => $lang['Weather_explain'], "L_WEATHER_REGION" => $lang['Region'], "L_WEATHER_COUNTRY" => $lang['Country'], "L_WEATHER_SUBDIV" => $lang['SubDiv'], "L_WEATHER_CITY" => $lang['City'], "L_EDIT" => $lang['Edit'], "L_DELETE" => $lang['Delete'], "L_ADD" => $lang['Add'], "L_MOVE_UP" => $lang['Move_up'], "L_MOVE_DOWN" => $lang['Move_down'], "L_WEATHER_BLOCK" => $lang['Weather_Block'], "L_WEATHER_LIST" => $lang['Weather_List'], "L_ADD_CITY" => $lang['Add_City'], "L_IMPORT_CITY" => $lang['Import_City'], "L_CHANGE_NOW" => $lang['Change'], "L_ACTION" => $lang['Action'], "S_WEATHER_ACTION" => mx_append_sid("admin_mx_weather.$phpEx"), "S_HIDDEN_FIELDS" => '') ); for($i = 0; $i < $weather_count; $i++) { $weather_city = $weather_rows[$i]['weather_city']; $weather_country = $weather_rows[$i]['weather_country']; $weather_region = $weather_rows[$i]['weather_region']; $weather_id = $weather_rows[$i]['weather_id']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars("weather", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "WEATHER_REGION" => $weather_region, "WEATHER_COUNTRY" => $weather_country, "WEATHER_CITY" => $weather_city, "U_DELETE" => mx_append_sid("admin_mx_weather.$phpEx?mode=delete&id=$weather_id&weather_region=$weather_region_sel"), "U_MENU_MOVE_UP" => mx_append_sid("admin_mx_weather.$phpEx?mode=order&move=-15&" . POST_URL . "=$weather_id&weather_region=$weather_region_sel"), "U_MENU_MOVE_DOWN" => mx_append_sid("admin_mx_weather.$phpEx?mode=order&move=15&" . POST_URL . "=$weather_id&weather_region=$weather_region_sel"), ) ); } $sql = "SELECT * FROM " . WEATHER_TABLE . " WHERE " . $weather_region_sel . " ORDER BY weather_region, weather_country, weather_subdiv, weather_city " ; // LIMIT $start, 30 if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, "Could not query weather table", $lang['Error'], __LINE__, __FILE__, $sql); } $weather_rows = $db->sql_fetchrowset($result); $weather_count = count($weather_rows); for($i = 0; $i < $weather_count; $i++) { $weather_city = $weather_rows[$i]['weather_city']; $weather_country = $weather_rows[$i]['weather_country']; $weather_subdiv = $weather_rows[$i]['weather_subdiv']; $weather_region = $weather_rows[$i]['weather_region']; $weather_id = $weather_rows[$i]['weather_id']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars("weather_list", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "WEATHER_REGION" => $weather_region, "WEATHER_COUNTRY" => $weather_country, "WEATHER_SUBDIV" => $weather_subdiv, "WEATHER_CITY" => $weather_city, "U_EDIT" => mx_append_sid("admin_mx_weather.$phpEx?mode=edit&id=$weather_id&weather_region=$weather_region_sel"), "U_DELETE" => mx_append_sid("admin_mx_weather.$phpEx?mode=delete_city&id=$weather_id&weather_region=$weather_region_sel"), "U_ADD" => mx_append_sid("admin_mx_weather.$phpEx?mode=add&id=$weather_id&weather_region=$weather_region_sel"), ) ); } $template->pparse("body"); include_once( $mx_root_path . 'admin/page_footer_admin.'.$phpEx); ?> --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |