'cs', 'german' => 'de', 'danish' => 'dk', 'english' => 'en', 'esperanto' => 'eo', 'spanish' => 'es', 'french' => 'fr', 'croatian' => 'hr', 'italian' => 'it', 'japanese' => 'ja', 'macedonian' => 'mk', 'dutch' => 'nl', 'polish' => 'pl', 'portuguese' => 'pt', 'russian' => 'ru', 'slovenian' => 'sk' ); function execAction($dir, $item) { if(($GLOBALS["permissions"]&01)!=01) { ext_Result::sendResult('diff', false, ext_Lang::err('accessfunc' )); } $fname = get_abs_item($dir, $item); if(!get_is_file(utf8_decode($fname))) { ext_Result::sendResult('diff', false, $item.": ".ext_Lang::err('fileexist' )); } if(!get_show_item($dir, $item)) { ext_Result::sendResult('diff', false, $item.": ".ext_Lang::err('accessfile' )); } $cnt = 0; if( !empty($GLOBALS['__POST']["selitems"])) { $cnt=count($GLOBALS['__POST']["selitems"]); } $item2 = extGetParam( $_POST, 'item2'); if ($item2 !== null) { $fname2 = get_abs_item('', utf8_decode($item2)); } elseif( $cnt >= 2 ) { $item2 = $GLOBALS['__POST']["selitems"][1]; $fname2 = get_abs_item( $dir, $item2); } if ($item2 !== null) { if(!get_is_file($fname2)) { ext_Result::sendResult('diff', false, $item2.": ".ext_Lang::err('fileexist' )); } if(!get_show_item('', $item2)) { ext_Result::sendResult('diff', false, $item2.": ".ext_Lang::err('accessfile' )); } } elseif( empty( $cnt ) && extGetParam($_POST, 'confirm') == 'true' ) { ext_Result::sendResult('diff', false, 'Please select a second file to diff to'); } if ($item2 || $cnt >= 2) { // Show File In TextArea $content = $GLOBALS['ext_File']->file_get_contents( $fname ); $content2 = $GLOBALS['ext_File']->file_get_contents( $fname2 ); //$content = nl2br(str_replace("\t", "    ", htmlentities($content))); //$content2 = nl2br(str_replace("\t", "    ", htmlentities($content2))); $diff = $this->inline_diff($content, $content2); if( empty( $diff )) { ext_Result::sendResult('diff', true, 'Both Files are identical'); } $diff = utf8_encode( nl2br( $diff ) ); echo '{ "xtype": "panel", "dialogtitle": "Diff Result", "html": "'.str_replace( array("\n", "\r"), array('',''), $diff).'" }'; exit; } ?> { "xtype": "form", "id": "simpleform", "width": "700", "labelWidth": 125, "url":"", "dialogtitle": "Diff ", "title": "Diff", "items": [{ xtype: "textfield", fieldLabel: 'File to Compare', name: 'item2', value: "/", width:175, allowBlank:false }], buttons: [{ "text": "", "handler": function() { statusBarMessage( 'Please wait...', true ); form = Ext.getCmp("simpleform").getForm(); form.submit({ //reset: true, reset: false, success: function(form, action) { Ext.getCmp("dialog").setContent( action.result.message, true ); }, failure: function(form, action) { if( !action.result ) return; Ext.MessageBox.alert('Error!', action.result.error); statusBarMessage( action.result.error, false, true ); }, scope: form, // add some vars to the request, similar to hidden fields params: { "option": "com_extplorer", "action": "diff", "dir": "", "item": "", "selitems[]": [''], confirm: 'true' } }); } },{ "text": "", "handler": function() { Ext.getCmp("dialog").destroy(); } }] } render($diff); } }