Thread: [Easymod-cvs] easymod/install/em_files/includes/em em_common.php,1.2,1.3 em_functions.php,1.3,1.4 em
Status: Beta
Brought to you by:
wgeric
From: Eric F. <wg...@us...> - 2006-01-09 00:38:49
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13373/em_files/includes/em Modified Files: em_common.php em_functions.php em_parser_xml.php Log Message: - XML parsers history now - probably some other changes in there, its been a while I can't remember what all I have done Index: em_common.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_common.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** em_common.php 24 Dec 2005 01:43:42 -0000 1.2 --- em_common.php 9 Jan 2006 00:38:39 -0000 1.3 *************** *** 79,81 **** --- 79,84 ---- } + $unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#'); + $unhtml_specialchars_replace = array('>', '<', '"', '&'); + ?> \ No newline at end of file Index: em_functions.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_functions.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** em_functions.php 24 Dec 2005 01:43:42 -0000 1.3 --- em_functions.php 9 Jan 2006 00:38:39 -0000 1.4 *************** *** 22,26 **** /** ! * Opens a file */ function open_file($file) --- 22,45 ---- /** ! * Reverseres htmlspecialchars ! * ! * @see http://www.php.net/htmlspecialchars ! * @access public ! * @param $string string The string to reverse the changes on ! * @return string The string with htmlspecialchars reversed ! */ ! function unhtmlspecialchars($string) ! { ! global $unhtml_specialchars_match, $unhtml_specialchars_replace; ! ! return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $string); ! } ! ! /** ! * Opens a file. ! * ! * @access public ! * @param $file string File to open. ! * @return string Contents of the file. */ function open_file($file) *************** *** 53,57 **** /** ! * Get all extensions and return a list of corresponding parsers to use */ function load_parsers($force_update = false) --- 72,80 ---- /** ! * Loads the avaliable Template parsers. ! * ! * @access public ! * @param $force_update bool Update the cache. ! * @return array List of extensions and the corresponding parsers to use. */ function load_parsers($force_update = false) *************** *** 59,65 **** global $board_config, $db, $phpbb_root_path, $phpEx; ! if ( !$force_update && !empty($board_config['em_extensions']) ) { ! return unserialize($board_config['em_extensions']); } --- 82,88 ---- global $board_config, $db, $phpbb_root_path, $phpEx; ! if ( !$force_update && !empty($board_config['em_extensions_cache']) ) { ! return unserialize($board_config['em_extensions_cache']); } *************** *** 80,87 **** $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '$serialized_array' ! WHERE config_name = 'em_extensions'"; if ( !$db->sql_query($sql) ) { ! em_trigger_error(EM_ERR_CRITICAL,'err_update_ext', array($sql, __LINE__, __FILE__)); } --- 103,110 ---- $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '$serialized_array' ! WHERE config_name = 'em_extensions_cache'"; if ( !$db->sql_query($sql) ) { ! message_die(GENERAL_ERROR, 'Could not update extension cache', '', __LINE__, __FILE__, $sql); } *************** *** 90,99 **** /** ! * load the avaliable methods */ ! function load_methods($path = '') { ! global $phpbb_root_path, $phpEx; $methods = array(); $set_methods = true; --- 113,131 ---- /** ! * Loads the avaliable move/write methods. ! * ! * @access public ! * @param $force_update bool Update the cache. ! * @return array List of the avaliable methods. */ ! function load_methods($path = '', $force_update = false) { ! global $board_config, $db, $phpbb_root_path, $phpEx; + if ( !$force_update && !empty($board_config['em_methods_cache']) ) + { + return unserialize($board_config['em_methods_cache']); + } + $methods = array(); $set_methods = true; *************** *** 115,123 **** @closedir($dir); return $methods; } /** ! * Load an return the correct parser object */ function &new_parser($file) --- 147,168 ---- @closedir($dir); + $serialized_array = serialize($methods); + $sql = 'UPDATE ' . CONFIG_TABLE . " SET + config_value = '$serialized_array' + WHERE config_name = 'em_methods_cache'"; + if ( !$db->sql_query($sql) ) + { + message_die(GENERAL_ERROR, 'Could not update method cache', '', __LINE__, __FILE__, $sql); + } + return $methods; } /** ! * Load/Create a Template parser. ! * ! * @access public ! * @param $file string The MOD file that the parser will parse. ! * @return object The parser object. */ function &new_parser($file) *************** *** 137,141 **** /** ! * Load an return the correct IO method object */ function new_io($init = true) --- 182,190 ---- /** ! * Load/Create a move/write method. ! * ! * @access public ! * @param $init bool Initializes the method. ! * @return object The method's object. */ function new_io($init = true) *************** *** 149,153 **** if ( $result !== true ) { ! em_trigger_error(EM_ERR_CRITICAL,$result); } } --- 198,202 ---- if ( $result !== true ) { ! em_trigger_error(EM_ERR_CRITICAL, $result); } } *************** *** 156,160 **** /** ! * Chop a string into the specified letter count */ function str_cut($string, $cutoff) --- 205,214 ---- /** ! * Chop a string into the specified letter count. ! * ! * @access public ! * @param $string string The string to chop. ! * @param $cutoff integer How many characters long to make the string. ! * @return string The string cut with '...' on the end. */ function str_cut($string, $cutoff) *************** *** 232,237 **** /** ! * Returns true or false, on wether a MOD needs a style update ! * Pass the serialiaze array of MOD styles (as a reference) */ function styles_outdated(&$mod_styles) --- 286,294 ---- /** ! * Tells whether a MOD needs a style update. ! * ! * @access public ! * @param $mod_styles string A serialized array of the style ids a MOD was installed on. ! * @return bool true if the style needs updates, false if it doesn't. */ function styles_outdated(&$mod_styles) *************** *** 282,286 **** /** ! * Scans a folder and returns an array of ALL (including sub folders) MODs within */ function mod_scan($dirname, &$installed_mods) --- 339,348 ---- /** ! * Gets MODs that need to be installed. ! * ! * @access public ! * @param $dirname string The directory where MODs are going to be looked for. It will look three levels deep in the directory for MODs to install. ! * @param $installed_mods array The MOD files that have already been installed. ! * @return array A list of MODs that haven't been installed but have install files. */ function mod_scan($dirname, &$installed_mods) *************** *** 421,426 **** ! /* ! * Displays EasyMOD errors */ function em_trigger_error($err_type, $msg_text) --- 483,498 ---- ! /** ! * Displays errors in EasyMOD ! * ! * @access public ! * @param $err_type integer The type of error. Can be EM_ERR_INSTALL, EM_ERR_WARNING, or EM_ERR_CRITICAL. ! * @param $msg_txt string The error message. Can be the full error message or the key to be used in the $lang array. ! * ! * If there are more than three arguments, then the extra arguments are formatted in $msg_text using sprintf ! * @see http://www.php.net/sprintf ! * ! * If the error type isn't EM_ERR_INSTALL, then the first argument after $msg_text is displayed as code (in >pre< tags). ! * The rest of the arguments are formatted, as above, in sprintf. */ function em_trigger_error($err_type, $msg_text) Index: em_parser_xml.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_parser_xml.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** em_parser_xml.php 22 Dec 2005 00:33:31 -0000 1.3 --- em_parser_xml.php 9 Jan 2006 00:38:39 -0000 1.4 *************** *** 102,110 **** if(isset($this->data[count($this->data)-1]['data'])) { ! $this->data[count($this->data)-1]['data'] .= $tag_data; } else { ! $this->data[count($this->data)-1]['data'] = $tag_data; } } --- 102,110 ---- if(isset($this->data[count($this->data)-1]['data'])) { ! $this->data[count($this->data)-1]['data'] .= unhtmlspecialchars($tag_data); } else { ! $this->data[count($this->data)-1]['data'] = unhtmlspecialchars($tag_data); } } *************** *** 150,153 **** --- 150,174 ---- } + // history + $history_info = $header_info['HISTORY'][0]['children']['ENTRY']; + for($i = 0, $total = sizeof($history_info); $i < $total; $i++) + { + $changes = array(); + $entry = $history_info[$i]['children']; + $changelog = $entry['CHANGELOG'][0]['children']['CHANGE']; + $version = $entry['REV-VERSION'][0]['children']; + + for($j = 0, $change_total = sizeof($changelog); $j < $change_total; $j++) + { + $changes[] = $changelog[$j]['data']; + } + + $this->header['history'][] = array( + 'date' => $entry['DATE'][0]['data'], + 'version' => intval($version['MAJOR'][0]['data']) . '.' . intval($version['MINOR'][0]['data']) . '.' . intval($version['REVISION'][0]['data']) . $version['RELEASE'][0]['data'], + 'changes' => $changes, + ); + } + return $this->header; } |