[Easymod-cvs] easymod2/mods/easymod/includes mod_diy_body.tpl,NONE,1.1 admin_easymod.php.txt,1.4,1.5
Status: Beta
Brought to you by:
wgeric
From: Eric F. <wg...@us...> - 2005-05-06 22:23:53
|
Update of /cvsroot/easymod/easymod2/mods/easymod/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18339/mods/easymod/includes Modified Files: admin_easymod.php.txt Added Files: mod_diy_body.tpl Log Message: - Added DIY INSTRUCTIONS. I have it displayed after the SQL Processing screen, may want to move to After Post process screen - Also fixed a bug, I should make sure everything works before commiting --- NEW FILE: mod_diy_body.tpl --- <h2>{L_STEP}</h2> <h3>{L_ALTERATIONS}</h3> <p>{L_DIY_INTRO}</p> <form method="post" action="{S_ACTION}"> <table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline"> <tr> <th height="25" class="thHead" nowrap="nowrap">Notice</th> </tr> <tr> <td class="row1"><table border="0" cellpadding="3" cellspacing="1" width="100%"> <tr> <td align="center"> </td> </tr> <tr> <td width="100%"><span class="gen"> <ul> <!-- BEGIN diyrow --> <li>{diyrow.INSTRUCTIONS}</li> <!-- END diyrow --> </ul> </span></td> </tr> <tr> <td align="center"> </td> </tr> </table> </td> </tr> <tr> <td class="catBottom" align="center" height="28"> {HIDDEN} <input type="hidden" name="mode" value="{MODE}"> <input type="hidden" name="SQL_lines" value="{SQL_LINES}"> <input type="hidden" name="themes" value="{THEMES}"> <input type="hidden" name="languages" value="{LANGUAGES}"> <input type="hidden" name="files" value="{FILES}"> <input type="hidden" name="num_proc" value="{PROCESSED}"> <input type="hidden" name="num_unproc" value="{UNPROCESSED}"> <input type="hidden" name="install_file" value="{MOD_FILE}"> <input type="hidden" name="install_path" value="{MOD_PATH}"> <input type="hidden" name="password" value="{EM_PASS}"> <input type="submit" name="post" class="mainoption" value="{L_COMPLETE}" /></center> </td> </tr> </table> <br /> </form> <br /> Index: admin_easymod.php.txt =================================================================== RCS file: /cvsroot/easymod/easymod2/mods/easymod/includes/admin_easymod.php.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** admin_easymod.php.txt 1 May 2005 12:23:18 -0000 1.4 --- admin_easymod.php.txt 6 May 2005 22:23:44 -0000 1.5 *************** *** 654,658 **** ($mode != 'display_backup') && ($mode != 'download_backup') && ($mode != 'SQL_view') && ($mode != 'SQL_execute') && ! ($mode != 'update') && ($mode != 'process') && ($mode != 'post_process')) { $mode = 'install' ; --- 654,658 ---- ($mode != 'display_backup') && ($mode != 'download_backup') && ($mode != 'SQL_view') && ($mode != 'SQL_execute') && ! ($mode != 'update') && ($mode != 'process') && ($mode != 'post_process') && ($mode != 'diy_process')) { $mode = 'install' ; *************** *** 1394,1397 **** --- 1394,1401 ---- $current_command = 'SQL' ; } + else if ( strstr($buffer, 'DIY INSTRUCTIONS') ) + { + $current_command = 'DIY INSTRUCTIONS'; + } else if (strstr($buffer, 'SAVE/CLOSE')) { *************** *** 1502,1506 **** fclose($f_mod_script); - // load the process mod template unless we are in special case mode if (($mode != 'display_file') && ($mode != 'download_file')) --- 1506,1509 ---- *************** *** 1808,1811 **** --- 1811,1819 ---- } + else if ( $commands[$i]['command'] == 'DIY INSTRUCTIONS') + { + $diy[] = $body[$i]; + } + // // setup the copying of files from the mod directory to core directories *************** *** 2355,2358 **** --- 2363,2376 ---- $hidden .= '<input type="hidden" name="num_sql_steps" value="' . $i . "\">\n" ; + // put DIY INSTRUCTIONS in hidden fields + for($i = 0; $i < count($diy); $i++ ) + { + $line = '' ; + for ($j=0; $j<count($diy[$i]); $j++) + { + $line .= $diy[$i][$j] ; + } + $hidden .= '<input type="hidden" name="diy_array[]" value="' . htmlspecialchars($line) . "\" />\n"; + } $template->assign_block_vars('success', array( *************** *** 2362,2366 **** 'L_NEXT_STEP' => $lang['EM_next_step'], - 'TITLE' => $mod_title, 'INSTALL_PATH' => $print_path, --- 2380,2383 ---- *************** *** 2395,2398 **** --- 2412,2416 ---- $num_proc = (isset($HTTP_POST_VARS['num_proc'])) ? intval($HTTP_POST_VARS['num_proc']) : 0 ; $num_unproc = (isset($HTTP_POST_VARS['num_unproc'])) ? intval($HTTP_POST_VARS['num_unproc']) : 0 ; + $diy = (isset($HTTP_POST_VARS['diy_array'])) ? $HTTP_POST_VARS['diy_array'] : array(); // get the post process operations and prepare to send them to the next step *************** *** 2409,2412 **** --- 2427,2435 ---- $hidden .= '<input type="hidden" name="num_command_steps" value="' . $i . "\">\n" ; + // put DIY instructions in hidden vars + for($i = 0; $i < count($diy); $i++ ) + { + $hidden .= '<input type="hidden" name="diy_array[]" value="' . stripslashes(htmlspecialchars($diy[$i])) . "\" />\n"; + } // get the SQL commands we are going to translate *************** *** 2525,2528 **** --- 2548,2553 ---- // fill the template $template->assign_vars(array( + 'S_ACTION' => append_sid($phpbb_root_path . 'admin/admin_easymod.'.$phpEx), + 'L_STEP' => $lang['EM_sql_step2'], 'L_SQL_ALPHA2' => $lang['EM_SQL_Alpha2'], *************** *** 2554,2558 **** 'MOD_FILE' => $install_file, 'MOD_PATH' => $install_path, ! 'MODE' => ($error == '') ? 'SQL_execute' : 'post_process', 'HIDDEN' => $hidden, 'EM_PASS' => $password) --- 2579,2583 ---- 'MOD_FILE' => $install_file, 'MOD_PATH' => $install_path, ! 'MODE' => ( ($error == '') ? 'SQL_execute' : (( count($diy) ) ? 'diy_process' : 'post_process') ), 'HIDDEN' => $hidden, 'EM_PASS' => $password) *************** *** 2568,2571 **** --- 2593,2597 ---- $num_proc = (isset($HTTP_POST_VARS['num_proc'])) ? intval($HTTP_POST_VARS['num_proc']) : 0 ; $num_unproc = (isset($HTTP_POST_VARS['num_unproc'])) ? intval($HTTP_POST_VARS['num_unproc']) : 0 ; + $diy = (isset($HTTP_POST_VARS['diy_array'])) ? $HTTP_POST_VARS['diy_array'] : array(); // get the post process operations and prepare to send them to the next step *************** *** 2582,2585 **** --- 2608,2616 ---- $hidden .= '<input type="hidden" name="num_command_steps" value="' . $i . "\">\n" ; + // put DIY instructions in hidden vars + for($i = 0; $i < count($diy); $i++ ) + { + $hidden .= '<input type="hidden" name="diy_array[]" value="' . stripslashes(htmlspecialchars($diy[$i])) . "\" />\n"; + } // get the SQL commands we are going to execute *************** *** 2673,2677 **** 'MOD_FILE' => $install_file, 'MOD_PATH' => $install_path, ! 'MODE' => 'post_process', 'HIDDEN' => $hidden, 'EM_PASS' => $password) --- 2704,2708 ---- 'MOD_FILE' => $install_file, 'MOD_PATH' => $install_path, ! 'MODE' => ( count($diy) ) ? 'diy_process' : 'post_process', 'HIDDEN' => $hidden, 'EM_PASS' => $password) *************** *** 2679,2684 **** --- 2710,2784 ---- } + // + // show the DIY instructions + // move below post_process? + // + else if ( $mode == 'diy_process' ) + { + // get the vars we are passing along + $themes = (isset($HTTP_POST_VARS['themes'])) ? htmlspecialchars($HTTP_POST_VARS['themes']) : '' ; + $languages = (isset($HTTP_POST_VARS['languages'])) ? htmlspecialchars($HTTP_POST_VARS['languages']) : '' ; + $files = (isset($HTTP_POST_VARS['files'])) ? intval($HTTP_POST_VARS['files']) : 0 ; + $num_proc = (isset($HTTP_POST_VARS['num_proc'])) ? intval($HTTP_POST_VARS['num_proc']) : 0 ; + $num_unproc = (isset($HTTP_POST_VARS['num_unproc'])) ? intval($HTTP_POST_VARS['num_unproc']) : 0 ; + $diy = (isset($HTTP_POST_VARS['diy_array'])) ? $HTTP_POST_VARS['diy_array'] : array(); + + // get the post process operations and prepare to send them to the next step + $num_command_steps = (isset($HTTP_POST_VARS['num_command_steps'])) ? intval($HTTP_POST_VARS['num_command_steps']) :0; + $hidden = '' ; + for ( $i=0; $i<$num_command_steps; $i++) + { + $var_name = 'command_step' . $i ; + if ( isset($HTTP_POST_VARS[$var_name])) + { + $hidden .= '<input type="hidden" name="command_step'.$i.'" value="' . $HTTP_POST_VARS[$var_name]."\">\n"; + } + } + $hidden .= '<input type="hidden" name="num_command_steps" value="' . $i . "\">\n" ; + // explode each new line so they can have their own bullet + $diy_process = array(); + for( $i = 0; $i < count($diy); $i++ ) + { + $diy_process = array_merge($diy_process, explode("\n", $diy[$i])); + } + for( $i = 0; $i < count($diy_process); $i++ ) + { + $diy_process[$i] = trim($diy_process[$i]); + if ( !empty($diy_process[$i]) ) + { + $template->assign_block_vars('diyrow', array( + 'INSTRUCTIONS' => stripslashes(htmlspecialchars($diy_process[$i]))) + ); + } + } + + // Show the SQL template + $template->set_filenames(array( + 'body' => 'admin/mod_diy_body.tpl') + ); + + // fill the template + $template->assign_vars(array( + 'L_STEP' => $lang['EM_sql_step2'], + 'L_DIY_INTRO' => '\'Do it yourself\' instructions need to be executed by you manually, EasyMOD will not perform these actions', + + 'L_COMPLETE' => $lang['EM_complete_install'], + + 'THEMES' => $themes, + 'LANGUAGES' => $languages, + 'FILES' => $files, + 'PROCESSED' => $num_proc, + 'UNPROCESSED' => $num_unproc, + 'SQL_LINES' => $num_sql_lines, + 'MOD_FILE' => $install_file, + 'MOD_PATH' => $install_path, + 'MODE' => 'post_process', + 'HIDDEN' => $hidden, + 'EM_PASS' => $password) + ); + + } // // last step! move the files into place - force this step if in preview mode |