easymod-cvs Mailing List for EasyMOD (Page 3)
Status: Beta
Brought to you by:
wgeric
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
(16) |
May
(36) |
Jun
(53) |
Jul
(21) |
Aug
|
Sep
(10) |
Oct
(4) |
Nov
(69) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(5) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(12) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Eric F. <wg...@us...> - 2005-12-22 00:33:46
|
Update of /cvsroot/easymod/easymod/install/em_files/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28502/em_files/admin Modified Files: em_manage.php Log Message: - Changed error message to em_trigger_error Other minor changes Index: em_manage.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/admin/em_manage.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** em_manage.php 9 Dec 2005 23:22:37 -0000 1.3 --- em_manage.php 22 Dec 2005 00:33:31 -0000 1.4 *************** *** 103,107 **** if( !$mod_parser->verify() ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $mod_file); } $mod_parser->parse_header(); --- 103,107 ---- if( !$mod_parser->verify() ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_open', $mod_file); } $mod_parser->parse_header(); *************** *** 159,163 **** if ( !$modder->open($edit_file) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); --- 159,163 ---- if ( !$modder->open($edit_file) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); *************** *** 169,173 **** if ( !$modder->find($actions_data['find']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); --- 169,173 ---- if ( !$modder->find($actions_data['find']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); *************** *** 182,186 **** if ( !call_user_func(array(&$modder, $action_func), $action_data['code']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; --- 182,186 ---- if ( !call_user_func(array(&$modder, $action_func), $action_data['code']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; *************** *** 201,205 **** if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); --- 201,205 ---- if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); *************** *** 214,218 **** if ( !call_user_func(array(&$modder, $action_func), $inline_data['code']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; --- 214,218 ---- if ( !call_user_func(array(&$modder, $action_func), $inline_data['code']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; *************** *** 295,299 **** for( $i = 0, $total = sizeof($sql_parser->warnings); $i < $total; $i++ ) { ! em_handle_error(EM_ERR_WARNING, 'SQL Warning', $sql_parser->warnings[$i]); } } --- 295,299 ---- for( $i = 0, $total = sizeof($sql_parser->warnings); $i < $total; $i++ ) { ! em_trigger_error(EM_ERR_WARNING, 'SQL Warning', $sql_parser->warnings[$i]); } } *************** *** 429,433 **** if ( !$mod_io->make_dir($backup_dir . '/' . dirname($target_file)) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_backup', $backup_dir . '/' . dirname($target_file)); } --- 429,433 ---- if ( !$mod_io->make_dir($backup_dir . '/' . dirname($target_file)) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_backup', $backup_dir . '/' . dirname($target_file)); } *************** *** 435,439 **** if ( !$mod_io->copy_file($target_file, $backup_dir . '/' . $target_file . '.txt') ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_move_backup', $target_file); } --- 435,439 ---- if ( !$mod_io->copy_file($target_file, $backup_dir . '/' . $target_file . '.txt') ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_move_backup', $target_file); } *************** *** 468,477 **** if ( !$mod_io->make_dir(dirname($copy_files[$i]['to'])) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_file', dirname($copy_files[$i]['to'])); } if ( !$mod_io->copy_file($copy_files[$i]['from'], $copy_files[$i]['to']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_move_file', $copy_files[$i]['from']); } --- 468,477 ---- if ( !$mod_io->make_dir(dirname($copy_files[$i]['to'])) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_file', dirname($copy_files[$i]['to'])); } if ( !$mod_io->copy_file($copy_files[$i]['from'], $copy_files[$i]['to']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_move_file', $copy_files[$i]['from']); } *************** *** 546,549 **** --- 546,553 ---- for( $k = 0, $copy_total = sizeof($copy_files); $k < $copy_total; $k++ ) { + if ( !file_exists($copy_files[$k]['from']) ) + { + em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_copy', $copy_files[$k]['from'], $copy_files[$k]['to']); + } $copy_actions[] = 'copy ' . $copy_files[$k]['from'] . ' to ' . $copy_files[$k]['to']; } *************** *** 557,561 **** if ( !$modder->open($phpbb_root_path . $target_file) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); --- 561,565 ---- if ( !$modder->open($phpbb_root_path . $target_file) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); *************** *** 568,572 **** if ( !$modder->find($actions_data['find']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); --- 572,576 ---- if ( !$modder->find($actions_data['find']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); *************** *** 595,599 **** if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { ! em_handle_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); --- 599,603 ---- if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { ! em_trigger_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); |
From: Eric F. <wg...@us...> - 2005-12-22 00:33:46
|
Update of /cvsroot/easymod/easymod/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28502 Modified Files: em_install.php Log Message: - Changed error message to em_trigger_error Other minor changes Index: em_install.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_install.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** em_install.php 9 Dec 2005 23:22:37 -0000 1.2 --- em_install.php 22 Dec 2005 00:33:31 -0000 1.3 *************** *** 682,686 **** if ( !is_bool($error) ) { ! em_handle_error(EM_ERR_INSTALL, $error); } --- 682,686 ---- if ( !is_bool($error) ) { ! em_trigger_error(EM_ERR_INSTALL, $error); } |
From: Eric F. <wg...@us...> - 2005-12-22 00:33:46
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28502/em_files/includes/em Modified Files: em_functions.php em_functions_20x.php em_functions_30x.php em_parser_xml.php Log Message: - Changed error message to em_trigger_error Other minor changes Index: em_functions_30x.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_functions_30x.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_functions_30x.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_functions_30x.php 22 Dec 2005 00:33:31 -0000 1.2 *************** *** 1,4 **** <?php ! /** * * @package EasyMOD --- 1,4 ---- <?php ! /** * * @package EasyMOD *************** *** 23,31 **** } - function em_trigger_error($msg_text = '', $msg_code = 0, $msg_title = '', $err_line = '', $err_file = '', $sql = '') - { - trigger_error($msg_text); - } - function em_auth() { --- 23,26 ---- Index: em_functions.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_functions.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_functions.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_functions.php 22 Dec 2005 00:33:31 -0000 1.2 *************** *** 83,87 **** if ( !$db->sql_query($sql) ) { ! em_handle_error(EM_ERR_CRITICAL,'err_update_ext', array($sql, __LINE__, __FILE__)); } --- 83,87 ---- if ( !$db->sql_query($sql) ) { ! em_trigger_error(EM_ERR_CRITICAL,'err_update_ext', array($sql, __LINE__, __FILE__)); } *************** *** 149,153 **** if ( $result !== true ) { ! em_handle_error(EM_ERR_CRITICAL,$result); } } --- 149,153 ---- if ( $result !== true ) { ! em_trigger_error(EM_ERR_CRITICAL,$result); } } *************** *** 424,428 **** * Displays EasyMOD errors */ ! function em_handle_error($err_type, $msg_text) { global $lang; --- 424,428 ---- * Displays EasyMOD errors */ ! function em_trigger_error($err_type, $msg_text) { global $lang; Index: em_parser_xml.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_parser_xml.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** em_parser_xml.php 22 Dec 2005 00:14:43 -0000 1.2 --- em_parser_xml.php 22 Dec 2005 00:33:31 -0000 1.3 *************** *** 39,49 **** */ var $header = array(); ! /** * Actions for the MOD * @type array */ ! var $actions = array(); ! /** * Parsed XML file in an array --- 39,49 ---- */ var $header = array(); ! /** * Actions for the MOD * @type array */ ! var $actions = array(); ! /** * Parsed XML file in an array *************** *** 51,55 **** */ var $data = array(); ! /** * XML parser resource --- 51,55 ---- */ var $data = array(); ! /** * XML parser resource *************** *** 68,72 **** $this->mod_file = $mod_file; } ! function _parse() { --- 68,72 ---- $this->mod_file = $mod_file; } ! function _parse() { *************** *** 139,143 **** $this->header['version'] = trim($version_info['MAJOR'][0]['data']) . '.' . trim($version_info['MINOR'][0]['data']) . '.' . trim($version_info['REVISION']['data']); $this->header['version'] = (isset($version_info['RELEASE'][0]['data'])) ? $this->header['version'] . $version_info['RELEASE'][0]['data'] : $this->header['version']; ! $author_info = $header_info['AUTHOR-GROUP'][0]['children']['AUTHOR']; for($i = 0, $total = sizeof($author_info); $i < $total; $i++) --- 139,143 ---- $this->header['version'] = trim($version_info['MAJOR'][0]['data']) . '.' . trim($version_info['MINOR'][0]['data']) . '.' . trim($version_info['REVISION']['data']); $this->header['version'] = (isset($version_info['RELEASE'][0]['data'])) ? $this->header['version'] . $version_info['RELEASE'][0]['data'] : $this->header['version']; ! $author_info = $header_info['AUTHOR-GROUP'][0]['children']['AUTHOR']; for($i = 0, $total = sizeof($author_info); $i < $total; $i++) *************** *** 149,153 **** 'website' => trim($author_info[$i]['children']['HOMEPAGE'][0]['data'])); } ! return $this->header; } --- 149,153 ---- 'website' => trim($author_info[$i]['children']['HOMEPAGE'][0]['data'])); } ! return $this->header; } *************** *** 158,169 **** // sql ! $sql_info = $actions['SQL']; for( $i = 0, $total = sizeof($sql_info); $i < $total; $i++ ) { $this->actions['sql'][] = ( !empty($sql_info[$i]['data']) ) ? trim($sql_info[$i]['data']): ''; } ! // copy ! $copy_info = $actions['COPY']; for( $i = 0, $total = sizeof($copy_info); $i < $total; $i++ ) { --- 158,169 ---- // sql ! $sql_info = ( !empty($actions['SQL']) ) ? $actions['SQL'] : ''; for( $i = 0, $total = sizeof($sql_info); $i < $total; $i++ ) { $this->actions['sql'][] = ( !empty($sql_info[$i]['data']) ) ? trim($sql_info[$i]['data']): ''; } ! // copy ! $copy_info = ( !empty($actions['COPY']) ) ? $actions['COPY'] : array(); for( $i = 0, $total = sizeof($copy_info); $i < $total; $i++ ) { *************** *** 176,194 **** } } ! // open ! $open_info = $actions['OPEN']; for( $i = 0, $total = sizeof($open_info); $i < $total; $i++ ) { $current_file = str_replace('\\', '/', trim($open_info[$i]['attrs']['SRC'])); $this->actions['open'][$current_file] = array(); ! ! $edit_info = $open_info[$i]['children']['EDIT']; for($j = 0, $edit_total = sizeof($edit_info); $j < $edit_total; $j++) { ! $action_info = $edit_info[$j]['children']; $this->actions['open'][$current_file]['edit'][$j]['find'] = $action_info['FIND'][0]['data']; ! ! $actions = $action_info['ACTION']; for($k = 0, $action_total = sizeof($actions); $k < $action_total; $k++) { --- 176,194 ---- } } ! // open ! $open_info = ( !empty($actions['OPEN']) ) ? $actions['OPEN'] : array();; for( $i = 0, $total = sizeof($open_info); $i < $total; $i++ ) { $current_file = str_replace('\\', '/', trim($open_info[$i]['attrs']['SRC'])); $this->actions['open'][$current_file] = array(); ! ! $edit_info = ( !empty($open_info[$i]['children']['EDIT']) ) ? $open_info[$i]['children']['EDIT'] : array(); for($j = 0, $edit_total = sizeof($edit_info); $j < $edit_total; $j++) { ! $action_info = ( !empty($edit_info[$j]['children']) ) ? $edit_info[$j]['children'] : array(); $this->actions['open'][$current_file]['edit'][$j]['find'] = $action_info['FIND'][0]['data']; ! ! $actions = ( !empty($action_info['ACTION']) ) ? $action_info['ACTION'] : array(); for($k = 0, $action_total = sizeof($actions); $k < $action_total; $k++) { *************** *** 200,211 **** } ! $inline_info = $action_info['INLINE-EDIT']; for($k = 0, $inline_total = sizeof($inline_info); $k < $inline_total; $k++) { ! $inline_actions = $inline_info[$k]['children']; ! $this->actions['open'][$current_file]['edit'][$j]['in-line-edit'][$k]['in-line-find'] = $inline_actions['INLINE-FIND'][0]['data']; ! ! $actions = $inline_actions['INLINE-ACTION']; for($x = 0, $actions_total = sizeof($actions); $x < $actions_total; $x++) { --- 200,211 ---- } ! $inline_info = ( !empty($action_info['INLINE-EDIT']) ) ? $action_info['INLINE-EDIT'] : array(); for($k = 0, $inline_total = sizeof($inline_info); $k < $inline_total; $k++) { ! $inline_actions = ( !empty($inline_info[$k]['children']) ) ? $inline_info[$k]['children'] : array(); ! $this->actions['open'][$current_file]['edit'][$j]['in-line-edit'][$k]['in-line-find'] = $inline_actions['INLINE-FIND'][0]['data']; ! ! $actions = ( !empty($inline_actions['INLINE-ACTION']) ) ? $inline_actions['INLINE-ACTION'] : array(); for($x = 0, $actions_total = sizeof($actions); $x < $actions_total; $x++) { Index: em_functions_20x.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_functions_20x.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_functions_20x.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_functions_20x.php 22 Dec 2005 00:33:31 -0000 1.2 *************** *** 135,143 **** } - function em_trigger_error($msg_text = '', $msg_code = 0, $msg_title = '', $err_line = '', $err_file = '', $sql = '') - { - message_die($msg_code, $msg_text, $msg_title, $err_line, $err_file, $sql); - } - function em_auth() { --- 135,138 ---- |
From: Eric F. <wg...@us...> - 2005-12-22 00:14:55
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22201 Modified Files: em_parser_xml.php Log Message: XML parser should work. If I missed any actions, tell me Index: em_parser_xml.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_parser_xml.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_parser_xml.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_parser_xml.php 22 Dec 2005 00:14:43 -0000 1.2 *************** *** 24,33 **** /** * Filename of the MOD begin parsed. */ var $mod_file; var $data = array(); var $parser; - var $XML; /** --- 24,60 ---- /** * Filename of the MOD begin parsed. + * @type string */ var $mod_file; + /** + * Valid MOD actions. + * @type array + */ + var $valid_actions = array(); + + /** + * Header parts from the MOD + * @type array + */ + var $header = array(); + + /** + * Actions for the MOD + * @type array + */ + var $actions = array(); + + /** + * Parsed XML file in an array + * @type array + */ var $data = array(); + + /** + * XML parser resource + * @type resource + */ var $parser; /** *************** *** 41,54 **** $this->mod_file = $mod_file; } ! function _parse() { ! global $io; ! if(empty($io)) ! { ! $io = new_io(); ! } ! ! $XML = $io->open_file($this->mod_file); $this->parser = xml_parser_create(); --- 68,75 ---- $this->mod_file = $mod_file; } ! function _parse() { ! $XML = open_file($this->mod_file); $this->parser = xml_parser_create(); *************** *** 59,64 **** $XML = str_replace('<', '<![CDATA[<]]>', $XML); $XML = str_replace('>', '<![CDATA[>]]>', $XML); ! $this->XML = xml_parse($this->parser, $XML); ! if(!$this->XML) { die(sprintf("XML error: %s at line %d (file: {$this->mod_file})", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser))); --- 80,84 ---- $XML = str_replace('<', '<![CDATA[<]]>', $XML); $XML = str_replace('>', '<![CDATA[>]]>', $XML); ! if(!xml_parse($this->parser, $XML)) { die(sprintf("XML error: %s at line %d (file: {$this->mod_file})", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser))); *************** *** 93,97 **** function _tag_closed($parser, $name) { ! $this->data[count($this->data)-2]['children'][$name] = $this->data[count($this->data)-1]; array_pop($this->data); } --- 113,117 ---- function _tag_closed($parser, $name) { ! $this->data[count($this->data)-2]['children'][$name][] = $this->data[count($this->data)-1]; array_pop($this->data); } *************** *** 107,133 **** } ! $mod_header = array(); ! $header_info = $this->data[0]['children']['HEADER']['children']; // Name and decription ! $mod_header['name'] = $header_info['TITLE']['data']; ! $mod_header['desc'] = $header_info['DESCRIPTION']['data']; // Version ! $version_info = $header_info['MOD-VERSION']['children']; ! $mod_header['version'] = $version_info['MAJOR']['data'] . '.' . $version_info['MINOR']['data'] . '.' . $version_info['REVISION']['data']; ! $mod_header['version'] = (isset($version_info['RELEASE']['data'])) ? $mod_header['version'] . $version_info['RELEASE']['data'] : $mod_header['version']; ! ! return $mod_header; ! } ! ! function parse_sql() ! { ! } function parse_actions() { } --- 127,223 ---- } ! $header_info = $this->data[0]['children']['HEADER'][0]['children']; // Name and decription ! // @TODO check lang attribute to see if it is the correct language ! $this->header['name'] = trim($header_info['TITLE'][0]['data']); ! $this->header['desc'] = trim($header_info['DESCRIPTION'][0]['data']); ! $this->header['author-notes'] = trim($header_info['AUTHOR-NOTES'][0]['data']); // Version ! $version_info = $header_info['MOD-VERSION'][0]['children']; ! $this->header['version'] = trim($version_info['MAJOR'][0]['data']) . '.' . trim($version_info['MINOR'][0]['data']) . '.' . trim($version_info['REVISION']['data']); ! $this->header['version'] = (isset($version_info['RELEASE'][0]['data'])) ? $this->header['version'] . $version_info['RELEASE'][0]['data'] : $this->header['version']; ! ! $author_info = $header_info['AUTHOR-GROUP'][0]['children']['AUTHOR']; ! for($i = 0, $total = sizeof($author_info); $i < $total; $i++) ! { ! $this->header['author'][] = array( ! 'username' => trim($author_info[$i]['children']['USERNAME'][0]['data']), ! 'email' => trim($author_info[$i]['children']['EMAIL'][0]['data']), ! 'realname' => trim($author_info[$i]['children']['REALNAME'][0]['data']), ! 'website' => trim($author_info[$i]['children']['HOMEPAGE'][0]['data'])); ! } ! ! return $this->header; } function parse_actions() { + $actions = $this->data[0]['children']['ACTION-GROUP'][0]['children']; + // sql + $sql_info = $actions['SQL']; + for( $i = 0, $total = sizeof($sql_info); $i < $total; $i++ ) + { + $this->actions['sql'][] = ( !empty($sql_info[$i]['data']) ) ? trim($sql_info[$i]['data']): ''; + } + + // copy + $copy_info = $actions['COPY']; + for( $i = 0, $total = sizeof($copy_info); $i < $total; $i++ ) + { + $copy_files = $copy_info[$i]['children']['FILE']; + for( $j = 0, $file_total = sizeof($copy_files); $j < $file_total; $j++ ) + { + $this->actions['copy'][] = array( + 'from' => str_replace('\\', '/', $copy_files[$j]['children']['FROM'][0]['data']), + 'to' => str_replace('\\', '/', $copy_files[$j]['children']['TO'][0]['data'])); + } + } + + // open + $open_info = $actions['OPEN']; + for( $i = 0, $total = sizeof($open_info); $i < $total; $i++ ) + { + $current_file = str_replace('\\', '/', trim($open_info[$i]['attrs']['SRC'])); + $this->actions['open'][$current_file] = array(); + + $edit_info = $open_info[$i]['children']['EDIT']; + for($j = 0, $edit_total = sizeof($edit_info); $j < $edit_total; $j++) + { + $action_info = $edit_info[$j]['children']; + $this->actions['open'][$current_file]['edit'][$j]['find'] = $action_info['FIND'][0]['data']; + + $actions = $action_info['ACTION']; + for($k = 0, $action_total = sizeof($actions); $k < $action_total; $k++) + { + $this->actions['open'][$current_file]['edit'][$j]['action'][] = array( + 'line' => 0, + 'type' => str_replace(',', '-', str_replace(' ', '', $actions[$k]['attrs']['TYPE'])), + 'code' => $actions[$k]['data'] + ); + } + + $inline_info = $action_info['INLINE-EDIT']; + for($k = 0, $inline_total = sizeof($inline_info); $k < $inline_total; $k++) + { + $inline_actions = $inline_info[$k]['children']; + + $this->actions['open'][$current_file]['edit'][$j]['in-line-edit'][$k]['in-line-find'] = $inline_actions['INLINE-FIND'][0]['data']; + + $actions = $inline_actions['INLINE-ACTION']; + for($x = 0, $actions_total = sizeof($actions); $x < $actions_total; $x++) + { + $type = str_replace(',', '-', str_replace(' ', '', $actions[$x]['attrs']['TYPE'])); + $this->actions['open'][$current_file]['edit'][$j]['in-line-edit'][$k]['in-line-action'][] = array( + 'line' => 0, + 'type' => (( $type != 'increment' ) ? 'in-line-' : '') . $type , + 'code' => $actions[$x]['data'] + ); + } + } + } + } } |
From: Eric F. <wg...@us...> - 2005-12-09 23:35:44
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12652 Modified Files: em_parser_text.php Log Message: File isn't loaded every time parse_header or parse_actions is called. Index: em_parser_text.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_parser_text.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_parser_text.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_parser_text.php 9 Dec 2005 23:35:33 -0000 1.2 *************** *** 55,59 **** */ var $header = array(); ! /** * Actions for the MOD --- 55,59 ---- */ var $header = array(); ! /** * Actions for the MOD *************** *** 63,66 **** --- 63,72 ---- /** + * MOD has been loaded + * @type bool + */ + var $mod_loaded; + + /** * Constructor * *************** *** 73,76 **** --- 79,83 ---- $this->mod_contents = array(); $this->mod_lines = 0; + $this->mod_loaded = false; /* *************** *** 111,118 **** function _load_mod() { ! global $io; ! if(empty($io)) { ! $io = new_io(); } --- 118,124 ---- function _load_mod() { ! if ( $this->mod_loaded === true ) { ! return true; } *************** *** 135,138 **** --- 141,145 ---- $this->mod_contents = preg_split("/\r?\n|\r/", $this->mod_contents); $this->mod_lines = count($this->mod_contents); + $this->mod_loaded = true; return true; } *************** *** 176,180 **** 'email' => $match[2], 'realname' => $match[3], ! 'website' => $match[4]); } else if ( $current_action == 'history' ) --- 183,187 ---- 'email' => $match[2], 'realname' => $match[3], ! 'website' => $match[4]); } else if ( $current_action == 'history' ) *************** *** 466,474 **** } - function parse_sql() - { - - } - // // Just implemented real quick, probably better way to do this. --- 473,476 ---- |
From: Eric F. <wg...@us...> - 2005-12-09 23:22:46
|
Update of /cvsroot/easymod/easymod/install/em_files/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9565/em_files/admin Modified Files: em_history.php em_manage.php Log Message: added install time to MOD table. Prep for uninstall ... still need to decide exactly how to do this Index: em_manage.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/admin/em_manage.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** em_manage.php 6 Dec 2005 23:55:06 -0000 1.2 --- em_manage.php 9 Dec 2005 23:22:37 -0000 1.3 *************** *** 483,486 **** --- 483,487 ---- $mod_file = str_replace("'", "''", htmlspecialchars(stripslashes($mod_file))); + $current_time = time(); $mod_name = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['name']))); $mod_version = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['version']))); *************** *** 493,498 **** add_log('EM_Log_install', $mod_name, $mod_version); ! $sql = 'INSERT INTO ' . EM_MODS_TABLE . "( mod_file, mod_name, mod_version, mod_author_username, mod_author_email, mod_author_realname, mod_author_website, mod_desc ) ! VALUES ('$mod_file', '$mod_name', '$mod_version', '$author_username', '$author_email', '$author_realname', '$author_realname', '$mod_desc' )"; if( !($result = $db->sql_query($sql)) ) { --- 494,499 ---- add_log('EM_Log_install', $mod_name, $mod_version); ! $sql = 'INSERT INTO ' . EM_MODS_TABLE . "( mod_file, mod_install_time, mod_name, mod_version, mod_author_username, mod_author_email, mod_author_realname, mod_author_website, mod_desc ) ! VALUES ('$mod_file', $current_time,'$mod_name', '$mod_version', '$author_username', '$author_email', '$author_realname', '$author_realname', '$mod_desc' )"; if( !($result = $db->sql_query($sql)) ) { *************** *** 667,670 **** --- 668,677 ---- elseif( $mode == 'uninstall' ) { + $mod_id = request_var('mod_id', 0); + if ( empty($mod_id) ) + { + redirect(append_sid("{$phpbb_root_path}admin/em_history.$phpEx")); + } + $step = request_var('step', 0); switch($step) *************** *** 681,685 **** //---------------------------------------------------------------------------------// ! // Updating (check) //---------------------------------------------------------------------------------// elseif( $mode == 'update' ) --- 688,692 ---- //---------------------------------------------------------------------------------// ! // Updating //---------------------------------------------------------------------------------// elseif( $mode == 'update' ) Index: em_history.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/admin/em_history.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_history.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_history.php 9 Dec 2005 23:22:37 -0000 1.2 *************** *** 32,37 **** $installed_mods = array(); $mods_count = 0; ! $sql = 'SELECT mod_id, mod_file, mod_name, mod_version, mod_desc, mod_styles ! FROM ' . EM_MODS_TABLE; if( !($result = $db->sql_query($sql)) ) { --- 32,38 ---- $installed_mods = array(); $mods_count = 0; ! $sql = 'SELECT mod_id, mod_file, mod_install_time, mod_name, mod_version, mod_desc, mod_styles ! FROM ' . EM_MODS_TABLE . ' ! ORDER BY mod_install_time DESC'; if( !($result = $db->sql_query($sql)) ) { *************** *** 56,69 **** // Show to page $template->assign_block_vars('installed_mods', array( ! 'S_MORE_INFO' => append_sid(basename(__FILE__) . '?mode=info&id=' . $row['mod_id']), ! 'S_UPDATE' => append_sid(basename(__FILE__) . '?mode=check_update&id=' . $row['mod_id']), ! 'S_UNINSTALL' => append_sid(basename(__FILE__) . '?mode=check_uninstall&id=' . $row['mod_id']), ! 'ROW_CLASS' => (!($mods_count % 2)) ? $theme['td_class1'] : $theme['td_class2'], ! 'MOD_STATUS_IMG' => $mod_status_img, ! 'MOD_STATUS_LANG' => $mod_status_lang, ! 'MOD_NAME' => $row['mod_name'], ! 'MOD_DESC' => str_cut($row['mod_desc'], 80), ! 'MOD_VERSION' => $row['mod_version'], ! 'MOD_STYLES' => '', )); $mods_count++; --- 57,71 ---- // Show to page $template->assign_block_vars('installed_mods', array( ! 'S_MORE_INFO' => append_sid("{$phpbb_root_path}admin/em_manage.$phpEx?mode=info&id=" . $row['mod_id']), ! 'S_UPDATE' => append_sid("{$phpbb_root_path}admin/em_history.$phpEx?mode=check_update&id=" . $row['mod_id']), ! 'S_UNINSTALL' => append_sid("{$phpbb_root_path}admin/em_manage.$phpEx?mode=uninstall&id=" . $row['mod_id']), ! 'ROW_CLASS' => (!($mods_count % 2)) ? $theme['td_class1'] : $theme['td_class2'], ! 'MOD_STATUS_IMG' => $mod_status_img, ! 'MOD_STATUS_LANG' => $mod_status_lang, ! 'MOD_INSTALL_TIME' => create_date($board_config['default_dateformat'], $row['mod_install_time'], $board_config['board_timezone']), ! 'MOD_NAME' => $row['mod_name'], ! 'MOD_DESC' => str_cut($row['mod_desc'], 80), ! 'MOD_VERSION' => $row['mod_version'], ! 'MOD_STYLES' => '', )); $mods_count++; *************** *** 80,93 **** // Misc. template vars $template->assign_vars(array( ! 'L_MANAGE' => $lang['EM_History'], ! 'L_MANAGE_EXPLAIN' => $lang['EM_History_explain'], ! 'L_INSTALLED_MODS' => $lang['EM_Installed_mods'], ! 'L_MOD_STATUS' => $lang['EM_Mod_status'], ! 'L_MOD_NAME' => $lang['EM_Mod_name'], ! 'L_MOD_DESCRIPTION' => $lang['EM_Mod_description'], ! 'L_MOD_VERSION' => $lang['EM_Mod_version'], ! 'L_MORE_INFO' => $lang['EM_More_info'], ! 'L_UPDATE' => $lang['EM_Update'], ! 'L_UNINSTALL' => $lang['EM_Uninstall'], )); --- 82,96 ---- // Misc. template vars $template->assign_vars(array( ! 'L_MANAGE' => $lang['EM_History'], ! 'L_MANAGE_EXPLAIN' => $lang['EM_History_explain'], ! 'L_INSTALLED_MODS' => $lang['EM_Installed_mods'], ! 'L_MOD_STATUS' => $lang['EM_Mod_status'], ! 'L_MOD_INSTALL_TIME' => $lang['EM_Mod_install_time'], ! 'L_MOD_NAME' => $lang['EM_Mod_name'], ! 'L_MOD_DESCRIPTION' => $lang['EM_Mod_description'], ! 'L_MOD_VERSION' => $lang['EM_Mod_version'], ! 'L_MORE_INFO' => $lang['EM_More_info'], ! 'L_UPDATE' => $lang['EM_Update'], ! 'L_UNINSTALL' => $lang['EM_Uninstall'], )); |
From: Eric F. <wg...@us...> - 2005-12-09 23:22:46
|
Update of /cvsroot/easymod/easymod/install/schemas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9565/schemas Modified Files: easymod_mysql.sql Log Message: added install time to MOD table. Prep for uninstall ... still need to decide exactly how to do this Index: easymod_mysql.sql =================================================================== RCS file: /cvsroot/easymod/easymod/install/schemas/easymod_mysql.sql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** easymod_mysql.sql 4 Dec 2005 03:12:30 -0000 1.1 --- easymod_mysql.sql 9 Dec 2005 23:22:37 -0000 1.2 *************** *** 1,3 **** --- 1,5 ---- + # $Id$ + ALTER TABLE `phpbb_sessions` ADD `session_em` TINYINT(1) DEFAULT '0' NOT NULL; *************** *** 13,16 **** --- 15,19 ---- `mod_id` mediumint(8) NOT NULL auto_increment, `mod_file` varchar(255) NOT NULL default '', + `mod_install_time` INT(11) NOT NULL `mod_name` varchar(255) NOT NULL default '', `mod_version` varchar(100) NOT NULL default '', |
From: Eric F. <wg...@us...> - 2005-12-09 23:22:46
|
Update of /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9565/em_files/templates/subSilver/admin Modified Files: em_manage_history.tpl Log Message: added install time to MOD table. Prep for uninstall ... still need to decide exactly how to do this Index: em_manage_history.tpl =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin/em_manage_history.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_manage_history.tpl 4 Dec 2005 03:12:30 -0000 1.1 --- em_manage_history.tpl 9 Dec 2005 23:22:37 -0000 1.2 *************** *** 14,21 **** <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> <tr> ! <th class="thHead" colspan="7">{L_INSTALLED_MODS}</th> </tr> <tr> <td width="50" class="catLeft" align="center" valign="middle"><span class="gen"><b>{L_MOD_STATUS}</b></span></td> <td width="150" class="cat" align="center" valign="middle"><span class="gen"><b>{L_MOD_NAME}</b></span></td> <td class="cat" align="center" valign="middle"><span class="gen"><b>{L_MOD_DESCRIPTION}</b></span></td> --- 14,22 ---- <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> <tr> ! <th class="thHead" colspan="8">{L_INSTALLED_MODS}</th> </tr> <tr> <td width="50" class="catLeft" align="center" valign="middle"><span class="gen"><b>{L_MOD_STATUS}</b></span></td> + <td width="110" class="cat" align="center" valign="middle"><span class="gen"><b>{L_MOD_INSTALL_TIME}</b></span></td> <td width="150" class="cat" align="center" valign="middle"><span class="gen"><b>{L_MOD_NAME}</b></span></td> <td class="cat" align="center" valign="middle"><span class="gen"><b>{L_MOD_DESCRIPTION}</b></span></td> *************** *** 28,31 **** --- 29,33 ---- <tr> <td class="{installed_mods.ROW_CLASS}" align="center" valign="middle"><span class="gen"><img src="../{installed_mods.MOD_STATUS_IMG}" title="{installed_mods.MOD_STATUS_LANG}" alt="{installed_mods.MOD_STATUS_LANG}" border="0" /></span></td> + <td class="{installed_mods.ROW_CLASS}" align="center" valign="middle"><span class="gen">{installed_mods.MOD_INSTALL_TIME}</span></td> <td class="{installed_mods.ROW_CLASS}" align="center" valign="middle"><span class="gen">{installed_mods.MOD_NAME}</span></td> <td height="40" class="{installed_mods.ROW_CLASS}" align="center" valign="middle"><span class="gen">{installed_mods.MOD_DESC}</span></td> *************** *** 38,46 **** <!-- BEGIN no_installed_mods --> <tr> ! <td class="row2" colspan="7" align="center" valign="middle"><span class="gen">{no_installed_mods.L_NO_INSTALLED_MODS}</span></td> </tr> <!-- END no_installed_mods --> <tr> ! <td class="catBottom" colspan="7" height="28"> </td> </tr> </table> --- 40,48 ---- <!-- BEGIN no_installed_mods --> <tr> ! <td class="row2" colspan="8" align="center" valign="middle"><span class="gen">{no_installed_mods.L_NO_INSTALLED_MODS}</span></td> </tr> <!-- END no_installed_mods --> <tr> ! <td class="catBottom" colspan="8" height="28"> </td> </tr> </table> |
From: Eric F. <wg...@us...> - 2005-12-09 23:22:45
|
Update of /cvsroot/easymod/easymod/install/em_files/language/lang_english In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9565/em_files/language/lang_english Modified Files: lang_easymod.php Log Message: added install time to MOD table. Prep for uninstall ... still need to decide exactly how to do this Index: lang_easymod.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/language/lang_english/lang_easymod.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lang_easymod.php 7 Dec 2005 00:11:18 -0000 1.2 --- lang_easymod.php 9 Dec 2005 23:22:37 -0000 1.3 *************** *** 49,52 **** --- 49,53 ---- $lang['EM_Status_style'] = 'Style Update Needed'; $lang['EM_Mod_info'] = 'MOD Information'; + $lang['EM_Mod_install_time'] = 'MOD Install Time'; $lang['EM_Mod_name'] = 'MOD Name'; $lang['EM_Mod_description'] = 'MOD Description'; |
From: Eric F. <wg...@us...> - 2005-12-09 23:22:45
|
Update of /cvsroot/easymod/easymod/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9565 Modified Files: em_install.php Log Message: added install time to MOD table. Prep for uninstall ... still need to decide exactly how to do this Index: em_install.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_install.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_install.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_install.php 9 Dec 2005 23:22:37 -0000 1.2 *************** *** 248,252 **** $files[] = array('to' => './../includes/em/em_acp_menu.php', 'from' => './../install/em_files/includes/em/em_acp_menu.php'); $files[] = array('to' => './../includes/em/em_functions_20x.php', 'from' => './../install/em_files/includes/em/em_functions_20x.php'); ! $files[] = array('to' => './../includes/em/em_mcrypt.php', 'from' => './../install/em_files/includes/em/em_mcrypt.php'); $files[] = array('to' => './../includes/em/em_parser_text.php', 'from' => './../install/em_files/includes/em/em_parser_text.php'); //$files[] = array('to' => './../includes/em/em_functions_30x.php', 'from' => './../install/em_files/includes/em/em_functions_30x.php'); --- 248,252 ---- $files[] = array('to' => './../includes/em/em_acp_menu.php', 'from' => './../install/em_files/includes/em/em_acp_menu.php'); $files[] = array('to' => './../includes/em/em_functions_20x.php', 'from' => './../install/em_files/includes/em/em_functions_20x.php'); ! $files[] = array('to' => './../includes/em/em_crypt.php', 'from' => './../install/em_files/includes/em/em_crypt.php'); $files[] = array('to' => './../includes/em/em_parser_text.php', 'from' => './../install/em_files/includes/em/em_parser_text.php'); //$files[] = array('to' => './../includes/em/em_functions_30x.php', 'from' => './../install/em_files/includes/em/em_functions_30x.php'); *************** *** 264,267 **** --- 264,268 ---- $files[] = array('to' => './../templates/subSilver/admin/em_login.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_login.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_check_sql.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_check_sql.tpl'); + $files[] = array('to' => './../templates/subSilver/admin/em_help_popup.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_help_popup.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_mod_info.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_mod_info.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_post_process.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_post_process.tpl'); |
From: Eric F. <wg...@us...> - 2005-12-07 00:32:10
|
Update of /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17222 Added Files: em_help_popup.tpl Log Message: I guess I should add this file ... --- NEW FILE: em_help_popup.tpl --- <table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> <tr> <td class="bodyline" width="100%"> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th>{TITLE}</th> </tr> <!-- BEGIN help_row --> <tr> <td class="cat"><span class="cattitle"><a name="{help_row.NAME}"></a>{help_row.TITLE}</span></td> </tr> <tr> <td class="{help_row.ROW_CLASS}"><span class="gen">{help_row.DESC}><br /><br /><a href="javascript:window.close();">{L_CLOSE_WINDOW}</a></span></td> </tr> <tr> <td class="spaceRow" height="1"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td> </tr> <!-- END help_row --> </table> </td> </tr> <tr> <td><p class="copyright" align="center"><a href="http://www.phpbb.com/" class="copyright">EasyMOD</a> © 2005 phpBB Group</p></td> </tr> </table> |
From: Eric F. <wg...@us...> - 2005-12-07 00:31:34
|
Update of /cvsroot/easymod/easymod/install/em_files/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17083/admin Modified Files: em_general.php Log Message: Added the help popup to the ACP settings page Index: em_general.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/admin/em_general.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_general.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_general.php 7 Dec 2005 00:31:20 -0000 1.2 *************** *** 1,8 **** <?php ! /** * * @package EasyMOD * @version $Id$ ! * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * --- 1,8 ---- <?php ! /** * * @package EasyMOD * @version $Id$ ! * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * *************** *** 18,21 **** --- 18,50 ---- include($phpbb_root_path . 'includes/em/em_common.'.$phpEx); + $help = request_var('help', ''); + if ( !empty($help) ) + { + $template->set_filenames(array( + 'body' => 'admin/em_help_popup.tpl') + ); + + $template->assign_vars(array( + 'L_TITLE' => $lang['EM_Help'], + 'L_CLOSE_WINDOW' => $lang['Close_window']) + ); + + $i = 0; + foreach($lang['EM_Help_topics'] as $name => $values) + { + $row_class = ( $i % 2 ) ? 'row1' : 'row2'; + $template->assign_block_vars('help_row', array( + 'ROW_CLASS' => $row_class, + 'NAME' => $name, + 'TITLE' => $values['title'], + 'DESC' => nl2br($values['desc'])) + ); + + $i++; + } + + $template->pparse('body'); + exit; + } // *************** *** 69,73 **** message_die(GENERAL_MESSAGE, $message); } ! $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . md5($pass) . "' --- 98,102 ---- message_die(GENERAL_MESSAGE, $message); } ! $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . md5($pass) . "' *************** *** 101,106 **** // Template Vars $template->assign_vars(array( ! 'S_PASSWORD_ACTION' => append_sid(basename(__FILE__) . '?update=pass'), ! 'S_SETTINGS_ACTION' => append_sid(basename(__FILE__) . '?update=settings'), 'L_GENERAL' => $lang['EM_General'], --- 130,137 ---- // Template Vars $template->assign_vars(array( ! 'U_HELP_POPUP' => append_sid($phpbb_root_path . 'admin/em_general.'.$phpEx.'?help=1', true), ! ! 'S_PASSWORD_ACTION' => append_sid($phpbb_root_path . 'admin/em_general.'.$phpEx.'?update=pass'), ! 'S_SETTINGS_ACTION' => append_sid($phpbb_root_path . 'admin/em_general.'.$phpEx.'?update=settings'), 'L_GENERAL' => $lang['EM_General'], *************** *** 112,117 **** 'L_METHOD' => $lang['EM_method'], 'L_TEMP_PATH' => $lang['EM_temp_path'], - 'L_FILE_PERM' => $lang['EM_file_perm'], - 'L_DIR_PERM' => $lang['EM_dir_perm'], 'L_FTP_SETTINGS' => $lang['EM_ftp_conn'], 'L_FTP_USER' => $lang['EM_ftp_user'], --- 143,146 ---- *************** *** 124,135 **** 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], ! 'L_MOD_DIR' => $lang['EM_Mod_dir'], 'L_MOD_DIR_EXPLAIN' => $lang['EM_Mod_dir_explain'], ! 'EM_METHODS' => $allowed_methods, 'EM_TEMP_PATH' => $board_config['em_tmp_path'], - 'EM_FILE_PERM' => $board_config['em_file_perms'], - 'EM_DIR_PERM' => $board_config['em_dir_perms'], 'EM_MOD_DIR' => $board_config['em_mod_dir'], 'EM_FTP_USER' => $board_config['em_ftp_user'], --- 153,162 ---- 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], ! 'L_MOD_DIR' => $lang['EM_Mod_dir'], 'L_MOD_DIR_EXPLAIN' => $lang['EM_Mod_dir_explain'], ! 'EM_METHODS' => $allowed_methods, 'EM_TEMP_PATH' => $board_config['em_tmp_path'], 'EM_MOD_DIR' => $board_config['em_mod_dir'], 'EM_FTP_USER' => $board_config['em_ftp_user'], |
From: Eric F. <wg...@us...> - 2005-12-07 00:31:30
|
Update of /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17083/templates/subSilver/admin Modified Files: em_general.tpl Log Message: Added the help popup to the ACP settings page Index: em_general.tpl =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin/em_general.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_general.tpl 4 Dec 2005 03:12:30 -0000 1.1 --- em_general.tpl 7 Dec 2005 00:31:20 -0000 1.2 *************** *** 1,2 **** --- 1,11 ---- + <script language="javascript"> + <!-- + function help_popup(item) + { + window.open('{U_HELP_POPUP}#' + item, 'help', 'width=600,height=500,resizable=yes,toolbar=no,scrollbars=yes,location=no,directories=no,status=no,menubar=no,copyhistory=no'); + } + --> + </script> + <h1>{L_EASYMOD} - {L_GENERAL}</h1> *************** *** 32,48 **** <tr> <td class="row1">{L_METHOD}</td> ! <td class="row1"><span class="gen">{EM_METHODS} <a href="javascript:help_popup('write_move_methods');">Help</a></span></td> </tr> <tr> <td class="row1">{L_TEMP_PATH}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_tmp_path" value="{EM_TEMP_PATH}" class="post" /> <a href="javascript:help_popup('tmp_path');">Help</a></span></td> ! </tr> ! <tr> ! <td class="row1">{L_FILE_PERM}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_file_perms" value="{EM_FILE_PERM}" class="post" /> <a href="javascript:help_popup('file_perms');">Help</a></span></td> ! </tr> ! <tr> ! <td class="row1">{L_DIR_PERM}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_dir_perms" value="{EM_DIR_PERM}" class="post" /> <a href="javascript:help_popup('dir_perms');">Help</a></span></td> </tr> <tr> --- 41,49 ---- <tr> <td class="row1">{L_METHOD}</td> ! <td class="row2"><span class="gen">{EM_METHODS} <a href="javascript:help_popup('write_move_methods');">Help</a></span></td> </tr> <tr> <td class="row1">{L_TEMP_PATH}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_tmp_path" value="{EM_TEMP_PATH}" class="post" /> <a href="javascript:help_popup('tmp_path');">Help</a></span></td> </tr> <tr> *************** *** 51,75 **** <tr> <td class="row1">{L_FTP_USER}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_ftp_username" class="post" value="{EM_FTP_USER}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PASS}</td> ! <td class="row1"><span class="gen"><input type="password" name="em_ftp_password" class="post" /></span></td> </tr> <tr> <td class="row1">{L_FTP_HOST}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_ftp_host" class="post" value="{EM_FTP_HOST}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PATH}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_ftp_root_path" class="post" value="{EM_FTP_PATH}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PORT}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_ftp_port" value="{EM_FTP_PORT}" class="post" /></span></td> </tr> <tr> <td class="row1">{L_FTP_TIME}</td> ! <td class="row1"><span class="gen"><input type="text" name="em_ftp_timeout" value="{EM_FTP_TIME}" class="post" /></span></td> </tr> <tr> --- 52,76 ---- <tr> <td class="row1">{L_FTP_USER}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_ftp_username" class="post" value="{EM_FTP_USER}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PASS}</td> ! <td class="row2"><span class="gen"><input type="password" name="em_ftp_password" class="post" /></span></td> </tr> <tr> <td class="row1">{L_FTP_HOST}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_ftp_host" class="post" value="{EM_FTP_HOST}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PATH}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_ftp_root_path" class="post" value="{EM_FTP_PATH}" /></span></td> </tr> <tr> <td class="row1">{L_FTP_PORT}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_ftp_port" value="{EM_FTP_PORT}" class="post" /></span></td> </tr> <tr> <td class="row1">{L_FTP_TIME}</td> ! <td class="row2"><span class="gen"><input type="text" name="em_ftp_timeout" value="{EM_FTP_TIME}" class="post" /></span></td> </tr> <tr> |
From: Eric F. <wg...@us...> - 2005-12-07 00:11:26
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12652/includes/em Modified Files: em_methods_ftp_fsock.php Log Message: FTP fsock function should work now Index: em_methods_ftp_fsock.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_methods_ftp_fsock.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_methods_ftp_fsock.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_methods_ftp_fsock.php 7 Dec 2005 00:11:18 -0000 1.2 *************** *** 49,54 **** function em_method_ftp_fsock() { ! global $board_config, $crypt; ! $key = ''; for($i = 1, $total = strlen($board_config['em_pass']); $i < $total; $i = round(($i+1)*2)) --- 49,54 ---- function em_method_ftp_fsock() { ! global $board_config, $crypt; ! $key = ''; for($i = 1, $total = strlen($board_config['em_pass']); $i < $total; $i = round(($i+1)*2)) *************** *** 56,60 **** $key .= md5($board_config['em_pass']{$i}); } - $this->host = $board_config['em_ftp_host']; $this->port = $board_config['em_ftp_port']; --- 56,59 ---- *************** *** 62,69 **** $this->password = $crypt->decrypt($board_config['em_ftp_password'], $key); $this->timeout = $board_config['em_ftp_timeout']; ! $this->root_path = $board_config['em_ftp_root_path']; $this->tmp_path = $board_config['em_tmp_path']; ! $this->file_perms = $board_config['em_file_perms']; ! $this->dir_perms = $board_config['em_dir_perms']; $this->debug = false; --- 61,68 ---- $this->password = $crypt->decrypt($board_config['em_ftp_password'], $key); $this->timeout = $board_config['em_ftp_timeout']; ! $this->root_path = (( $board_config['em_ftp_root_path']{0} != '/' ) ? '/' : '') . ( substr($board_config['em_ftp_root_path'], -1, 1) == '/' ) ? substr($board_config['em_ftp_root_path'], 0, -1) : $board_config['em_ftp_root_path']; $this->tmp_path = $board_config['em_tmp_path']; ! $this->file_perms = 644; ! $this->dir_perms = 777; $this->debug = false; *************** *** 108,151 **** return true; } - - function open_file($file = '') - { - if(file_exists($file)) - { - if(function_exists('file_get_contents')) - { - $contents = file_get_contents($file); - } - else - { - $contents = implode('', file($file)); - } - } - else - { - // ERROR, file doesn't exsist - } - - if(empty($contents)) - { - // ERROR, read error or file empty - } - else - { - return $contents; - } - } function write_file($file = '', $contents = '') { ! if ( empty($file) ) ! { ! $file = $this->cur_file; ! } ! ! if ( empty($contents) ) ! { ! $contents = $this->files[$file]; ! } // need to create a temp file and then move that temp file. --- 107,116 ---- return true; } function write_file($file = '', $contents = '') { ! global $phpbb_root_path; ! ! $file = $this->root_path . '/' .str_replace($phpbb_root_path, '', $file); // need to create a temp file and then move that temp file. *************** *** 155,167 **** // like the cache folder. If the user can't do either, then // he/she needs to use the fsock ftp method ! $temp_name = tempnam($this->tmp_path, 'em_'); ! $file_resource = fopen($temp_name, 'w'); ! fwrite($file_resource, $contents); ! fclose($file_resource); $err = $this->_put($temp_name, $file); $this->_chmod($file, $this->file_perms); ! unlink($temp_name); return $err; --- 120,132 ---- // like the cache folder. If the user can't do either, then // he/she needs to use the fsock ftp method ! $temp_name = @tempnam($this->tmp_path, 'em_'); ! $file_resource = @fopen($temp_name, 'w'); ! @fwrite($file_resource, $contents); ! @fclose($file_resource); $err = $this->_put($temp_name, $file); $this->_chmod($file, $this->file_perms); ! @unlink($temp_name); return $err; *************** *** 170,188 **** function make_dir($dir) { $dir = explode('/', $dir); for($i = 0, $total = count($dir); $i < count($dir); $i++) { $cur_dir = $dir[$i] . '/'; ! if ( !file_exists($cur_dir) ) { // make the directory ! @ftp_mkdir($this->connection, $dir[$i]); $this->_chmod($dir[$i], $this->dir_perms); } ! $this->_chdir($dir[$i]); } ! $this->_chdir(); ! ! return; } --- 135,161 ---- function make_dir($dir) { + global $phpbb_root_path; + $dir = explode('/', $dir); + $dirs = ''; for($i = 0, $total = count($dir); $i < count($dir); $i++) { + $result = true; + if ( $dir[$i] == '..' || $dir[$i] == '.' ) + { + continue; + } $cur_dir = $dir[$i] . '/'; ! if ( !file_exists($phpbb_root_path . $dirs . $cur_dir) ) { // make the directory ! $result = $this->_mkdir($dir[$i]); $this->_chmod($dir[$i], $this->dir_perms); } ! $this->_chdir($this->root_path . '/' . $dirs . $dir[$i]); ! $dirs .= $cur_dir; } ! $this->_chdir($this->root_path); ! return $result; } *************** *** 190,201 **** { global $phpbb_root_path; ! $to_loc = $this->root_path . '/' . str_replace($phpbb_root_path, '', $to_loc); ! $from_loc = $this->root_path . str_replace('//', '/', str_replace('./', '/', str_replace('../', '/', $from_loc))); ! // copy the file $err = $this->_put($from_loc, $to_loc); $this->_chmod($to_loc, $this->file_perms); ! return $err; } --- 163,175 ---- { global $phpbb_root_path; ! ! $from_loc = (( !strstr($from_loc, $phpbb_root_path) ) ? $phpbb_root_path : '') . $from_loc; $to_loc = $this->root_path . '/' . str_replace($phpbb_root_path, '', $to_loc); ! // copy the file + $this->_delete($to_loc); $err = $this->_put($from_loc, $to_loc); $this->_chmod($to_loc, $this->file_perms); ! return $err; } *************** *** 375,381 **** } - // delete the old file and then move on - $this->_delete($remotefile); - $this->_putcmd("STOR", $remotefile); --- 349,352 ---- |
From: Eric F. <wg...@us...> - 2005-12-07 00:11:26
|
Update of /cvsroot/easymod/easymod/install/em_files/language/lang_english In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12652/language/lang_english Modified Files: lang_easymod.php Log Message: FTP fsock function should work now Index: lang_easymod.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/language/lang_english/lang_easymod.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lang_easymod.php 4 Dec 2005 03:12:30 -0000 1.1 --- lang_easymod.php 7 Dec 2005 00:11:18 -0000 1.2 *************** *** 148,151 **** --- 148,153 ---- $lang['EM_ftp_php'] = 'FTP (php extension)'; $lang['EM_ftp_extension'] = 'php FTP Extension'; + $lang['EM_ftp_fsock'] = 'FTP (fsock)'; + $lang['EM_fsock_func'] = 'fsock allowed'; // help information |
From: Eric F. <wg...@us...> - 2005-12-06 23:55:17
|
Update of /cvsroot/easymod/easymod/install/em_files/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5656/admin Modified Files: em_manage.php Log Message: - DIY INSTRUCTIONS is now in the processed list on step two - commiting the SQL template which it looks like I missed Index: em_manage.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/admin/em_manage.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_manage.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_manage.php 6 Dec 2005 23:55:06 -0000 1.2 *************** *** 233,237 **** for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { ! display_mod_action('unprocessed', $action, $action_data[$i]); } break; --- 233,237 ---- for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { ! display_mod_action('processed', $action, $action_data[$i]); } break; |
From: Eric F. <wg...@us...> - 2005-12-06 23:55:17
|
Update of /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5656/templates/subSilver/admin Modified Files: em_check_sql.tpl Log Message: - DIY INSTRUCTIONS is now in the processed list on step two - commiting the SQL template which it looks like I missed Index: em_check_sql.tpl =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/templates/subSilver/admin/em_check_sql.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_check_sql.tpl 4 Dec 2005 03:12:30 -0000 1.1 --- em_check_sql.tpl 6 Dec 2005 23:55:06 -0000 1.2 *************** *** 5,12 **** <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> <tr> ! <th class="thHead" colspan="2">{L_SQL_INFO}</th> </tr> <tr> ! <td class="row1">Skipping Sql</td> <tr> <td class="catbottom" colspan="2">{S_HIDDEN_FIELDS}<input type="submit" value="{L_CONTINUE}" class="mainoption" /> --- 5,17 ---- <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> <tr> ! <th class="thLeft" width="90%">{L_SQL_QUERY}</th> ! <th class="thRight" width="10%">{L_SQL_STATUS}</th> </tr> + <!-- BEGIN sql_row --> <tr> ! <td class="row1"><span class="gen">{sql_row.SQL}</span></td> ! <td class="row2" align="center">{sql_row.S_HIDDEN_FIELDS}{sql_row.STATUS}</td> ! </tr> ! <!-- END sql_row --> <tr> <td class="catbottom" colspan="2">{S_HIDDEN_FIELDS}<input type="submit" value="{L_CONTINUE}" class="mainoption" /> |
From: Eric F. <wg...@us...> - 2005-12-06 23:41:25
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3720 Modified Files: em_crypt.php Log Message: updating encryption methods to what is in the current release. Index: em_crypt.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_crypt.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** em_crypt.php 4 Dec 2005 03:12:30 -0000 1.1 --- em_crypt.php 6 Dec 2005 23:41:07 -0000 1.2 *************** *** 528,532 **** { $this->setkey($key); ! $encrypted = ''; --- 528,532 ---- { $this->setkey($key); ! $encrypted = ''; *************** *** 549,556 **** // added by Nuttzy - we'll be storing the result in a DB so we need to replace ' with \' ! $encrypted = addslashes($encrypted) ; // TAKE TWO: the way General Config settings work in phpBB, this isn't sufficient, get rid of the ' all together ! $encrypted = str_replace("\'", "NUTTICK", $encrypted); ! $encrypted = str_replace("\n", 'NUTLINE', $encrypted); // NOTE: a cipher of "single'quote" (the cipher is the stuff between the double quotes) has the ' changed --- 549,556 ---- // added by Nuttzy - we'll be storing the result in a DB so we need to replace ' with \' ! // $encrypted = addslashes($encrypted); // TAKE TWO: the way General Config settings work in phpBB, this isn't sufficient, get rid of the ' all together ! // $encrypted = str_replace("\'", 'NUTTICK', $encrypted); ! // $encrypted = str_replace("\n", 'NUTLINE', $encrypted); // NOTE: a cipher of "single'quote" (the cipher is the stuff between the double quotes) has the ' changed *************** *** 558,568 **** // all just so the string is formed properly and what actually gets stored in the DB is "single'quote". The // same is true for any slashes that get added. The slashes won't actually show up when viewing the DB ;-) - - // change encoding for storage (postgres problems) - $encrypted = @utf8_encode($encrypted); - - return $encrypted ; - } // decrypts the cipher a chunk at a time and returns the plaintext --- 558,568 ---- // all just so the string is formed properly and what actually gets stored in the DB is "single'quote". The // same is true for any slashes that get added. The slashes won't actually show up when viewing the DB ;-) + // TAKE THREE: Hopefully the new hex2bin/bin2hex methods solve all these problems. + // change encoding for storage (postgres problems with binary string) + $encrypted = $this->bin2hex($encrypted); + + return $encrypted; + } // decrypts the cipher a chunk at a time and returns the plaintext *************** *** 570,580 **** { $this->setkey($key); ! ! // decode for use (postgres storage problems) ! $ciphertext = @utf8_decode($ciphertext); // TAKE TWO: the way General Config settings work in phpBB, this isn't sufficient, get rid of the ' all together ! $ciphertext = str_replace('NUTTICK', "'", $ciphertext); ! $ciphertext = str_replace('NUTLINE', "\n", $ciphertext); $decrypted = ''; --- 570,581 ---- { $this->setkey($key); ! ! // TAKE THREE: Hopefully the new hex2bin/bin2hex methods solve all these problems. ! // decode for use (postgres storage problems with binary string) ! $ciphertext = $this->hex2bin($ciphertext); // TAKE TWO: the way General Config settings work in phpBB, this isn't sufficient, get rid of the ' all together ! // $ciphertext = str_replace('NUTTICK', "'", $ciphertext); ! // $ciphertext = str_replace('NUTLINE', "\n", $ciphertext); $decrypted = ''; *************** *** 594,598 **** $decrypted = substr($decrypted, 0, -1); } ! return $decrypted; } --- 595,599 ---- $decrypted = substr($decrypted, 0, -1); } ! return $decrypted; } *************** *** 608,611 **** --- 609,632 ---- return; } + + // convert a binary string into an hexadecimal string + function bin2hex($bin) + { + for( $hex = '', $i = 0, $length = strlen($bin); $i < $length; $i++ ) + { + $hex .= substr('0' . dechex(ord($bin[$i])), -2); + } + return $hex; + } + + // convert an hexadecimal string into a binary string + function hex2bin($hex) + { + for( $bin = '', $i = 0, $length = strlen($hex); $i < $length; $i=$i+2 ) + { + $bin .= chr(hexdec(substr($hex, $i, 2))); + } + return $bin; + } } |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:42
|
Update of /cvsroot/easymod/easymod/install/em_files/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install/em_files/admin Added Files: admin_easymod.php em_general.php em_history.php em_logs.php em_manage.php index.htm Log Message: First commit to SourceForge. Enjoy! --- NEW FILE: em_logs.php --- <?php /** * * @package EasyMOD * @version $Id: em_logs.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // // Start System // define('IN_PHPBB', 1); $phpbb_root_path = './../'; $em_page = basename(__FILE__); require($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'includes/em/em_common.'.$phpEx); // // URL used to get information about IP Addresses // $u_ip_info = 'http://www.dnsstuff.com/tools/whois.ch?ip=%s'; // // Get processing arguments // $deletemark = ( isset($HTTP_POST_VARS['delmarked']) ? true : false ); $deleteall = ( isset($HTTP_POST_VARS['delall']) ? true : false ); $marked = ( isset($HTTP_POST_VARS['mark']) ? array_map('intval', $HTTP_POST_VARS['mark']) : 0 ); $start = request_var('start', 0); $sort_days = request_var('st', 0); $sort_key = request_var('sk', ''); $sort_dir = request_var('sd', ''); // // Delete entries if requested and able // if( $deleteall || ($deletemark && is_array($marked) && count($marked) > 0) ) { $sql = 'DELETE FROM ' . EM_LOGS_TABLE . ( ($deletemark) ? (' WHERE log_id IN (' . implode(', ', $marked) . ')') : '' ); if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete log events(s)', '', __LINE__, __FILE__, $sql); } add_log('EM_Log_event_cleared'); } // // Build sort selects // $sort_days_ary = array('EM_All_Events' => 0, '1_Day' => 1, '7_Days' => 7, '2_Weeks' => 14, '1_Month' => 30, '3_Months' => 90, '6_Months' => 180, '1_Year' => 365); $s_limit_days = '<select name="st">'; foreach( $sort_days_ary as $lang_key => $days ) { $selected = ( $sort_days == $days ) ? ' selected="selected"' : ''; $s_limit_days .= '<option value="' . $days . '"' . $selected . '>' . $lang[$lang_key] . '</option>'; } $s_limit_days .= '</select>'; $sort_keys_ary = array( 'u' => array('lang' => 'Username', 'sql' => 'u.username'), 't' => array('lang' => 'Date', 'sql' => 'l.log_time'), 'i' => array('lang' => 'IP_Address', 'sql' => 'l.log_ip') ); if( !in_array($sort_key, array_keys($sort_keys_ary)) ) { $sort_key = 't'; } $s_sort_key = '<select name="sk">'; foreach( $sort_keys_ary as $key => $data ) { $selected = ( $sort_key == $key ) ? ' selected="selected"' : ''; $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $lang[$data['lang']] . '</option>'; } $s_sort_key .= '</select>'; if( $sort_dir != 'a' && $sort_dir != 'd' ) { $sort_dir = 'd'; } $s_sort_dir = '<select name="sd">'; $s_sort_dir .= '<option value="a"' . ( $sort_dir == 'a' ? ' selected="selected"' : '') . '>' . $lang['Sort_Ascending'] . '</option>'; $s_sort_dir .= '<option value="d"' . ( $sort_dir == 'd' ? ' selected="selected"' : '') . '>' . $lang['Sort_Descending'] . '</option>'; $s_sort_dir .= '</select>'; // Define where and sort sql for use in displaying logs $limit_days = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; $sort_by = $sort_keys_ary[$sort_key]['sql'] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); // Define parameters for use in pagination URLs $u_sort_param = "st=$sort_days&sk=$sort_key&sd=$sort_dir"; $events_per_page = $board_config['topics_per_page']; // // Grab log events // $log_rows = array(); $total_events = 0; view_log($log_rows, $total_events, $start, $events_per_page, $limit_days, $sort_by); $log_count = count($log_rows); // // Let's report them... // $template->set_filenames(array( 'body' => 'admin/em_logs.tpl') ); if( $log_count <= 0 ) { $template->assign_block_vars('no_events', array()); } else { for( $i = 0; $i < $log_count; $i++ ) { $template->assign_block_vars('logrow', array( 'ROW_CLASS' => ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'], 'U_PROFILE' => append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $log_rows[$i]['user_id']), 'USERNAME' => $log_rows[$i]['username'], 'U_IP_INFO' => sprintf($u_ip_info, $log_rows[$i]['ip']), 'IP' => $log_rows[$i]['ip'], 'DATE' => $log_rows[$i]['time'], 'MESSAGE' => $log_rows[$i]['message'], 'ID' => $log_rows[$i]['id'] )); } $template->assign_vars(array( 'PAGINATION' => generate_pagination($phpbb_root_path . "admin/$em_page?$u_sort_param", $total_events, $events_per_page, $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $events_per_page ) + 1 ), ceil( $total_events / $events_per_page )) )); } // // Setup template vars. // $template->assign_vars(array( 'L_LOGS' => $lang['EM_Logs'], 'L_LOGS_EXPLAIN' => $lang['EM_Logs_explain'], 'L_DISPLAY_LOG' => $lang['EM_Display_events'], 'S_LIMIT_DAYS' => $s_limit_days, 'L_SORT_BY' => $lang['Sort_by'], 'S_SORT_KEY' => $s_sort_key, 'S_SORT_DIR' => $s_sort_dir, 'L_GO' => $lang['Go'], 'L_USERNAME' => $lang['Username'], 'L_IP' => $lang['IP_Address'], 'L_TIME' => $lang['Time'], 'L_ACTION' => $lang['Action'], 'L_MARK' => $lang['Mark'], 'L_NO_EVENTS' => $lang['EM_No_log_events'], 'L_MARK_ALL' => $lang['Mark_all'], 'L_UNMARK_ALL' => $lang['Unmark_all'], 'L_DELETE_MARKED' => $lang['Delete_marked'], 'L_DELETE_ALL' => $lang['Delete_all'] )); // // Show Page // $template->pparse('body'); include('page_footer_admin.'.$phpEx); ?> --- NEW FILE: em_manage.php --- <?php /** * * @package EasyMOD * @version $Id: em_manage.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // // Start System // define('IN_PHPBB', 1); $phpbb_root_path = './../'; $em_page = basename(__FILE__); require($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'includes/em/em_common.'.$phpEx); include($phpbb_root_path . 'includes/em/em_actions.'.$phpEx); $mode = request_var('mode', ''); //---------------------------------------------------------------------------------// // Get Info //---------------------------------------------------------------------------------// // name // decription // version // authors // size (on disk) // format (text, xml, zipped etc..) // files edited (count open commands) // included files (count copy commands) // license // author notes // history // generator // number of edits (count after adds etc..) // x to file.php ... etc... // number of sql commands (click to show) //---------------------------------------------------------------------------------// if( $mode == 'info' ) { // Get the MOD identifier $mod_file = request_var('file', ''); $mod_id = request_var('id', 0); // Set template $template->set_filenames(array( 'body' => 'admin/em_mod_info.tpl') ); if( !empty($mod_file) ) { mod_info_rows('MOD_INFO_ROWS', $mod_file); } elseif( $mod_id > 0 ) { mod_info_rows('MOD_INFO_ROWS', $mod_id); } else { message_die(GENERAL_ERROR, 'Could not load MOD information'); } $template->assign_vars(array( 'L_MOD_INFO' => $lang['EM_Mod_info'], 'L_CLOSE_WINDOW' => $lang['Close_window'], )); } //---------------------------------------------------------------------------------// // Previewing //---------------------------------------------------------------------------------// elseif( $mode == 'preview' ) { // Set template $template->set_filenames(array( 'body' => 'admin/em_preview.tpl') ); } //---------------------------------------------------------------------------------// // Installing (check) //---------------------------------------------------------------------------------// elseif( $mode == 'install' ) { $step = request_var('step', 0); // Obtain the filename $mod_file = request_var('file', ''); $mod_dir = dirname($mod_file) . '/'; $processed_dir = $mod_dir . 'processed'; $backup_dir = $mod_dir . 'backup'; // Instatiate the workers $mod_parser = new_parser($mod_file); $mod_io = new_io(); $modder = new actions('mod_io'); // Check the MOD file and Parse the MOD if( !$mod_parser->verify() ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $mod_file); } $mod_parser->parse_header(); $mod_parser->parse_actions(); switch($step) { // edit the files! case 2: // Set template $template->set_filenames(array( 'body' => 'admin/em_check_install.tpl') ); // create the processed directory $mod_io->make_dir($processed_dir); // Display general MOD information mod_info_rows('MOD_INFO_ROWS', $mod_file, $mod_parser->header); // Display MOD actions foreach( $mod_parser->actions as $action => $action_data ) { if( in_array($action, array('sql','copy','open', 'diy-instructions', 'save-close-files')) ) { switch( $action ) { case 'sql': if ( !empty($action_data) ) { display_mod_action('processed', $action, implode(";\n", $action_data) . ';'); } break; case 'copy': $copy_actions = array(); for( $i = 0; $i < count($action_data); $i++ ) { $copy_files = $modder->copy($action_data[$i]['from'], $action_data[$i]['to']); for( $k = 0, $copy_total = sizeof($copy_files); $k < $copy_total; $k++ ) { $copy_actions[] = 'copy ' . $copy_files[$k]['from'] . ' to ' . $copy_files[$k]['to']; } } display_mod_action('processed', $action, implode("\n", $copy_actions)); break; case 'open': foreach( $action_data as $target_file => $target_actions ) { // create directory for the file within the processed directory and move file there for edits $file_dir = dirname($target_file); $edit_file = $processed_dir . '/' . $file_dir . '/' . basename($target_file) . '.txt'; $mod_io->make_dir($processed_dir . '/' . $file_dir); $mod_io->copy_file($target_file, $edit_file); if ( !$modder->open($edit_file) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); for( $i = 0, $total = sizeof($target_actions['edit']); $i < $total; $i++ ) { $actions_data = $target_actions['edit'][$i]; // should be a find here if ( !$modder->find($actions_data['find']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); // loop through the avaliable actions for( $j = 0, $action_total = sizeof($actions_data['action']); $j < $action_total; $j++ ) { $action_data = $actions_data['action'][$j]; if ( in_array($action_data['type'], array('before-add', 'after-add', 'replace-with', 'increment')) ) { $action_func = str_replace('-', '_', $action_data['type']); if ( !call_user_func(array(&$modder, $action_func), $action_data['code']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; } else { $block = 'unprocessed'; } display_mod_action($block, $action_data['type'], $action_data['code']); } // in-line actions for( $k = 0, $inline_total = sizeof($actions_data['in-line-edit']); $k < $inline_total; $k++ ) { $inlines_data = $actions_data['in-line-edit'][$k]; // should be a in-line find here if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); // loop through the in-line actions for( $j = 0, $action_total = sizeof($inlines_data['in-line-action']); $j < $action_total; $j++ ) { $inline_data = $inlines_data['in-line-action'][$j]; if ( in_array($inline_data['type'], array('in-line-before-add', 'in-line-after-add', 'in-line-replace-with', 'increment')) ) { $action_func = str_replace('-', '_', $inline_data['type']); if ( !call_user_func(array(&$modder, $action_func), $inline_data['code']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_' . $action_func, $action_data['code']); } $block = 'processed'; } else { $block = 'unprocessed'; } display_mod_action($block, $inline_data['type'], $inline_data['code']); } } } $modder->close(); } break; case 'diy-instructions': for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { display_mod_action('unprocessed', $action, $action_data[$i]); } break; case 'save-close-files': display_mod_action('processed', $action, 'EoM'); break; } } else { for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { display_mod_action('unprocessed', $action, $action_data[$i]); } } } $hidden_ary = array( 'mode' => 'install', 'step' => 3, 'file' => $mod_file); $template->assign_vars(array( 'S_ACTION' => append_sid($phpbb_root_path . 'admin/em_manage.'.$phpEx), 'S_HIDDEN_FIELDS' => build_hidden_fields($hidden_ary), 'L_TITLE' => $lang['EM_Install_perform'] . ' - ' . sprintf($lang['EM_Mod_steps'], 2), 'L_DESCRIPTION' => $lang['EM_Install_perform_desc'], 'L_MOD_INFO' => $lang['EM_Mod_info'], 'L_COMMANDS_PROCESSED' => $lang['EM_Commands_processed'], 'L_COMMANDS_UNPROCESSED' => $lang['EM_Commands_unprocessed'], 'L_CONTINUE' => $lang['EM_Goto_3']) ); break; // check sql, let users select which queries to perform case 3: $template->set_filenames(array( 'body' => 'admin/em_check_sql.tpl') ); $sql_ary = array(); if ( is_object($sql_parser) ) { $sql = $mod_parser->actions['sql']; for( $i = 0, $total = sizeof($sql); $i < $total; $i++ ) { // Split stream into separate SQL formatted statements $result = $sql_parser->parse_stream($sql[$i], $table_prefix); // @TODO: Define how to deal with errors or warnings here if( $result & SQL_PARSER_ERROR ) { message_die(GENERAL_ERROR, '<b>Error:</b><br />' . $sql_parser->error_message['message'] . '<br /><br /><b>SQL:</b><br />' . $sql_parser->sql_input[$sql_parser->sql_count]); } if( $result & SQL_PARSER_WARNINGS ) { for( $i = 0, $total = sizeof($sql_parser->warnings); $i < $total; $i++ ) { em_handle_error(EM_ERR_WARNING, 'SQL Warning', $sql_parser->warnings[$i]); } } $sql_ary = array_merge($sql_ary, $sql_parser->sql_output); } } for( $i = 0, $total = sizeof($sql_ary); $i < $total; $i++ ) { $hidden_ary = array( "sql[$i]" => htmlspecialchars($sql_ary[$i])); $template->assign_block_vars('sql_row', array( 'S_HIDDEN_FIELDS' => build_hidden_fields($hidden_ary), 'STATUS' => '<input type="checkbox" name="perform[' . $i . ']" value="1" checked="checked" />', 'SQL' => htmlspecialchars($sql_ary[$i])) ); } $hidden_ary = array( 'mode' => 'install', 'step' => ( !empty($sql_ary) ) ? 4 : 5, 'file' => $mod_file); $template->assign_vars(array( 'S_ACTION' => append_sid($phpbb_root_path . 'admin/em_manage.'.$phpEx), 'S_HIDDEN_FIELDS' => build_hidden_fields($hidden_ary), 'L_TITLE' => $lang['EM_Install_sql_check'] . ' - ' . sprintf($lang['EM_Mod_steps'], 3), 'L_DESCRIPTION' => $lang['EM_Install_sql_check_desc'], 'L_SQL_QUERY' => $lang['EM_Sql_query'], 'L_SQL_STATUS' => $lang['EM_Sql_perform'], 'L_CONTINUE' => ( !empty($sql_ary) ) ? $lang['EM_Goto_4'] : $lang['EM_Goto_5']) ); break; // perform sql case 4: $template->set_filenames(array( 'body' => 'admin/em_check_sql.tpl') ); $sql = ( isset($HTTP_POST_VARS['sql']) ) ? $HTTP_POST_VARS['sql'] : array(); $perform = ( isset($HTTP_POST_VARS['perform']) ) ? $HTTP_POST_VARS['perform'] : array(); for( $i = 0, $total = sizeof($sql); $i < $total; $i++ ) { $sql[$i] = htmlspecialchars(stripslashes($sql[$i])); if ( isset($perform[$i]) && $perform[$i] == true ) { $skip = false; if ( $db->sql_query($sql[$i]) ) { $status = true; } else { $status = false; vd(array($sql[$i], $db->sql_error())); } } else { $skip = true; } $template->assign_block_vars('sql_row', array( 'STATUS' => ( $skip === true ) ? $lang['EM_Skipped'] : (( $status === true ) ? $lang['EM_Passed'] : $lang['EM_Failed']), 'SQL' => $sql[$i]) ); } $hidden_ary = array( 'mode' => 'install', 'step' => 5, 'file' => $mod_file); $template->assign_vars(array( 'S_ACTION' => append_sid($phpbb_root_path . 'admin/em_manage.'.$phpEx), 'S_HIDDEN_FIELDS' => build_hidden_fields($hidden_ary), 'L_TITLE' => $lang['EM_Install_sql_perform'] . ' - ' . sprintf($lang['EM_Mod_steps'], 4), 'L_DESCRIPTION' => $lang['EM_Install_sql_perform_desc'], 'L_SQL_QUERY' => $lang['EM_Sql_query'], 'L_SQL_STATUS' => $lang['EM_Status'], 'L_CONTINUE' => $lang['EM_Goto_5']) ); break; // post process, move files, finish everything up, etc case 5: // Set template $template->set_filenames(array( 'body' => 'admin/em_post_process.tpl') ); // create the backup directory $mod_io->make_dir($backup_dir); // Display general MOD information mod_info_rows('MOD_INFO_ROWS', $mod_file, $mod_parser->header); $backup_files = array(); $copy_files = array(); $diy_instructions = array(); // Display MOD actions foreach( $mod_parser->actions as $action => $action_data ) { if( in_array($action, array('copy','open', 'diy-instructions')) ) { switch( $action ) { case 'copy': for( $i = 0; $i < count($action_data); $i++ ) { $copy_files_tmp = $modder->copy($action_data[$i]['from'], $action_data[$i]['to']); for( $k = 0; $k < count($copy_files_tmp); $k++ ) { $copy_files[] = array( 'from' => $mod_dir . $copy_files_tmp[$k]['from'], 'to' => str_replace('../', '', str_replace('./', '', $copy_files_tmp[$k]['to']))); // easy to by pass but mods shouldn't be doing that } } break; case 'open': foreach( $action_data as $target_file => $target_actions ) { // make directory for the file if ( !$mod_io->make_dir($backup_dir . '/' . dirname($target_file)) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_backup', $backup_dir . '/' . dirname($target_file)); } // move backup into place if ( !$mod_io->copy_file($target_file, $backup_dir . '/' . $target_file . '.txt') ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_move_backup', $target_file); } $template->assign_block_vars('backup_row', array( 'FROM' => $target_file, 'TO' => $backup_dir . '/' . $target_file . '.txt') ); $copy_files[] = array( 'from' => $processed_dir . '/' . $target_file . '.txt', 'to' => $target_file); } break; case 'diy-instructions': $diy_instructions = $action_data; break; } } } if ( !empty($diy_instructions) ) { $template->assign_block_vars('switch_diy', array( 'DIY_INSTRUCTIONS' => str_replace("\n", '<br />', implode('<br /><br />', $diy_instructions))) ); } for( $i = 0, $total = count($copy_files); $i < $total; $i++ ) { // make directory for the file if ( !$mod_io->make_dir(dirname($copy_files[$i]['to'])) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_mkdir_file', dirname($copy_files[$i]['to'])); } if ( !$mod_io->copy_file($copy_files[$i]['from'], $copy_files[$i]['to']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_move_file', $copy_files[$i]['from']); } $template->assign_block_vars('copy_row', array( 'FROM' => $copy_files[$i]['from'], 'TO' => $copy_files[$i]['to']) ); } $mod_file = str_replace("'", "''", htmlspecialchars(stripslashes($mod_file))); $mod_name = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['name']))); $mod_version = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['version']))); $author_username = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['author'][0]['username']))); $author_email = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['author'][0]['email']))); $author_realname = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['author'][0]['realname']))); $author_website = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['author'][0]['website']))); $mod_desc = str_replace("'", "''", htmlspecialchars(stripslashes($mod_parser->header['desc']))); add_log('EM_Log_install', $mod_name, $mod_version); $sql = 'INSERT INTO ' . EM_MODS_TABLE . "( mod_file, mod_name, mod_version, mod_author_username, mod_author_email, mod_author_realname, mod_author_website, mod_desc ) VALUES ('$mod_file', '$mod_name', '$mod_version', '$author_username', '$author_email', '$author_realname', '$author_realname', '$mod_desc' )"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not insert MOD information', '', __LINE__, __FILE__, $sql); } $template->assign_vars(array( 'L_TITLE' => $lang['EM_Install_post'] . ' - ' . sprintf($lang['EM_Mod_steps'], 5), 'L_DESCRIPTION' => $lang['EM_Install_post_desc'], 'L_MOD_INFO' => $lang['EM_Mod_info'], 'L_COPY_FILES' => $lang['EM_Copy_files'], 'L_BACKUP_FILES' => $lang['EM_Backup_files'], 'L_DIY_INSTRUCTIONS' => $lang['EM_DIY_instructions'], 'L_DIY_INSTRUCTIONS_DESC' => $lang['EM_DIY_instructions_desc'], 'L_INSTALL_SUCCESSFUL' => $lang['EM_Mod_install_success'], 'L_FROM' => $lang['EM_From'], 'L_TO' => $lang['EM_To']) ); break; // check install default: // Set template $template->set_filenames(array( 'body' => 'admin/em_check_install.tpl') ); // Display general MOD information mod_info_rows('MOD_INFO_ROWS', $mod_file, $mod_parser->header); // Display MOD actions foreach( $mod_parser->actions as $action => $action_data ) { if( in_array($action, array('sql','copy','open', 'diy-instructions', 'save-close-files')) ) { switch( $action ) { case 'sql': if ( !empty($action_data) ) { display_mod_action('processed', $action, implode(";\n", $action_data) . ';'); } break; case 'copy': $copy_actions = array(); for( $i = 0; $i < count($action_data); $i++ ) { $copy_files = $modder->copy($action_data[$i]['from'], $action_data[$i]['to']); for( $k = 0, $copy_total = sizeof($copy_files); $k < $copy_total; $k++ ) { $copy_actions[] = 'copy ' . $copy_files[$k]['from'] . ' to ' . $copy_files[$k]['to']; } } display_mod_action('processed', $action, implode("\n", $copy_actions)); break; case 'open': foreach( $action_data as $target_file => $target_actions ) { // performing open to see if the file exists if ( !$modder->open($phpbb_root_path . $target_file) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_open', $target_file); } display_mod_action('processed', $action, $target_file); for( $i = 0, $total = sizeof($target_actions['edit']); $i < $total; $i++ ) { $actions_data = $target_actions['edit'][$i]; // should be a find here // performing the find to see if it works if ( !$modder->find($actions_data['find']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'find', $actions_data['find']); // loop through the avaliable actions for( $j = 0, $action_total = sizeof($actions_data['action']); $j < $action_total; $j++ ) { $action_data = $actions_data['action'][$j]; if ( in_array($action_data['type'], array('before-add', 'after-add', 'replace-with', 'increment')) ) { $block = 'processed'; } else { $block = 'unprocessed'; } display_mod_action($block, $action_data['type'], $action_data['code']); } // in-line actions for( $k = 0, $inline_total = sizeof($actions_data['in-line-edit']); $k < $inline_total; $k++ ) { $inlines_data = $actions_data['in-line-edit'][$k]; // should be a in-line find here if ( !$modder->in_line_find($inlines_data['in-line-find']) ) { em_handle_error(EM_ERR_CRITICAL, 'EM_Err_inline_find', $actions_data['find'], $target_file); } display_mod_action('processed', 'in-line-find', $inlines_data['in-line-find']); // loop through the in-line actions for( $j = 0, $action_total = sizeof($inlines_data['in-line-action']); $j < $action_total; $j++ ) { $inline_data = $inlines_data['in-line-action'][$j]; if ( in_array($inline_data['type'], array('in-line-before-add', 'in-line-after-add', 'in-line-replace-with', 'increment')) ) { $block = 'processed'; } else { $block = 'unprocessed'; } display_mod_action($block, $inline_data['type'], $inline_data['code']); } } } } break; case 'diy-instructions': for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { display_mod_action('processed', $action, $action_data[$i]); } break; case 'save-close-files': display_mod_action('processed', $action, 'EoM'); break; } } else { for( $i = 0, $total = sizeof($action_data); $i < $total; $i++ ) { display_mod_action('unprocessed', $action, $action_data[$i]); } } } // temp display_mod_action('processed', 'mod-parser-class', var_export($mod_parser, true)); $hidden_ary = array( 'mode' => 'install', 'step' => 2, 'file' => $mod_file); $template->assign_vars(array( 'S_ACTION' => append_sid($phpbb_root_path . 'admin/em_manage.'.$phpEx), 'S_HIDDEN_FIELDS' => build_hidden_fields($hidden_ary), 'L_TITLE' => $lang['EM_Install_check'] . ' - ' . sprintf($lang['EM_Mod_steps'], 1), 'L_DESCRIPTION' => $lang['EM_Install_check_desc'], 'L_MOD_INFO' => $lang['EM_Mod_info'], 'L_COMMANDS_PROCESSED' => $lang['EM_Commands_processed'], 'L_COMMANDS_UNPROCESSED' => $lang['EM_Commands_unprocessed'], 'L_CONTINUE' => $lang['EM_Goto_2']) ); break; } } //---------------------------------------------------------------------------------// // Uninstalling //---------------------------------------------------------------------------------// elseif( $mode == 'uninstall' ) { $step = request_var('step', 0); switch($step) { default: // Set template $template->set_filenames(array( 'body' => 'admin/em_check_uninstall.tpl') ); break; } } //---------------------------------------------------------------------------------// // Updating (check) //---------------------------------------------------------------------------------// elseif( $mode == 'update' ) { $step = request_var('step', 0); switch($step) { default: // Set template $template->set_filenames(array( 'body' => 'admin/em_check_update.tpl') ); $mod_id = request_var('id', 0); // Get MOD info $sql = 'SELECT mod_id, mod_file, mod_name, mod_version, mod_desc, mod_styles FROM ' . EM_MODS_TABLE . ' WHERE mod_id = ' . $mod_id; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not select MOD information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); // Need Style Update? if( styles_outdated($row['mod_styles']) ) { // Add style block, with more info //$mod_status_img = $images['em_status_style']; //$mod_status_lang = $lang['EM_Status_style']; } else { // Add up to date styles block. } // Need Lang Update? (manual, but notify) break; } } //---------------------------------------------------------------------------------// // Available MODs Report //---------------------------------------------------------------------------------// else { // Set template $template->set_filenames(array( 'body' => 'admin/em_manage_install.tpl') ); // Get installed MODs from DB $installed_mods = array(); $sql = 'SELECT mod_file FROM ' . EM_MODS_TABLE; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not select MOD information', '', __LINE__, __FILE__, $sql); } while( $row = $db->sql_fetchrow($result) ) { $installed_mods[] = $phpbb_root_path . $board_config['em_mod_dir'] . $row['mod_file']; } $db->sql_freeresult($result); // Get uninstalled, or new mods $new_mods = mod_scan($phpbb_root_path . $board_config['em_mod_dir'], $installed_mods); $new_mods_count = count($new_mods); if( $new_mods_count <= 0 ) { // No MODs available $template->assign_block_vars('no_available_mods', array( 'L_NO_AVAILABLE_MODS' => $lang['EM_No_available_mods'], )); } else { // oowwww, new goodies ... for( $i = 0; $i < $new_mods_count; $i++ ) { $row_class = (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2']; $mod = $new_mods[$i]; $template->assign_block_vars('available_mods', array( 'S_MORE_INFO' => append_sid(basename(__FILE__) . '?mode=info&file=' . urlencode($mod['file'])), 'S_PREVIEW' => append_sid(basename(__FILE__) . '?mode=preview&file=' . urlencode($mod['file'])), 'S_INSTALL' => append_sid(basename(__FILE__) . '?mode=install&file=' . urlencode($mod['file'])), 'ROW_CLASS' => $row_class, 'MOD_NAME' => $mod['name'], 'MOD_DESC' => str_cut($mod['desc'], 80), 'MOD_VERSION' => $mod['version'], 'MOD_AUTHOR' => $mod['author'][0]['username'], )); } } // Misc. template vars $template->assign_vars(array( 'L_MANAGE' => $lang['EM_Install_MODs'], 'L_MANAGE_EXPLAIN' => $lang['EM_Install_MODs_explain'], 'L_AVAILABLE_MODS' => $lang['EM_Available_mods'], 'L_MOD_NAME' => $lang['EM_Mod_name'], 'L_MOD_DESCRIPTION' => $lang['EM_Mod_description'], 'L_MOD_VERSION' => $lang['EM_Mod_version'], 'L_MOD_AUTHOR' => $lang['EM_Mod_author'], 'L_MORE_INFO' => $lang['EM_More_info'], 'L_PREVIEW' => $lang['EM_Preview'], 'L_INSTALL' => $lang['EM_Install'], )); } //---------------------------------------------------------------------------------// // // Show Page // $template->pparse('body'); include('page_footer_admin.'.$phpEx); //---------------------------------------------------------------------------------// // FUNCTIONS //---------------------------------------------------------------------------------// function mod_info_rows($template_variable, $mod_id, $mod_header = '') { global $template, $theme, $lang, $db; if( is_numeric($mod_id) ) { // Draw data from DB $sql = 'SELECT * FROM ' . EM_MODS_TABLE . ' WHERE mod_id = ' . $mod_id; if( !($result = $db->sql_query($sql)) || !($mod_row = $db->sql_fetchrow($result)) ) { message_die(GENERAL_ERROR, 'Could not select MOD information', '', __LINE__, __FILE__, $sql); } $db->sql_freeresult($result); $mod_info = array( 'mod_name' => htmlspecialchars($mod_row['mod_name']), 'mod_author' => array( 'username' => $mod_row['mod_author_username'], 'email' => $mod_row['mod_author_email'], 'realname' => $mod_row['mod_author_realname'], 'website' => $mod_row['mod_author_website']), 'mod_description' => htmlspecialchars($mod_row['mod_desc']), 'mod_version' => $mod_row['mod_version'], 'mod_file' => $mod_row['mod_file'], ); // If MOD file still around, get more information $mod_parser = new_parser($mod_row['mod_file']); if( $mod_parser->verify() ) { $mod_header = $mod_parser->parse_header(); $mod_info['author_notes'] = str_replace("\n", '<br />', htmlspecialchars($mod_header['author-notes'])); } } else { $mod_file = $mod_id; } if( !empty($mod_file) && empty($mod_header) ) { // Setup Parser $mod_parser = new_parser($mod_file); if( !$mod_parser->verify() ) { message_die(GENERAL_ERROR, sprintf('Could not open file "%s"', $mod_file)); } // Get all the info $mod_header = $mod_parser->parse_header(); } if ( empty($mod_info) ) { $mod_info = array( 'mod_name' => htmlspecialchars($mod_header['name']), 'mod_author' => array( 'username' => $mod_header['author'][0]['username'], 'email' => $mod_header['author'][0]['email'], 'realname' => $mod_header['author'][0]['realname'], 'website' => $mod_header['author'][0]['website']), 'mod_description' => htmlspecialchars($mod_header['desc']), 'mod_version' => $mod_header['version'], 'mod_file' => basename($mod_file), 'author_notes' => str_replace("\n", '<br />', htmlspecialchars($mod_header['author-notes'])), ); } // Set template $template->set_filenames(array( 'mod_info_rows' => 'admin/em_mod_info_rows.tpl') ); // Send data to templates // did this automatically, to start, might want to do it all manually, for the proper effect $info_names = array_keys($mod_info); for( $i = 0; $i < count($mod_info); $i++ ) { if ( $info_names[$i] == 'mod_author' ) { // splitting these up into multiple lines so we don't have one long mess even though it still is a mess $username = ( !empty($mod_info['mod_author']['username']) && strtolower($mod_info['author']['username']) != 'n/a' ) ? $mod_info['mod_author']['username'] : $lang['EM_NA']; $email = ( !empty($mod_info['mod_author']['email']) && strtolower($mod_info['mod_author']['email']) != 'n/a' ) ? '<a href="mailto:' . $mod_info['mod_author']['email'] . '">' . $mod_info['mod_author']['email'] . '</a>' : $lang['EM_NA']; $website = ( !empty($mod_info['mod_author']['website']) && strtolower($mod_info['mod_author']['website']) != 'n/a' ) ? '<a href="' . $mod_info['mod_author']['website'] . '">' . $mod_info['mod_author']['website'] . '</a>' : $lang['EM_NA']; $realname = ( !empty($mod_info['mod_author']['realname']) && strtolower($mod_info['author']['realname']) != 'n/a' ) ? $mod_info['mod_author']['realname'] : $lang['EM_NA']; $mod_info['mod_author'] = $username . ' < ' . $email . ' > (' . $realname . ') ' . $website; } $template->assign_block_vars('mod_info', array( 'ROW_CLASS' => (!($i % 2)) ? $theme['td_class1'] : $theme['td_class2'], 'INFO_NAME' => str_replace(' ', ' ', $lang['EM_' . ucfirst($info_names[$i])]), 'INFO_DATA' => $mod_info[$info_names[$i]] )); } $template->assign_var_from_handle($template_variable, 'mod_info_rows'); } function display_mod_action($block, $action, $body) { global $template, $theme; $template->assign_block_vars($block, array( 'ROW_CLASS' => $theme['td_class2'], 'LINE' => '<b>' . strtoupper($action) . '</b>' )); $template->assign_block_vars($block, array( 'ROW_CLASS' => $theme['td_class1'], 'LINE' => '<pre>' . htmlspecialchars($body) . '</pre>' )); } //---------------------------------------------------------------------------------// ?> --- NEW FILE: em_general.php --- <?php /** * * @package EasyMOD * @version $Id: em_general.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // // Start System // define('IN_PHPBB', 1); $phpbb_root_path = './../'; $em_page = basename(__FILE__); require($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'includes/em/em_common.'.$phpEx); // // EasyMOD General ... // $template->set_filenames(array( 'body' => 'admin/em_general.tpl') ); $update = request_var('update', ''); // Updating Settings if( $update == 'settings' ) { foreach($board_config as $config_name => $void) { $new_config = request_var($config_name, $void); if(!empty($new_config)) { if ($config_name == 'em_ftp_password') { $key = ''; for($i = 1, $total = strlen($board_config['em_pass']); $i < $total; $i = round(($i+1)*2)) { $key .= md5($board_config['em_pass']{$i}); } $new_config = $crypt->encrypt($new_config, $key); } $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . str_replace("\'", "''", $new_config) . "' WHERE config_name = '$config_name'"; if(!$db->sql_query($sql)) { message_die(GENERAL_ERROR, "Failed to update general EM configuration for $config_name", "", __LINE__, __FILE__, $sql); } } } $message = $lang['EM_Settings_updated'] . "<br /><br />" . sprintf($lang['EM_Click_return_general'], "<a href=\"" . append_sid(basename(__FILE__)) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); } // Updating password // Ask for old pass? elseif( $update == 'pass' ) { $pass = request_var('pass', ''); $pass_confirm = request_var('pass_confirm', ''); if($pass != $pass_confirm) { $message = $lang['EM_Passwords_no_match'] . "<br /><br />" . sprintf($lang['EM_Click_return_general'], "<a href=\"" . append_sid(basename(__FILE__)) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); } $sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . md5($pass) . "' WHERE config_name = 'em_pass'"; if(!$db->sql_query($sql)) { message_die(GENERAL_ERROR, "Failed to update EM password", "", __LINE__, __FILE__, $sql); } $message = $lang['EM_Password_updated'] . "<br /><br />" . sprintf($lang['EM_Click_return_general'], "<a href=\"" . append_sid(basename(__FILE__)) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"); message_die(GENERAL_MESSAGE, $message); } $allowed_methods = '<select name="em_method">'; $methods = load_methods(); $method_files = array(); for($i = 0, $total = sizeof($methods); $i < $total; $i++) { include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $methods[$i]['file'] . '.'. $phpEx); $mod_io->test($debug, $methods[$i]['name']); $method_files[$methods[$i]['name']] = $methods[$i]['file']; } foreach ($method_files as $name => $file) { $selected = ( $board_config['em_method'] == $file ) ? ' selected="selected"' : ''; $method_lang = ( isset($lang['EM_' . $name]) ) ? $lang['EM_' . $name] : str_replace('_', ' ', $name); $allowed_methods .= '<option value="' . $file . '"' . $selected . '>' . $method_lang . '</option>'; } $allowed_methods .= '</select>'; // Template Vars $template->assign_vars(array( 'S_PASSWORD_ACTION' => append_sid(basename(__FILE__) . '?update=pass'), 'S_SETTINGS_ACTION' => append_sid(basename(__FILE__) . '?update=settings'), 'L_GENERAL' => $lang['EM_General'], 'L_GENERAL_EXPLAIN' => $lang['EM_General_explain'], 'L_GENERAL_SETTINGS' => $lang['EM_General_settings'], 'L_PASSWORD_SETTINGS' => $lang['EM_Password_settings'], 'L_PASSWORD' => $lang['EM_Password'], 'L_PASSWORD_CONFIRM' => $lang['EM_Password_confirm'], 'L_METHOD' => $lang['EM_method'], 'L_TEMP_PATH' => $lang['EM_temp_path'], 'L_FILE_PERM' => $lang['EM_file_perm'], 'L_DIR_PERM' => $lang['EM_dir_perm'], 'L_FTP_SETTINGS' => $lang['EM_ftp_conn'], 'L_FTP_USER' => $lang['EM_ftp_user'], 'L_FTP_PASS' => $lang['EM_ftp_pass'], 'L_FTP_HOST' => $lang['EM_ftp_host'], 'L_FTP_PATH' => $lang['EM_ftp_path'], 'L_FTP_PORT' => $lang['EM_ftp_port'], 'L_FTP_TIME' => $lang['EM_ftp_time'], 'L_SUBMIT' => $lang['Submit'], 'L_RESET' => $lang['Reset'], 'L_MOD_DIR' => $lang['EM_Mod_dir'], 'L_MOD_DIR_EXPLAIN' => $lang['EM_Mod_dir_explain'], 'EM_METHODS' => $allowed_methods, 'EM_TEMP_PATH' => $board_config['em_tmp_path'], 'EM_FILE_PERM' => $board_config['em_file_perms'], 'EM_DIR_PERM' => $board_config['em_dir_perms'], 'EM_MOD_DIR' => $board_config['em_mod_dir'], 'EM_FTP_USER' => $board_config['em_ftp_user'], 'EM_FTP_HOST' => $board_config['em_ftp_host'], 'EM_FTP_PATH' => $board_config['em_ftp_root_path'], 'EM_FTP_PORT' => $board_config['em_ftp_port'], 'EM_FTP_TIME' => $board_config['em_ftp_timeout'] )); // // Show Page // $template->pparse('body'); include('page_footer_admin.'.$phpEx); ?> --- NEW FILE: admin_easymod.php --- <?php /** * * @package EasyMOD * @version $Id: admin_easymod.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // // Set Menu // if( !empty($setmodules) ) { include_once($phpbb_root_path . 'includes/em/em_acp_menu.'.$phpEx); return; } redirect($phpbb_root_path . 'admin/index.'.$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> --- NEW FILE: em_history.php --- <?php /** * * @package EasyMOD * @version $Id: em_history.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // // Start System // define('IN_PHPBB', 1); $phpbb_root_path = './../'; $em_page = basename(__FILE__); require($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'includes/em/em_common.'.$phpEx); include($phpbb_root_path . 'includes/em/em_actions.'.$phpEx); $mode = request_var('mode', ''); //---------------------------------------------------------------------------------// // MODs History Report //---------------------------------------------------------------------------------// // Set template $template->set_filenames(array( 'body' => 'admin/em_manage_history.tpl') ); // Get installed MODs from DB $installed_mods = array(); $mods_count = 0; $sql = 'SELECT mod_id, mod_file, mod_name, mod_version, mod_desc, mod_styles FROM ' . EM_MODS_TABLE; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not select MOD information', '', __LINE__, __FILE__, $sql); } while( $row = $db->sql_fetchrow($result) ) { // Default Status $mod_status_img = $images['em_status_ready']; $mod_status_lang = $lang['EM_Status_ready']; // Track MOD as installed $installed_mods[] = $phpbb_root_path . $board_config['em_mod_dir'] . $row['mod_file']; // Check Styles if( styles_outdated($row['mod_styles']) ) { $mod_status_img = $images['em_status_style']; $mod_status_lang = $lang['EM_Status_style']; } // Show to page $template->assign_block_vars('installed_mods', array( 'S_MORE_INFO' => append_sid(basename(__FILE__) . '?mode=info&id=' . $row['mod_id']), 'S_UPDATE' => append_sid(basename(__FILE__) . '?mode=check_update&id=' . $row['mod_id']), 'S_UNINSTALL' => append_sid(basename(__FILE__) . '?mode=check_uninstall&id=' . $row['mod_id']), 'ROW_CLASS' => (!($mods_count % 2)) ? $theme['td_class1'] : $theme['td_class2'], 'MOD_STATUS_IMG' => $mod_status_img, 'MOD_STATUS_LANG' => $mod_status_lang, 'MOD_NAME' => $row['mod_name'], 'MOD_DESC' => str_cut($row['mod_desc'], 80), 'MOD_VERSION' => $row['mod_version'], 'MOD_STYLES' => '', )); $mods_count++; } $db->sql_freeresult($result); if( $mods_count <= 0 ) { $template->assign_block_vars('no_installed_mods', array( 'L_NO_INSTALLED_MODS' => $lang['EM_No_installed_mods'], )); } // Misc. template vars $template->assign_vars(array( 'L_MANAGE' => $lang['EM_History'], 'L_MANAGE_EXPLAIN' => $lang['EM_History_explain'], 'L_INSTALLED_MODS' => $lang['EM_Installed_mods'], 'L_MOD_STATUS' => $lang['EM_Mod_status'], 'L_MOD_NAME' => $lang['EM_Mod_name'], 'L_MOD_DESCRIPTION' => $lang['EM_Mod_description'], 'L_MOD_VERSION' => $lang['EM_Mod_version'], 'L_MORE_INFO' => $lang['EM_More_info'], 'L_UPDATE' => $lang['EM_Update'], 'L_UNINSTALL' => $lang['EM_Uninstall'], )); // // Show Page // $template->pparse('body'); include('page_footer_admin.'.$phpEx); ?> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:41
|
Update of /cvsroot/easymod/easymod/install/schemas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install/schemas Added Files: easymod_mysql.sql index.htm Log Message: First commit to SourceForge. Enjoy! --- NEW FILE: easymod_mysql.sql --- ALTER TABLE `phpbb_sessions` ADD `session_em` TINYINT(1) DEFAULT '0' NOT NULL; INSERT INTO `phpbb_config` (`config_name`, `config_value`) VALUES ('em_extensions', ''); INSERT INTO `phpbb_config` (`config_name`, `config_value`) VALUES ('em_mod_dir', 'mods/'); INSERT INTO `phpbb_config` (`config_name`, `config_value`) VALUES ('em_url', 'http://area51.phpbb.com'); CREATE TABLE `phpbb_em_mods` ( `mod_id` mediumint(8) NOT NULL auto_increment, `mod_file` varchar(255) NOT NULL default '', `mod_name` varchar(255) NOT NULL default '', `mod_version` varchar(100) NOT NULL default '', `mod_author_username` varchar(255) NOT NULL default '', `mod_author_email` varchar(255), `mod_author_realname` varchar(255), `mod_author_website` varchar(255), `mod_desc` text NOT NULL, `mod_styles` varchar(255) NOT NULL default '', PRIMARY KEY (`mod_id`) ); CREATE TABLE `phpbb_em_logs` ( `log_id` mediumint(8) NOT NULL auto_increment, `log_time` int(11) NOT NULL default '0', `log_user` mediumint(8) NOT NULL default '0', `log_ip` char(8) NOT NULL, `log_data` text NOT NULL, PRIMARY KEY (`log_id`) ); --- 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> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:40
|
Update of /cvsroot/easymod/easymod/dev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/dev Added Files: functions_xml.php mod_template.xml mysql.php sql_template_parser.php xml_to_array.php Log Message: First commit to SourceForge. Enjoy! --- NEW FILE: mod_template.xml --- <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!--?xml-stylesheet type="text/xsl" href="english.subsilver.xsl"?--> <mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <header> <title lang="en">Country Flags</title> <description lang="en">This mod allows your registered board members to select the flag of their country. Their flag will then display thoughout the phpBB system.</description> <author-notes lang="en">This MOD is not to be listed, downloaded or posted at -any- site except Official phpBB Web Sites. Thank You. JbA</author-notes> <!-- multiple authors are easy --> <author realname="nuttzy" email="pkt...@bl..." username="Nuttzy99" homepage="http://www.blizzhackers.com" /> <author realname="John B. Abela" email="ab...@4c..." username="abelajohnb" homepage="N/A" /> <!-- breaking the MOD version up into it's components allows for flexibility, while still enforcing an absolute standard --> <mod-version> <major>2</major> <minor>2</minor> <revision>2</revision> <release>a</release> </mod-version> <installation> <level>Easy</level> <time>2820</time> <target-version> <!-- Even though we have the components, they can be split up, also, as we plan to support Beta 1, a text field thats for show purposes only seems necessary, as it may not always be possible to grab a single designed for version --> <target-primary>3.0.0 Beta 1</target-primary> <target-major allow="exact">3</target-major> <target-minor allow="exact">0</target-minor> <target-revision allow="after">0</target-revision> <!-- this is just so the xsd creates this field, this just effectively locks out all letter releases, not something we really want in practice, but the field may be useful, and thus future-proofing the template --> <target-release allow="exact"></target-release> </target-version> <easymod-compliant>false</easymod-compliant> <mod-config>config.modcfg</mod-config> </installation> <history> <revision> <date>2004-07-26T00:00:00.0000000+10:00</date> <version>2.2.2</version> <change>eliminated flags.sql file</change> </revision> <revision> <date>2003-02-20T00:00:00.0000000+10:00</date> <version>2.2.0</version> <change>updated for phpBB 2.0.4</change> <change>added admin tools to edit/add/remove flags</change> </revision> </history> <!-- why have meta, why not? it just allows for organised information to be stored that an author or application could put in to indicate various aspects of the MOD --> <meta name="generator" content="MOD Studio sharp 4, beta 1 with mod functions sharp 2" /> </header> <action-group> <sql> ALTER TABLE phpbb_users ADD user_from_flag varchar(25) NULL AFTER user_from; CREATE TABLE phpbb_flags ( flag_id int(10) NOT NULL auto_increment, flag_name varchar(25), flag_image varchar(25), PRIMARY KEY (flag_id) ); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','usa','usa.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','afghanistan','afghanistan.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','albania','albania.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','algeria','algeria.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','andorra','andorra.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','angola','angola.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','antigua and barbuda','antiguabarbuda.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','argentina','argentina.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','armenia','armenia.gif'); INSERT INTO phpbb_flags (flag_id, flag_name, flag_image) VALUES ('','australia','australia.gif'); </sql> <copy from="flags/*.*" to = "images/flag/*.*" /> <copy from="admin_flags.php.txt" to="admin/admin_flags.php" /> <copy from="flages_list_body.tpl.txt" to="templates/subSilver/admin/flags_list_body.tpl" /> <copy from="flags_edit_body.tpl.txt" to="templates/subSilver/admin/flags_edit_body.tpl" /> <open file="includes/constants.php"> <edit> <find> define('VOTE_USERS_TABLE', $table_prefix.'vote_voters'); </find> <action type="before-add"> // before </action> <action type="after-add"> // FLAGHACK-start define('FLAG_TABLE', $table_prefix.'flags'); // FLAGHACK-end </action> </edit> </open> <open file="includes/usercp_viewprofile.php"> <edit> <find> $pm_img = '<a href=" </find> <action type="after-add"> // FLAGHACK-start $location = ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;' ; $flag = ( !empty($profiledata['user_from_flag']) ) ? "&nbsp;<img src=\"images/flags/" . $profiledata['user_from_flag'] . "\" alt=\"" . $profiledata['user_from_flag'] . "\">" : ""; $location .= $flag ; // FLAGHACK-end </action> </edit> <edit> <find> 'LOCATION' => </find> <action type="replace-with"> // FLAGHACK-start 'LOCATION' => $location, // FLAGHACK-endd </action> </edit> <edit> <find> $user_timezone = ( </find> <action type="after-add"> // FLAGHACK-start $user_flag = ( !empty($HTTP_POST_VARS['user_flag']) ) ? $HTTP_POST_VARS['user_flag'] : '' ; // FLAGHACK-end </action> </edit> <edit> <find> $sql = "UPDATE " . USERS_TABLE . " user_from = '" . str_replace("\'", "''", $location) . "', </find> <inline-edit> <inline-find> user_from = '" . str_replace("\'", "''", $location) . "', </inline-find> <inline-action type="after-add"> user_from_flag = '$user_flag', </inline-action> </inline-edit> </edit> <edit> <find> $sql = "INSERT INTO " . USERS_TABLE VALUES ( </find> <inline-edit> <inline-find> user_from, </inline-find> <inline-action type="after-add"> user_from_flag, </inline-action> </inline-edit> </edit> <edit> <find> $sql = "INSERT INTO " . USERS_TABLE VALUES ( </find> <inline-edit> <inline-find> '" . str_replace("\'", "''", $location) . "', </inline-find> <inline-action type="after-add"> '$user_flag', </inline-action> </inline-edit> </edit> <edit> <find> $location = $userdata['user_from']; </find> <action type="after-add"> // FLAGHACK-start $user_flag = $userdata['user_from_flag']; // FLAGHACK-end </action> </edit> <edit> <find type="regex"> display_avatar_gallery( </find> <inline-edit> <inline-find> $location, </inline-find> <inline-action type="after-add"> $user_flag, </inline-action> </inline-edit> <inline-edit> <inline-find type="regex"> [a-z]{9} </inline-find> <inline-action type="operation">{0}++</inline-action> </inline-edit> <inline-edit> <inline-find type="regex"> [0-9] </inline-find> <inline-action type="operation">{0}--</inline-action> </inline-edit> </edit> <edit> <find> if ( $mode == 'editprofile' ) { $template->assign_block_vars('switch_edit_profile', array()); } </find> <action type="after-add"> // FLAGHACK-start // query to get the list of flags $sql = "SELECT * FROM " . FLAG_TABLE . " ORDER BY flag_id"; if(!$flags_result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql); } $flag_row = $db->sql_fetchrowset($ranksresult); $num_flags = $db->sql_numrows($ranksresult) ; // build the html select statement $flag_start_image = 'blank.gif' ; $selected = ( isset($user_flag) ) ? '' : ' selected="selected"' ; $flag_select = "<select name=\"user_flag\" onChange=\"document.images['user_flag'].src = 'images/flags/' + this.value;\" >"; $flag_select .= "<option value=\"blank.gif\"$selected>" . $lang['Select_Country'] . "</option>"; for ($i = 0; $i < $num_flags; $i++) { $flag_name = $flag_row[$i]['flag_name']; $flag_image = $flag_row[$i]['flag_image']; $selected = ( isset( $user_flag) ) ? (($user_flag == $flag_image) ? 'selected="selected"' : '' ) : '' ; $flag_select .= "\t<option value=\"$flag_image\"$selected>$flag_name</option>"; if ( isset( $user_flag) && ($user_flag == $flag_image)) { $flag_start_image = $flag_image ; } } $flag_select .= '</select>'; // FLAGHACK-end </action> </edit> <edit> <find> 'LOCATION' => $location, </find> <comment lang="en">This comment comes after the find.</comment> <action type="after-add"> // FLAGHACK-start 'L_FLAG' => $lang['Country_Flag'], 'FLAG_SELECT' => $flag_select, 'FLAG_START' => $flag_start_image, // FLAGHACK-end </action> <comment lang="en">This comment comes after the edit action.</comment> </edit> </open> <diy-instructions lang="en">Hop on one leg and do a rain dance. If you do it right the MOD may work for you. However on tuesdays you must bow down to the sungod and give him special berries, from the tallest berry tree on the planet pluto, 9th from the Hyrogen sun.</diy-instructions> </action-group> </mod> --- NEW FILE: xml_to_array.php --- <?php // // XML to Array // // get XML $XML_string = implode('', file('mod_template.xml')); // parse to array $XML = new XMLtoArray(); $XML_array = $XML->parse($XML_string); // show array echo '<pre>'; var_dump($XML_array); echo '</pre>'; class XMLtoArray { var $output = array(); var $parser; var $XML; function parse($XML) { $this->parser = xml_parser_create(); xml_set_object($this->parser,$this); xml_set_element_handler($this->parser, "tag_open", "tag_closed"); xml_set_character_data_handler($this->parser, "tag_data"); $XML = str_replace('<', '<![CDATA[<]]>', $XML); $XML = str_replace('>', '<![CDATA[>]]>', $XML); $this->XML = xml_parse($this->parser,$XML ); if(!$this->XML) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser))); } xml_parser_free($this->parser); return $this->output; } function tag_open($parser, $name, $attrs) { $tag = array("name" => $name, "attrs" => $attrs); array_push($this->output, $tag); } function tag_data($parser, $tag_data) { if(trim($tag_data)) { if(isset($this->output[count($this->output)-1]['data'])) { $this->output[count($this->output)-1]['data'] .= $tag_data; } else { $this->output[count($this->output)-1]['data'] = $tag_data; } } } function tag_closed($parser, $name) { $this->output[count($this->output)-2]['children'][] = $this->output[count($this->output)-1]; array_pop($this->output); } } ?> --- NEW FILE: functions_xml.php --- <?php $mod_parser = new xml_mod_parser; $results = $mod_parser->parse_file('mod_template.xml'); echo '<pre>'; var_dump($results); echo '</pre>'; // getting even lower level data lookup. soon we'll be parsing xml. wait... wait? we are! class xml_mod_parser { var $data; var $handlers = array(); function parse_file($filename,$options = false) { $data = implode('', file($filename)); $data = str_replace('<', '<![CDATA[<]]>', $data); $data = str_replace('>', '<![CDATA[>]]>', $data); if (preg_match('#[\s]*<\?xml[^>]+encoding="([a-zA-Z0-9_\- ]+)"#si', $data, $matches)) { $encoding = $matches[1]; $xml_parser = xml_parser_create(strtoupper($encoding)); xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'ISO-8859-1'); } else { $xml_parser = xml_parser_create(); } xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, $data, $values, $tags); xml_parser_free($xml_parser); $this->parse($values,$options,$filename); return $this->export(); } function parse($values,$options = false,$filename = '') { $this->clear_data(); if ( !empty($options) && !is_array($options) ) { $options = array($options); } $mod = array_shift($values); if ( handler::typecheck($mod,'mod','open') ) { while ( $set = array_shift($values) ) { $tag = str_replace('-', '_', $set['tag']); $handler = $tag . '_handler'; if ( (!$options || in_array($tag,$options) ) && class_exists($handler) ) { if ( !isset($this->handlers[$handler]) ) { $this->handlers[$handler] = new $handler; } $this->data[$tag] = call_user_func_array(array(&$this->handlers[$handler],'parse'),array(&$values,$set,$filename)); } else if ( handler::typecheck($set,'mod','close') ) { break; } else { if ( !isset($this->handlers['default']) ) { $this->handlers['default'] = new handler; } // if we're just skipping parsing this one, we can pass it to an empty handler if ( true || class_exists($handler) ) { $this->data[$tag][] = call_user_func_array(array(&$this->handlers['default'],'parse'),array(&$values,$set,$filename)); } // handler::parse_error('mod',$set,__LINE__,"No handler defined for this tag",$filename); } } } // foreach passes by value, less efficient @reset($this->data); while ( list($tag,) = each($this->data) ) { $handler = $tag . '_handler'; $handler = isset($this->handlers[$handler]) ? $handler : 'default'; $this->data[$tag] = call_user_func_array(array(&$this->handlers[$handler],'process'),array($this->data[$tag])); } } function export() { return $this->data; } function clear_data() { $this->data = array(); } } class handler { function parse(&$values,$tag,$filename) { $tagname = $tag['tag']; if ( $tag['type'] == 'complete' ) { return array($tagname , $tag['type'], 'unparsed'); } while ( $tag = array_shift($values) ) { switch( true ) { case $this->typecheck($tag,$tagname,'close'): return array($tagname , $tag['type'], 'unparsed'); break; default: break; } } } function process($data) { return count($data); } function parse_error($area,$bad_data,$line = 0,$message='',$filename='') { printf('Error parsing XML Document in %s%s<br />',$area,$line?sprintf(' on line %d%s',$line,!empty($filename)?sprintf(' for file %s',$filename):''):''); print('<pre>'); if (!empty($message) ) print $message . "\n"; var_dump($bad_data); print "\n\n\n\n"; global $mod_parser; var_dump($mod_parser); print('</pre>'); die(); } function typecheck($tag,$names,$types) { if ( !is_array($names) ) { $names = array($names); } if ( !is_array($types) ) { $types = array($types); } // printf('Typecheck: %s vs %s, %s vs %s<br />',$tag['tag'],$name,$tag['type'],$type); return ( in_array($tag['tag'],$names) && in_array($tag['type'],$types) ); } function parse_bool($value,$attr_name = '',$line = 0,$filename = '') { switch($value) { case "1": case "true": return true; break; case "0": case "false": return false; break; default: $message = sprintf('Invalid boolean value "%s"',$value); if ( !empty($attr_name) ) { $message .= sprintf(' for attribute "%s"',$attr_name); } if ( $line ) { $message .= sprintf(' on line %d',$line); } $this->parse_error(__CLASS__,$attributes['dynamic'],$line,$message,$filename); break; } } } // handles the header xml tags class header_handler extends handler { function parse(&$values, $tag, $filename = '') { $result = array(); $valid_keys = array('title', 'description', 'mod_version', 'author-notes'); $valid_loops = array('meta', 'author'); $valid_open = array('mod-version', 'installation', 'history'); while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag, 'header', 'close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { $result[$tagname] = $tag['value']; } break; case $this->typecheck($tag, $valid_loops, 'complete'): { $result[$tagname][] = $tag['attributes']; } break; case $this->typecheck($tag, $valid_open, 'open'); { $handler = str_replace('-', '_', $tagname) . '_handler'; if ( class_exists($handler) ) { if ( !isset($this->handlers[$handler]) ) { $this->handlers[$handler] = new $handler; } $result[$tagname] = call_user_func_array(array(&$this->handlers[$handler],'parse'),array(&$values,$tag,$filename)); } else { if ( !isset($this->handlers['default']) ) { $this->handlers['default'] = new handler; } // if we're just skipping parsing this one, we can pass it to an empty handler if ( true || class_exists($handler) ) { $result[$tagname][] = call_user_func_array(array(&$this->handlers['default'],'parse'),array(&$values,$tag,$filename)); } } } break; default: { $this->parse_error(__CLASS__,$tag,__LINE__,"Invalid tag",$filename); } break; } } } function process($data) { return $data; } } // handles xml tags in the header and mod-version class mod_version_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('major', 'minor', 'revision', 'release'); while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag,'mod-version','close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { $result[$tagname] = $tag['value']; } break; default: { $result[$tagname] = $tag['value']; } break; } } } function process($data) { return $data; } } // handles tags in the header and installation class installation_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('level', 'time', 'target-primary', 'target-major', 'target-minor', 'target-revision', 'target-release', 'easymod-compliant', 'mod-config'); $valid_open = array('target-version'); while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag,'installation','close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { if ( empty($current_tag) ) { $result[$tagname] = $tag['value']; } else { $result[$current_tag][$tagname] = $tag['value']; } } break; case $this->typecheck($tag, $valid_open, 'open'): { $current_tag = $tagname; } break; case $this->typecheck($tag, $valid_open, 'close'): { $current_tag = ''; } break; default: { $result[$tagname] = $tag['value']; } break; } } } function process($data) { return $data; } } // handles tags in the header and history class history_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('date', 'version'); $valid_loops = array('change'); $valid_open = array('revision'); $i = 0; while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag,'history','close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { if ( empty($current_tag) ) { $result[$tagname] = $tag['value']; } else { $result[$current_tag][$i][$tagname] = $tag['value']; } } break; case $this->typecheck($tag, $valid_loops, 'complete'): { if ( empty($current_tag) ) { $result[$tagname][] = $tag['value']; } else { $result[$current_tag][$i][$tagname][] = $tag['value']; } } break; case $this->typecheck($tag, $valid_open, 'open'): { $current_tag = $tagname; } break; case $this->typecheck($tag, $valid_open, 'close'): { $current_tag = ''; $i++; } break; default: { $result[$tagname] = $tag['value']; } break; } } } function process($data) { return $data; } } // handles the actions in action-group class action_group_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('sql', 'diy-instructions'); $valid_loops = array('copy'); $valid_open = array('open'); while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag, 'action-group', 'close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { $result[$tagname] = $tag['value']; } break; case $this->typecheck($tag, $valid_loops, 'complete'): { $result[$tagname][] = $tag['attributes']; } break; case $this->typecheck($tag, $valid_open, 'open'); { $handler = str_replace('-', '_', $tagname) . '_handler'; if ( class_exists($handler) ) { if ( !isset($this->handlers[$handler]) ) { $this->handlers[$handler] = new $handler; } $result[$tagname][$tag['attributes']['file']] = call_user_func_array(array(&$this->handlers[$handler],'parse'),array(&$values,$tag,$filename)); } else { if ( !isset($this->handlers['default']) ) { $this->handlers['default'] = new handler; } // if we're just skipping parsing this one, we can pass it to an empty handler if ( true || class_exists($handler) ) { $result[$tagname][$tag['attributes']['file']][] = call_user_func_array(array(&$this->handlers['default'],'parse'),array(&$values,$tag,$filename)); } } } break; default: { $this->parse_error(__CLASS__,$tag,__LINE__,"Invalid tag",$filename); } break; } } } function process($data) { return $data; } } // handles tags in the open and action group class open_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('find'); $valid_loops = array('change', 'comment', 'action'); $valid_open = array('edit'); $valid_new = array('inline-edit'); $i = 0; while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag,'open','close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { if ( empty($current_tag) ) { $result[$tagname] = $tag['value']; } else { $result[$current_tag][$i][$tagname] = $tag['value']; } } break; case $this->typecheck($tag, $valid_loops, 'complete'): { if ( empty($current_tag) ) { if ( $tagname == 'action' ) { $result[$tagname][] = array( 'type' => $tag['attributes']['type'], 'code' => $tag['value']); } else { $result[$tagname][] = $tag['value']; } } else { if ( $tagname == 'action' ) { $result[$current_tag][$i][$tagname][] = array( 'type' => $tag['attributes']['type'], 'code' => $tag['value']); } else { $result[$current_tag][$i][$tagname][] = $tag['value']; } } } break; case $this->typecheck($tag, $valid_open, 'open'): { $current_tag = $tagname; } break; case $this->typecheck($tag, $valid_open, 'close'): { $current_tag = ''; $i++; } break; case $this->typecheck($tag, $valid_new, 'open'); { $handler = str_replace('-', '_', $tagname) . '_handler'; if ( class_exists($handler) ) { if ( !isset($this->handlers[$handler]) ) { $this->handlers[$handler] = new $handler; } if ( empty($current_tag) ) { $result[$tagname][] = call_user_func_array(array(&$this->handlers[$handler],'parse'),array(&$values,$tag,$filename)); } else { $result[$current_tag][$i][$tagname][] = call_user_func_array(array(&$this->handlers[$handler],'parse'),array(&$values,$tag,$filename)); } } else { if ( !isset($this->handlers['default']) ) { $this->handlers['default'] = new handler; } // if we're just skipping parsing this one, we can pass it to an empty handler if ( true || class_exists($handler) ) { if ( empty($current_tag) ) { $result[$tagname][] = call_user_func_array(array(&$this->handlers['default'],'parse'),array(&$values,$tag,$filename)); } else { $result[$current_tag][$i][$tagname][] = call_user_func_array(array(&$this->handlers['default'],'parse'),array(&$values,$tag,$filename)); } } } } break; default: { $result[$tagname] = $tag['value']; } break; } } } function process($data) { return $data; } } // handles tags in the inline, open, and action group class inline_edit_handler extends handler { function parse(&$values,$tag,$filename = '') { $result = array(); $valid_keys = array('inline-find'); $valid_loops = array('inline-action'); $i = 0; while ( $tag = array_shift($values) ) { $tagname = $tag['tag']; switch ( true ) { case $this->typecheck($tag,'inline-edit','close'): { return $result; } break; case $this->typecheck($tag, $valid_keys, 'complete'): { $result[$tagname] = $tag['value']; } break; case $this->typecheck($tag, $valid_loops, 'complete'): { $result[$tagname][] = array( 'type' => $tag['attributes']['type'], 'code' => $tag['value']); } break; default: { $result[$tagname] = $tag['value']; } break; } } } function process($data) { return $data; } } ?> --- NEW FILE: sql_template_parser.php --- <?php if ( $_POST['submit'] ) { $sql = new em_sql_parser; $sql->load_sql_template(); $query = $sql->parse_sql($_POST['query']); echo 'The Query: '; vd($query); } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <textarea name="query"><?php echo $_POST['query']; ?></textarea> <input type="submit" name="submit" value="Go" /> </form> <?php } class em_sql_parser { var $sql_tpls = array(); var $sql_types = array(); function load_sql_template() { global $phpbb_root_path, $phpEx; //$tpl_filename = $phpbb_root_path . 'admin/em_includes/schema/' . SQL_LAYER . '.' . $phpEx; $tpl_filename = 'mysql.php'; include($tpl_filename); $this->sql_tpls = $tpl; $this->sql_types = $types; return; } /* CREATE TABLE mytable ( FirstName varchar(40) NOT NULL DEFAULT '', `LastName` varchar(40), DateOfBirth int(11) NULL, `SSN` int(11) UNSIGNED DEFAULT '0' auto_increment, KEY DateOfBirth (DateOfBirth), PRIMARY KEY (SSN) ); ALTER TABLE `mytable` ADD nut_test int(8) NULL DEFAULT '0', abool tinyint(1) ; ALTER TABLE mytable ADD nut_test2 int(8) ; ALTER TABLE mytable MODIFY nut_test varchar(10) NULL DEFAULT '' auto_increment; ALTER TABLE mytable DROP nut_test ; DROP TABLE mytable; */ // // REQUIREMENTS // // - Each query end in ; // - Queries start out for MySQL // function parse_sql($query) { // explode the query so we can see whether it is CREATE, UPDATE, ALTER, etc $temp = explode(' ', $query); $type = $temp[0]; unset($temp); $parsed_query = ''; switch($type) { case 'CREATE': $parsed_query = $this->parse_sql_create($query); break; case 'ALTER': $parsed_query = $this->parse_sql_alter($query); break; // be careful with this case 'DROP': $parsed_query = $this->parse_sql_drop($query); break; // do these really need to be translated to other DB types? // maybe a separate case for DELETE so we can add extra precautions for it case 'INSERT': case 'UPDATE': case 'DELETE': $parsed_query = $query; break; } return $parsed_query; } function parse_sql_create($query) { preg_match('#CREATE TABLE (.*?) \((.*?)\);#s', $query, $matches); $parsed_query = str_replace('{NAME}', $matches[1], $this->sql_tpls['create']); $columns_array = explode(',', trim($matches[2])); $parsed_columns = array(); foreach($columns_array as $column) { //$column = str_replace(',', '', $column); $temp = explode(' ', trim($column)); // normal key if ( $temp[0] == 'KEY' ) { $temp[2] = str_replace('(', '', str_replace(')', '', $temp[2])); $parsed_columns[] = str_replace('{COLUMN1}', $temp[1], str_replace('{COLUMN2}', $temp[2], $this->sql_tpls['create_key'])); } // primary key else if ( $temp[0] == 'PRIMARY' ) { $temp[2] = str_replace('(', '', str_replace(')', '', $temp[2])); $parsed_columns[] = str_replace('{COLUMN}', $temp[2], $this->sql_tpls['create_primary_key']); } // normal column to create else { // this will require some work in order to figure out what is what on each line $parsed_columns[] = str_replace('`', '', stripslashes(trim($column))); } } $parsed_query = str_replace('{COLUMNS}', implode(",\n", $parsed_columns), $parsed_query); return $parsed_query; } function parse_sql_alter($query) { } function parse_sql_drop($query) { } } function vd($data) { echo '<pre>'; var_dump($data); echo '</pre>'; } ?> --- NEW FILE: mysql.php --- <?php $tpl['create'] = 'CREATE TABLE {NAME} ( {COLUMNS} );'; $tpl['create_columns'] = '{NAME} {TYPE} ({LENGTH}) {SIGNED} {NULL} {DEFAULT} {INCREMENT}'; $tpl['create_key'] = 'KEY {COLUMN1} ({COLUMN2})'; $tpl['create_primary_key'] = 'PRIMARY KEY ({COLUMN})'; // // array( // 'mysql_type' => 'db_type'); // $types = array( 'varchar' => 'varchar', 'int' => 'int', 'text' => 'text'); ?> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:40
|
Update of /cvsroot/easymod/easymod/install/em_files/language/lang_english In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install/em_files/language/lang_english Added Files: index.htm lang_easymod.php Log Message: First commit to SourceForge. Enjoy! --- NEW FILE: lang_easymod.php --- <?php /** * * @package EasyMOD * @version $Id: lang_easymod.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU General Public License * */ // ACP Menu $lang['EM_1_Install'] = 'Install MODs'; $lang['EM_2_History'] = 'History'; $lang['EM_3_Settings'] = 'Settings'; $lang['EM_4_Logs'] = 'Logs'; // General $lang['EM_Easymod'] = 'EasyMOD'; $lang['EM_Welcome'] = 'Welcome to EasyMOD'; $lang['EM_Version'] = 'Version %s'; $lang['EM_Please_login'] = 'Please login'; $lang['EM_Access_denied'] = 'Access denied, please try again'; $lang['EM_Copyright'] = 'Created by the <a href="%s">phpBB MOD team</a>'; $lang['EM_Mod_steps'] = 'Step %s of 5'; $lang['EM_Goto_2'] = 'Go to Step 2'; $lang['EM_Goto_3'] = 'Go to step 3'; $lang['EM_Goto_4'] = 'Go to step 4'; $lang['EM_Goto_5'] = 'Go to step 5'; $lang['EM_From'] = 'From'; $lang['EM_To'] = 'To'; // MOD Management $lang['EM_Install_MODs'] = 'Install MODs'; $lang['EM_Install_MODs_explain'] = 'These MODs appear in your MODs directory and have not been installed on your board. Clicking "Install" initiates a multi-step installation. Your current phpBB files will not be overwritten until the final step.'; $lang['EM_History'] = 'History'; $lang['EM_History_explain'] = 'This page lists all the MODs currently installed on your board.'; $lang['EM_Available_mods'] = 'Available MODs'; $lang['EM_Installed_mods'] = 'Installed MODs'; $lang['EM_No_installed_mods'] = 'You currently have <b>no</b> MODs installed'; $lang['EM_No_available_mods'] = 'There are currently <b>no</b> available MODs in your MOD directory'; $lang['EM_Mod_status'] = 'Status'; $lang['EM_Uninstall'] = 'Uninstall'; $lang['EM_More_info'] = 'More Info'; $lang['EM_Preview'] = 'Preview'; $lang['EM_Install'] = 'Install'; $lang['EM_Update'] = 'Update'; $lang['EM_Status_ready'] = 'MOD Ready'; $lang['EM_Status_style'] = 'Style Update Needed'; $lang['EM_Mod_info'] = 'MOD Information'; $lang['EM_Mod_name'] = 'MOD Name'; $lang['EM_Mod_description'] = 'MOD Description'; $lang['EM_Mod_version'] = 'MOD Version'; $lang['EM_Mod_author'] = 'MOD Author'; $lang['EM_Mod_file'] = 'MOD File'; $lang['EM_Author_notes'] = 'Author Notes'; $lang['EM_Commands_processed'] = 'Processed Commands'; $lang['EM_Commands_unprocessed'] = 'Unprocessed Commands'; $lang['EM_NA'] = 'N/A'; $lang['EM_Install_check'] = 'Checking MOD actions'; $lang['EM_Install_check_desc'] = 'This checks the MOD actions to tell you which ones will be processed and which ones won\'t.'; $lang['EM_Install_perform'] = 'Performing File Edits'; $lang['EM_Install_perform_desc'] = 'EasyMOD will now edit the files according to the MOD Instructions. The edited files are placed within a folder named \'processed\' in the same folder as the MOD\'s install file'; $lang['EM_Install_sql_check'] = 'Checking SQL Queries'; $lang['EM_Install_sql_check_desc'] = 'Checking queries to make sure they are valid and translating the queries to your database type. Please check which queries you want to perform'; $lang['EM_Sql_query'] = 'SQL Query'; $lang['EM_Sql_perform'] = 'Perform SQL?'; $lang['EM_Install_sql_perform'] = 'Performing SQL Queries'; $lang['EM_Install_sql_perform_desc'] = 'EasyMOD will now perform the SQL queries that you told checked on the previous step.'; $lang['EM_Install_post'] = 'Post Process'; $lang['EM_Install_post_desc'] = 'EasyMOD will now create backups and move any files into place. If there are any DIY Instructions for the MOD, you should do those now! If all goes well, the MOD will now be installed'; $lang['EM_Copy_files'] = 'Copying Files'; $lang['EM_Backup_files'] = 'Making Backups'; $lang['EM_DIY_instructions'] = '\'Do-it-Yourself\' Instructions'; $lang['EM_DIY_instructions_desc'] = 'EasyMOD will <strong>NOT</strong> perform these instructions. You <strong>MUST</strong> do them yourself before the MOD will be fully installed'; $lang['EM_Mod_install_success'] = 'EasyMOD installed the MOD successfully!'; // Logs $lang['EM_Logs'] = 'Logs'; $lang['EM_Logs_explain'] = 'This page lists all the actions carried out managing MODs. You can sort by username, date or IP. You can also clear individual log events or the log as a whole.'; $lang['EM_No_log_events'] = 'There are currently <b>no</b> events stored in the EasyMOD log'; $lang['EM_Display_events'] = 'Display events from previous'; $lang['EM_All_Events'] = 'All Events'; // Logs Events // a) basic HTML formatting is fine here, ie. <b> <i> <u> or <br /> // b) parameter markers can be used. add_log() works like sprintf. $lang['EM_Log_event_cleared'] = '<strong>Cleared EasyMOD log</strong>'; $lang['EM_Log_install'] = '<strong>Installed MOD</strong><br /><em>MOD: %s<br />Version: %s</em>'; // General $lang['EM_General'] = 'Settings'; $lang['EM_General_explain'] = 'This page allows you to control your EasyMOD settings, and other general areas.'; $lang['EM_General_settings'] = 'General Settings'; $lang['EM_Mod_dir'] = 'MODs Directory'; $lang['EM_Mod_dir_explain'] = 'This will be the directory path of your MODs folder, relative to your phpBB root.'; $lang['EM_Settings_updated'] = 'EasyMOD Settings Updated Successfully'; $lang['EM_Click_return_general'] = 'Click %sHere%s to return to EasyMOD General'; $lang['EM_Password_settings'] = 'Password Settings'; $lang['EM_Password'] = 'EasyMOD Password'; $lang['EM_Password_confirm'] = 'EasyMOD Password Confirm'; $lang['EM_Passwords_no_match'] = 'The passwords you supplied do not match'; $lang['EM_Password_updated'] = 'EasyMOD Password Updated Successfully'; $lang['EM_method'] = 'Write/Move Method'; $lang['EM_temp_path'] = 'Temporary Path'; $lang['EM_file_perm'] = 'File Permissions'; $lang['EM_dir_perm'] = 'Directory Permissions'; $lang['EM_ftp_conn'] = 'FTP Connection Settings'; $lang['EM_ftp_user'] = 'Username'; $lang['EM_ftp_pass'] = 'Password'; $lang['EM_ftp_host'] = 'Host'; $lang['EM_ftp_path'] = 'Path to phpBB'; $lang['EM_ftp_port'] = 'Port'; $lang['EM_ftp_time'] = 'Timeout'; // // Installer // $lang['EM_Welcome_install'] = 'Weclome to the EasyMOD Installer'; $lang['EM_step'] = 'Step %s of 6'; // methods/debug information $lang['EM_Passed'] = '<span style="color: green;">Passed</span>'; $lang['EM_Failed'] = '<span style="color: red;">Failed</span>'; $lang['EM_Skipped'] = 'Skipped'; $lang['EM_On'] = 'On'; $lang['EM_Off'] = 'Off'; // general debug info $lang['EM_php_version'] = 'PHP Version'; $lang['EM_phpbb_version'] = 'phpBB Version'; $lang['EM_em_version'] = 'Current EasyMOD Version'; $lang['EM_em_install_version'] = 'EasyMOD Install Version'; $lang['EM_Not_installed'] = 'Not Installed'; $lang['EM_tmp_write'] = 'Temporary Write Access'; $lang['EM_safe_mode'] = 'Safe Mode'; // server debug info $lang['EM_server'] = 'Server'; $lang['EM_write'] = 'Write Access'; $lang['EM_write_root'] = 'Write Root Access'; $lang['EM_chmod'] = 'CHMOD Access'; $lang['EM_delete'] = 'Delete Access'; $lang['EM_mkdir'] = 'Make Directory Access'; // ftp debug info $lang['EM_ftp_php'] = 'FTP (php extension)'; $lang['EM_ftp_extension'] = 'php FTP Extension'; // help information // format: // $lang['EM_Help_topics']['name-for-#'] = array( // 'title' => 'title-for-help-section', // 'desc' => 'paragraph-or-two-explaining-section'); $lang['EM_Help'] = 'EasyMOD Help'; $lang['EM_Help_topics']['password'] = array( 'title' => 'Password', 'desc' => 'This is the password that you will use to be able to access the EasyMOD files within the Admin Control Panel. It can be left blank.'); $lang['EM_Help_topics']['password_confirm'] = array( 'title' => 'Password Confirm', 'desc' => 'Put the same thing in this field as you did with the <em>Password</em> field. This is to confirm that you didn\'t make a typo and enter in the wrong password. Leave this blank if you have left the <em>Password</em> field blank.'); $lang['EM_Help_topics']['write_move_methods'] = array( 'title' => 'Write/Move Methods', 'desc' => 'These are the different methods that EasyMOD can use on your server to write and move the files around. The Prefered methods, if avaliable, are <em>Server</em> and <em>FTP (php extension)</em>.'); $lang['EM_Help_topics']['tmp_path'] = array( 'title' => 'Temporary Path', 'desc' => 'If <em>Temporary write access</em> has failed (See the <em>General</em> section in the <em>Debug Information</em>), then this needs to be set to a directory that is chmodded to either 666 or 777.'); ?> --- 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> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:40
|
Update of /cvsroot/easymod/easymod/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install Added Files: em_install.php index.htm Log Message: First commit to SourceForge. Enjoy! --- NEW FILE: em_install.php --- <?php /** * * @package EasyMOD * @version $Id: em_install.php,v 1.1 2005/12/04 03:12:30 wgeric Exp $ * @copyright (c) 2005 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License * * @TODO Need to optimize a lot of the script * @TODO Function for checking temp write access * @TODO Work on the debug/error handler * @TODO Help for everything * */ define('EM_INSTALL_VERSION', '0.0.1'); define('IN_EM_INSTALL', true); define('IN_PHPBB', true); $phpbb_root_path = './../'; $em_dir = 'install/em_files/'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); include($phpbb_root_path . $em_dir . 'includes/em/em_common.'.$phpEx); $help = request_var('help', ''); if ( !empty($help) ) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['ENCODING']; ?>"> <meta http-equiv="Content-Style-Type" content="text/css"> <title><?php echo $lang['EM_Help'];?></title> <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css"> <style type="text/css"> <!-- th { background-image: url('../templates/subSilver/images/cellpic3.gif') } td.cat { background-image: url('../templates/subSilver/images/cellpic1.gif') } td.rowpic { background-image: url('../templates/subSilver/images/cellpic2.jpg'); background-repeat: repeat-y } td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom { background-image: url('../templates/subSilver/images/cellpic1.gif') } /* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */ @import url("../templates/subSilver/formIE.css"); //--> </style> </head> <body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#5584AA"> <table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> <tr> <td class="bodyline" width="100%"> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th><?php echo $lang['EM_Help']; ?></th> </tr> <?php $i = 0; foreach($lang['EM_Help_topics'] as $name => $values) { $row_class = ( $i % 2 ) ? 'row1' : 'row2'; ?> <tr> <td class="cat"><span class="cattitle"><a name="<?php echo $name; ?>"></a><?php echo $values['title']; ?></span></td> </tr> <tr> <td class="<?php echo $row_class; ?>"><span class="gen"><?php echo nl2br($values['desc']); ?><br /><br /><a href="javascript:window.close();"><?php echo $lang['Close_window']; ?></a></span></td> </tr> <tr> <td class="spaceRow" height="1"><img src="<?php echo $phpbb_root_path; ?>templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td> </tr> <?php $i++; } ?> </table> </td> </tr> <tr> <td><p class="copyright" align="center"><a href="http://www.phpbb.com/" class="copyright">EasyMOD</a> © 2005 phpBB Group</p></td> </tr> </table> </body> </html> <?php exit; } $step = request_var('step', 1); if ( isset($board_config['em_version']) && $board_config['em_version'] == EM_INSTALL_VERSION ) { //message_die(GENERAL_MESSAGE, 'This version of EasyMOD is already installed'); } $error = false; $board_config['em_pass'] = $password = request_var('password', ''); $password_confirm = request_var('password_confirm', ''); $sel_method = request_var('method', ( !empty($board_config['em_method']) ) ? $board_config['em_method'] : ''); $board_config['em_tmp_path'] = $tmp_path = request_var('tmp_path', ''); $board_config['em_ftp_host'] = $ftp_host = request_var('ftp_host', ''); $board_config['em_ftp_port'] = $ftp_port = request_var('ftp_port', 21); $board_config['em_ftp_timeout'] = $ftp_timeout = request_var('ftp_timeout', 10); $board_config['em_ftp_username'] = $ftp_username = request_var('ftp_username', ''); $board_config['em_ftp_password'] = $ftp_password = request_var('ftp_password', ''); $board_config['em_ftp_root_path'] = $ftp_root_path = request_var('ftp_root_path', ''); if ( $step == 2 ) { $board_config['em_pass'] = $password = md5($password); $password_confirm = md5($password_confirm); $key = ''; for($i = 1, $total = strlen($password); $i < $total; $i = round(($i+1)*2)) { $key .= md5($password{$i}); } $board_config['em_ftp_password'] = $ftp_password = $crypt->encrypt($ftp_password, $key); } $hidden_fields = '<input type="hidden" name="password" value="' . $password . '" />'; if ( $step != 5 ) { $hidden_fields .= '<input type="hidden" name="method" value="' . $sel_method . '" />'; $hidden_fields .= '<input type="hidden" name="tmp_path" value="' . $tmp_path . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_host" value="' . $ftp_host . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_port" value="' . $ftp_port . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_timeout" value="' . $ftp_timeout . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_username" value="' . $ftp_username . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_password" value="' . $ftp_password . '" />'; $hidden_fields .= '<input type="hidden" name="ftp_root_path" value="' . $ftp_root_path . '" />'; } if ( $step > 1 && (empty($sel_method) || !file_exists($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $sel_method . '.'.$phpEx)) ) { message_die(GENERAL_ERROR, 'No method selected'); } switch($step) { // test the settings case 2: // check to make sure passwords match if ( $password != $password_confirm ) { message_die(GENERAL_ERROR, 'Passwords don\'t match'); } include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $sel_method . '.'.$phpEx); page_header(); ?> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th>Testing Connections</th> </tr> <tr> <td class="row1"><span class="gen"> <?php $error = $mod_io->test_connection(); ?> </span></td> </tr> <tr> <td class="row1"><span class="gen"> <?php if ( $error !== true ) { ?> <p style="color: red; font-weight: bold;">Error testing the connection. Please go back and change the connection settings</p> </td> </tr> <tr> <td class="cat"><input type="hidden" name="step" value="1" /><input type="submit" value="Back to step 1" name="submit" class="mainoption" /></td> </tr> <?php } else { ?> <p style="color: green; font-weight: bold;">Connection test was successful!</p> </td> </tr> <tr> <td class="cat"><input type="hidden" name="step" value="3" /><?php echo $hidden_fields; ?><input type="submit" value="Go to step 3" name="submit" class="mainoption" /></td> </tr> <?php } ?> </table> <?php break; // Make the edits to the files case 3: include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $sel_method . '.'.$phpEx); $error = $mod_io->init(); page_header(); ?> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th>Edit files</th> </tr> <tr> <td class="row1"><span class="gen">No edits will be done at this time ;)</span></td> </tr> <tr> <td class="cat"><input type="hidden" name="step" value="4" /><?php echo $hidden_fields; ?><input type="submit" value="Go to step 4" name="submit" class="mainoption" /></td> </tr> </table> <?php break; // make backups, move files case 4: include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $sel_method . '.'.$phpEx); $error = $mod_io->init(); page_header(); ?> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th class="thLeft">From</th> <th class="thTop">To</th> <th class="thRight">Status</th> </tr> <tr> <td class="cat" colspan="3"><span class="cattitle">Create Backups and Move the files</span></td> </tr> <?php // long list of files ... $file = array(); $files[] = array('to' => './../admin/em_manage.php', 'from' => './../install/em_files/admin/em_manage.php'); $files[] = array('to' => './../admin/em_logs.php', 'from' => './../install/em_files/admin/em_logs.php'); $files[] = array('to' => './../admin/em_history.php', 'from' => './../install/em_files/admin/em_history.php'); $files[] = array('to' => './../admin/admin_easymod.php', 'from' => './../install/em_files/admin/admin_easymod.php'); $files[] = array('to' => './../admin/em_general.php', 'from' => './../install/em_files/admin/em_general.php'); $files[] = array('to' => './../includes/em/em_functions.php', 'from' => './../install/em_files/includes/em/em_functions.php'); $files[] = array('to' => './../includes/em/em_processing.php', 'from' => './../install/em_files/includes/em/em_processing.php'); $files[] = array('to' => './../includes/em/em_acp_menu.php', 'from' => './../install/em_files/includes/em/em_acp_menu.php'); $files[] = array('to' => './../includes/em/em_functions_20x.php', 'from' => './../install/em_files/includes/em/em_functions_20x.php'); $files[] = array('to' => './../includes/em/em_mcrypt.php', 'from' => './../install/em_files/includes/em/em_mcrypt.php'); $files[] = array('to' => './../includes/em/em_parser_text.php', 'from' => './../install/em_files/includes/em/em_parser_text.php'); //$files[] = array('to' => './../includes/em/em_functions_30x.php', 'from' => './../install/em_files/includes/em/em_functions_30x.php'); $files[] = array('to' => './../includes/em/em_crypt.php', 'from' => './../install/em_files/includes/em/em_crypt.php'); $files[] = array('to' => './../includes/em/index.htm', 'from' => './../install/em_files/includes/em/index.htm'); $files[] = array('to' => './../includes/em/em_methods_server.php', 'from' => './../install/em_files/includes/em/em_methods_server.php'); $files[] = array('to' => './../includes/em/em_methods_ftp.php', 'from' => './../install/em_files/includes/em/em_methods_ftp.php'); $files[] = array('to' => './../includes/em/em_actions.php', 'from' => './../install/em_files/includes/em/em_actions.php'); $files[] = array('to' => './../includes/em/em_common.php', 'from' => './../install/em_files/includes/em/em_common.php'); $files[] = array('to' => './../includes/em/em_methods_ftp_fsock.php', 'from' => './../install/em_files/includes/em/em_methods_ftp_fsock.php'); $files[] = array('to' => './../includes/em/em_parser_xml.php', 'from' => './../install/em_files/includes/em/em_parser_xml.php'); //$files[] = array('to' => './../includes/em/em_methods_ssh2.php', 'from' => './../install/em_files/includes/em/em_methods_ssh2.php'); $files[] = array('to' => './../language/lang_english/lang_easymod.php', 'from' => './../install/em_files/language/lang_english/lang_easymod.php'); $files[] = array('to' => './../templates/subSilver/admin/em_check_install.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_check_install.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_login.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_login.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_check_sql.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_check_sql.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_mod_info.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_mod_info.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_post_process.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_post_process.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_logs.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_logs.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_check_update.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_check_update.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_mod_info_rows.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_mod_info_rows.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_check_uninstall.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_check_uninstall.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_preview.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_preview.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_manage_install.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_manage_install.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_header.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_header.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_manage_history.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_manage_history.tpl'); $files[] = array('to' => './../templates/subSilver/admin/em_general.tpl', 'from' => './../install/em_files/templates/subSilver/admin/em_general.tpl'); $files[] = array('to' => './../templates/subSilver/images/em_update.gif', 'from' => './../install/em_files/templates/subSilver/images/em_update.gif'); $files[] = array('to' => './../templates/subSilver/images/em_moreinfo.gif', 'from' => './../install/em_files/templates/subSilver/images/em_moreinfo.gif'); $files[] = array('to' => './../templates/subSilver/images/em_install.gif', 'from' => './../install/em_files/templates/subSilver/images/em_install.gif'); $files[] = array('to' => './../templates/subSilver/images/em_uninstall.gif', 'from' => './../install/em_files/templates/subSilver/images/em_uninstall.gif'); $files[] = array('to' => './../templates/subSilver/images/em_preview.gif', 'from' => './../install/em_files/templates/subSilver/images/em_preview.gif'); $files[] = array('to' => './../templates/subSilver/images/easymod.gif', 'from' => './../install/em_files/templates/subSilver/images/easymod.gif'); $files[] = array('to' => './../templates/subSilver/images/em_status_ready.gif', 'from' => './../install/em_files/templates/subSilver/images/em_status_ready.gif'); $files[] = array('to' => './../templates/subSilver/images/em_status_style.gif', 'from' => './../install/em_files/templates/subSilver/images/em_status_style.gif'); if( @file_exists($em_root_path . "includes/sql/sql_parser.$phpEx") ) { $files[] = array('to' => './../includes/sql/sql_builder_mysql.php', 'from' => './../install/em_files/includes/sql/sql_builder_mysql.php'); $files[] = array('to' => './../includes/sql/sql_builder_postgresql.php', 'from' => './../install/em_files/includes/sql/sql_builder_postgresql.php'); $files[] = array('to' => './../includes/sql/sql_reserved_keywords.php', 'from' => './../install/em_files/includes/sql/sql_reserved_keywords.php'); $files[] = array('to' => './../includes/sql/sql_parser.php', 'from' => './../install/em_files/includes/sql/sql_parser.php'); $files[] = array('to' => './../includes/sql/sql_builder_mssql.php', 'from' => './../install/em_files/includes/sql/sql_builder_mssql.php'); $files[] = array('to' => './../includes/sql/sql_builder.php', 'from' => './../install/em_files/includes/sql/sql_builder.php'); $files[] = array('to' => './../language/lang_english/lang_sql_parser.php', 'from' => './../install/em_files/language/lang_english/lang_sql_parser.php'); } for($i = 0, $total = sizeof($files); $i < $total; $i++) { $cur_dir = dirname($files[$i]['to']); if(!@is_dir($cur_dir)) { ?> <tr> <td class="row3" colspan="2"><span class="gen">Making directory <strong><?php echo $cur_dir; ?></strong></span></td> <td class="row3" align="center"><span class="gen"><strong> <?php if ( !$mod_io->make_dir($cur_dir) ) { echo $lang['EM_Failed']; } else { echo $lang['EM_Passed']; } ?> </strong></span></td> </tr> <?php } ?> <tr> <td class="row1" width="40%"><span class="gen"><?php echo $files[$i]['from']; ?></span></td> <td class="row2" width="40%"><span class="gen"><?php echo $files[$i]['to']; ?></span></td> <td class="row1" width="20%" align="center"><span class="gen"><strong> <?php if (!$mod_io->copy_file($files[$i]['from'], $files[$i]['to'])) { echo $lang['EM_Failed']; } else { echo $lang['EM_Passed']; } ?> </strong></span></td> </tr> <?php } ?> <tr> <td class="cat" colspan="3"><input type="hidden" name="step" value="5" /><?php echo $hidden_fields; ?><input type="submit" value="Go to step 5" name="submit" class="mainoption" /></td> </tr> </table> <?php break; // run sql case 5: include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $sel_method . '.'.$phpEx); $error = $mod_io->init(); $sql = array(); $sql[] = build_config_query('em_version', EM_INSTALL_VERSION); $sql[] = build_config_query('em_pass', (string) $password); $sql[] = build_config_query('em_method', (string) $sel_method); $sql[] = build_config_query('em_tmp_path', (string) $tmp_path); $sql[] = build_config_query('em_ftp_host', (string) $ftp_host); $sql[] = build_config_query('em_ftp_port', (int) $ftp_port); $sql[] = build_config_query('em_ftp_timeout', (int) $ftp_timeout); $sql[] = build_config_query('em_ftp_username', (string) $ftp_username); /** * @TODO encrypt the ftp password somehow, blowfish? */ $sql[] = build_config_query('em_ftp_password', (string) $ftp_password); $sql[] = build_config_query('em_ftp_root_path', (string) $ftp_root_path); page_header(); ?> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th>Sql Queries</th> </tr> <tr> <td class="row1"><span class="gen">Doing some sql processing. Look in the schema folder for the rest of the queries that aren't being performed.<br /><br /> <?php $queries_success = true; for($i = 0, $total = sizeof($sql); $i < $total; $i++) { $result = $db->sql_query($sql[$i]); if ( !$result ) { $queries_success = false; } echo 'Performing sql ... ' . (( !$result ) ? $lang['EM_Failed'] : $lang['EM_Passed']) . '<br />'; echo htmlspecialchars($sql[$i]) . '<br /><br />'; } if ( !$queries_success ) { ?> <p style="color: red; font-weight: bold;">Some of the SQL Queries failed. Check them before proceeding</p> <?php } else { ?> <p style="color: green; font-weight: bold;">SQL Queries were successful!</p> <?php } ?> </span></td> </tr> <tr> <td class="cat"><input type="hidden" name="step" value="6" /><?php echo $hidden_fields; ?><input type="submit" value="Finish install" name="submit" class="mainoption" /></td> </tr> </table> <?php break; // test to make sure install went successfully case 6: page_header(); ?> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th>Checking Install</th> </tr> <tr> <td class="row1"><span class="gen"> <?php $success = true; echo 'Checking for admin/admin_easymod.' . $phpEx . ' ...'; if ( file_exists($phpbb_root_path . 'admin/admin_easymod.'.$phpEx) && filesize($phpbb_root_path . 'admin/admin_easymod.'.$phpEx) > 0 ) { echo '<strong>Success!</strong><br />'; } else { echo '<strong>Error!</strong><br />'; $success = false; } echo 'Checking for templates/subSilver/admin/em_general.tpl ...'; if ( file_exists($phpbb_root_path . 'templates/subSilver/admin/em_general.tpl') && filesize($phpbb_root_path . 'templates/subSilver/admin/em_general.tpl') > 0 ) { echo '<strong>Success!</strong><br />'; } else { echo '<strong>Error!</strong><br />'; $success = false; } echo 'Checking for $board_config[\'em_pass\'] ...'; if ( $board_config['em_pass'] == $password ) { echo '<strong>Success!</strong><br />'; } else { echo '<strong>Error!</strong><br />'; $success = false; } echo 'Checking for $board_config[\'em_method\'] ...'; if ( $board_config['em_method'] == $sel_method ) { echo '<strong>Success!</strong><br />'; } else { echo '<strong>Error!</strong><br />'; $success = false; } ?> </span></td> </tr> <tr> <?php if ( $success ) { add_log('EM_Log_install', 'EasyMOD', EM_INSTALL_VERSION); ?> <td class="row1"><span class="gen"> <p style="color: green; font-weight: bold;">Install successful!</p> <a href="<?php echo append_sid("{$phpbb_root_path}index.$phpEx"); ?>">Return to Index</a> </span></td> <?php } else { ?> <td class="row1"><span class="gen"> <p style="color: red; font-weight: bold;">Install failed!</p> <a href="<?php echo append_sid("{$phpbb_root_path}install/em_install.$phpEx"); ?>">Return to Step 1</a> </span></td> <?php } ?> </tr> </table> <?php break; // get the settings case 1: default: page_header(); // // general debug information // $debug = array(); // php version $debug['general']['php_version'] = phpversion(); // phpbb version $debug['general']['phpbb_version'] = '2' . $board_config['version']; // easymod version $debug['general']['em_version'] = ( !empty($board_config['em_version']) ) ? $board_config['em_version'] : $lang['EM_Not_installed']; $debug['general']['em_install_version'] = EM_INSTALL_VERSION; // check writing temp files $tmp = true; if ( $tmpfname = @tempnam(( ( !empty($board_config['em_tmp_path']) ) ? $board_config['em_tmp_path'] : '/tmp'), 'em_')) { @unlink($tmpfname); if ( $fp = @fopen($tmpfname, 'w') ) { // remember to clean up! @fwrite($fp, "EM TEST\n"); @fclose($fp); @unlink($tmpfname); $debug['general']['tmp_write'] = true; } else { $debug['general']['tmp_write'] = false; } } else { $debug['general']['tmp_write'] = false; } // safe mode? if ( @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' ) { $debug['general']['safe_mode'] = $lang['EM_On']; } else { $debug['general']['safe_mode'] = $lang['EM_Off']; } ?> <tr valign="top"> <td width="200"> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th class="thTop" colspan="2">Debug Information</th> </tr> <?php // load the methods and the debug information $method_files = array(); $methods = load_methods('install/em_files/'); for($i = 0, $total = sizeof($methods); $i < $total; $i++) { include($phpbb_root_path . $em_dir . 'includes/em/em_methods_' . $methods[$i]['file'] . '.'. $phpEx); $mod_io->test($debug, $methods[$i]['name']); $method_files[$methods[$i]['name']] = $methods[$i]['file']; } $allowed_methods = '<select name="method">'; foreach($debug as $method => $options) { $method_lang = ( isset($lang['EM_' . $method]) ) ? $lang['EM_' . $method] : str_replace('_', ' ', $method); ?> <tr> <td class="cat" colspan="2"><span class="cattitle"><?php echo $method_lang; ?></span></td> </tr> <?php foreach($options as $option => $allowed) { if ( $option == 'allowed' ) { $allowed_methods .= ( $allowed ) ? '<option value="' . $method_files[$method] . '">' . $method_lang . '</option>' : ''; } else { ?> <tr> <td class="row1"><span class="gen"><?php echo ( isset($lang['EM_' . $option]) ) ? $lang['EM_' . $option] : str_replace('_', ' ', $option); ?></span></td> <td class="row1"><span class="gen"><?php if ( is_bool($allowed) ) { echo ( $allowed ) ? $lang['EM_Passed']: $lang['EM_Failed']; } else { echo $allowed; } ?></span></td> </tr> <?php } } } $allowed_methods .= '</select>'; /** * @TODO make these more clear, add popups for help information */ ?> </table> </td> <td> <table border="0" cellpadding="3" cellspacing="1" class="forumline" width="100%"> <tr> <th colspan="2">EasyMOD Settings</th> </tr> <tr> <td class="cat" colspan="2"><span class="cattitle">General Settings</span></td> </tr> <tr> <td class="row1" width="200"><span class="gen">Password</span></td> <td class="row1"><span class="gen"><input type="password" name="password" class="post" /> <a href="javascript:help_popup('password');">Help</a></span></td> </tr> <tr> <td class="row1"><span class="gen">Password confirm</span></td> <td class="row1"><span class="gen"><input type="password" name="password_confirm" class="post" /> <a href="javascript:help_popup('password_confirm');">Help</a></span></td> </tr> <tr> <td class="row1"><span class="gen">Write/Move Method</span></td> <td class="row1"><span class="gen"><?php echo $allowed_methods; ?> <a href="javascript:help_popup('write_move_methods');">Help</a></span></td> </tr> <tr> <td class="row1"><span class="gen">Temporary Path</span></td> <td class="row1"><span class="gen"><input type="text" name="tmp_path" value="/tmp" class="post" /> <a href="javascript:help_popup('tmp_path');">Help</a></span></td> </tr> <tr> <td class="cat" colspan="2"><span class="cattitle">FTP Connection Settings</span></td> </tr> <tr> <td class="row1"><span class="gen">Username</span></td> <td class="row1"><span class="gen"><input type="text" name="ftp_username" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Password</span></td> <td class="row1"><span class="gen"><input type="password" name="ftp_password" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Host</span></td> <td class="row1"><span class="gen"><input type="text" name="ftp_host" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Path to phpBB</span></td> <td class="row1"><span class="gen"><input type="text" name="ftp_root_path" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Port</span></td> <td class="row1"><span class="gen"><input type="text" name="ftp_port" value="21" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Timeout</span></td> <td class="row1"><span class="gen"><input type="text" name="ftp_timeout" value="10" class="post" /></span></td> </tr> <tr> <td class="cat" colspan="2"><span class="cattitle">SSH/SFTP Connection Settings</span></td> </tr> <tr> <td class="row1"><span class="gen">Username</span></td> <td class="row1"><span class="gen"><input type="text" name="ssh2_username" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Password</span></td> <td class="row1"><span class="gen"><input type="password" name="ssh2_password" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Host</span></td> <td class="row1"><span class="gen"><input type="text" name="ssh2_host" class="post" /></span></td> </tr> <tr> <td class="row1"><span class="gen">Port</span></td> <td class="row1"><span class="gen"><input type="text" name="ssh2_port" value="22" class="post" /></span></td> </tr> <tr> <td class="cat" colspan="2"><input type="hidden" name="step" value="2" /><input type="submit" name="submit" value="Go to step 2" class="mainoption" /> <input type="submit" name="rescan" value="Rescan" class="liteoption" /></td> </tr> </table> </td> <?php break; } if ( !is_bool($error) ) { em_handle_error(EM_ERR_INSTALL, $error); } page_footer(); //---------------------------------------------------------------------------------// // Functions //---------------------------------------------------------------------------------// function get_files($dir) { $files = array(); if ($handle = @opendir($dir)) { while (($file = @readdir($handle)) !== false) { if((@is_dir($dir . $file)) && ($file != ".") && ($file != "..") && (strpos($file, 'CVS') === false) && (strpos($file, '~') === false)) { $dir_files = get_files($dir . $file . '/'); foreach($dir_files as $sub_file) { $files[] = $sub_file; } } elseif (($file != ".") && ($file != "..") && (strpos($file, 'CVS') === false) && (strpos($file, '~') === false)) { $files[] = $dir . $file; } } closedir($handle); } else { echo '<b>[!]</b> Im sorry Dave, I cannot do that ... er ... because I couldn\'t open ' . $dir . '<br/>'; } return $files; } function build_config_query($name, $value) { global $db; $name = "'" . str_replace("\'", "''", $name) . "'"; if ( is_string($value) ) { $value = "'" . str_replace("\'", "''", $value) . "'"; } else { $value = intval($value); } $sql = "SELECT config_value FROM " . CONFIG_TABLE . " WHERE config_name = $name"; if(!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not get config value', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); if ( isset($row['config_value']) ) { $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = $value WHERE config_name = $name"; } else { $sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) VALUES ($name, $value)"; } return $sql; } function em_debug_display() { global $board_config, $lang, $mod_io; global $sel_method, $tmp_path; global $ftp_host, $ftp_port, $ftp_timeout, $ftp_username, $ftp_password, $ftp_root_path; $tmp_write = false; if ( $tmpfname = @tempnam(( ( !empty($tmp_path) ) ? $tmp_path : '/tmp'), 'em_')) { @unlink($tmpfname); if ( $fp = @fopen($tmpfname, 'w') ) { // remember to clean up! @fwrite($fp, "EM TEST\n"); @fclose($fp); @unlink($tmpfname); $tmp_write = true; } else { $tmp_write = false; } } else { $tmp_write = false; } ?> <strong>[b]PHP Version[/b]</strong>: <?php echo phpversion(); ?><br /> <strong>[b]phpBB Version[/b]</strong>: 2.<?php echo $board_config['version']; ?><br /> <strong>[b]EM Version[/b]</strong>: <?php echo ( !empty($board_config['em_version']) ) ? $board_config['em_version'] : $lang['EM_Not_installed']; ?><br /> <strong>[b]EM Install Version[/b]</strong>: <?php echo EM_INSTALL_VERSION; ?><br /> <strong>[b]TMP Write Access[/b]</strong>: <?php echo ( $tmp_write ) ? '[color=green]' . $lang['EM_Passed'] . '[/color]': '[color=red]' . $lang['EM_Failed'] . '[/color]'; ?><br /> <strong>[b]Safe Mode[/b]</strong>: <?php echo ( @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' ) ? 'On' : 'Off'; ?><br /><br /> <strong>[b]Selected Method[/b]</strong>: <?php echo $sel_method; ?><br /> <strong>[b]Tmp Path[/b]</strong>: <?php echo $tmp_path; ?><br /> <strong>[b]FTP Host[/b]</strong>: <?php echo $ftp_host; ?><br /> <strong>[b]FTP Port[/b]</strong>: <?php echo $ftp_port; ?><br /> <strong>[b]FTP Timeout[/b]</strong>: <?php echo $ftp_timeout; ?><br /> <strong>[b]FTP Username[/b]</strong>: <?php echo $ftp_username; ?><br /> <strong>[b]FTP Password[/b]</strong>: <?php echo ( !empty($ftp_password) ) ? '********' : 'None'; ?><br /> <strong>[b]FTP Root Path[/b]</strong>: <?php echo $ftp_root_path; ?><br /><br /> <?php $test_results = $mod_io->test_connection(); ?> <br /><br /> <?php $debug = array(); $mod_io->test($debug, 'temp'); foreach($debug['temp'] as $option => $allowed) { if ( $option == 'allowed' ) { continue; } ?> <strong>[b]<?php echo ( isset($lang['EM_' . $option]) ) ? $lang['EM_' . $option] : str_replace('_', ' ', $option); ?>[/b]</strong>: <?php if ( is_bool($allowed) ) { echo ( $allowed ) ? '[color=green]' . $lang['EM_Passed'] . '[/color]': '[color=red]' . $lang['EM_Failed'] . '[/color]'; } else { echo $allowed; } ?><br /> <?php } return; } function page_header($text = '', $form_action = false) { global $phpbb_root_path, $phpEx, $lang, $step; if ( defined('HEADER_DISPLAY') ) { return; } define('HEADER_DISPLAY', true); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['ENCODING']; ?>"> <meta http-equiv="Content-Style-Type" content="text/css"> <title><?php echo $lang['EM_Welcome_install'];?></title> <link rel="stylesheet" href="../templates/subSilver/subSilver.css" type="text/css"> <style type="text/css"> <!-- th { background-image: url('../templates/subSilver/images/cellpic3.gif') } td.cat { background-image: url('../templates/subSilver/images/cellpic1.gif') } td.rowpic { background-image: url('../templates/subSilver/images/cellpic2.jpg'); background-repeat: repeat-y } td.catHead,td.catSides,td.catLeft,td.catRight,td.catBottom { background-image: url('../templates/subSilver/images/cellpic1.gif') } /* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */ @import url("../templates/subSilver/formIE.css"); //--> </style> <script language="javascript"> <!-- function help_popup(item) { window.open('<?php echo $phpbb_root_path; ?>install/em_install.<?php echo $phpEx; ?>?help=1#' + item, 'help', 'width=600,height=500,resizable=yes,toolbar=no,scrollbars=yes,location=no,directories=no,status=no,menubar=no,copyhistory=no'); } --> </script> </head> <body bgcolor="#E5E5E5" text="#000000" link="#006699" vlink="#5584AA"> <table width="100%" border="0" cellspacing="0" cellpadding="10" align="center"> <tr> <td class="bodyline" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td> <td align="center" width="100%" valign="middle"><span class="maintitle"><?php echo $lang['EM_Welcome_install'];?></span></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td colspan="2"><table width="90%" border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td><h4><?php echo sprintf($lang['EM_step'], $step); ?></h4><?php if ( !empty($text) ) { ?><span class="gen"><?php echo $text; ?></span><?php } ?></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> <tr> <td width="100%"><table width="100%" cellpadding="2" cellspacing="1" border="0"><form action="<?php echo ($form_action) ? $form_action : 'em_install.'.$phpEx; ?>" name="install" method="post"> <?php } function page_footer() { if ( defined('FOOTER_DISPLAY') ) { return; } define('FOOTER_DISPLAY', true); ?> </table></form></td> </tr> </table> <p class="copyright" align="center"><a href="http://www.phpbb.com/" class="copyright">EasyMOD</a> © 2005 phpBB Group</p> </td> </tr> </table> </body> </html> <?php } ?> --- 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> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:39
|
Update of /cvsroot/easymod/easymod/install/em_files/language In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install/em_files/language Added Files: index.htm Log Message: First commit to SourceForge. Enjoy! --- 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> |
From: Eric F. <wg...@us...> - 2005-12-04 03:12:39
|
Update of /cvsroot/easymod/easymod/install/em_files In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29556/install/em_files Added Files: index.htm Log Message: First commit to SourceForge. Enjoy! --- 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> |