'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) { // edit file global $mainframe, $mosConfig_live_site; if(($GLOBALS["permissions"]&01)!=01) { ext_Result::sendResult('edit', false, ext_Lang::err('accessfunc' )); } $fname = ext_TextEncoding::fromUTF8(get_abs_item($dir, $item)); if(!get_is_file($fname)) { ext_Result::sendResult('edit', false, ext_TextEncoding::toUTF8($item).": ".ext_Lang::err('fileexist' )); } if(!get_show_item($dir, $item)) { ext_Result::sendResult('edit', false, $item.": ".ext_Lang::err('accessfile' )); } // CSRF Security Check if( !ext_checkToken($GLOBALS['__POST']["token"]) ) { ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.'); } if(isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"]=="yes") { // Save / Save As $item=basename(stripslashes($GLOBALS['__POST']["fname"])); $fname2=ext_TextEncoding::fromUTF8(get_abs_item($dir, $item)); if(!isset($item) || $item=="") { ext_Result::sendResult('edit', false, ext_Lang::err('miscnoname' )); } if($fname!=$fname2 && @$GLOBALS['ext_File']->file_exists($fname2)) { ext_Result::sendResult('edit', false, $item.": ".ext_Lang::err('itemdoesexist' )); } $this->savefile($fname2); $fname=$fname2; ext_Result::sendResult('edit', true, ext_Lang::msg('savefile').': '.$item ); } if(isset($GLOBALS['__POST']["doreopen"]) && $GLOBALS['__POST']["doreopen"]=="yes") { // File Reopen $extra = Array(); $content = $GLOBALS['ext_File']->file_get_contents( $fname ); if( get_magic_quotes_runtime()) { $content = stripslashes( $content ); } $langs = $GLOBALS["language"]; if ($langs == "japanese"){ $_encoding = $GLOBALS['__POST']["file_encoding"]; if ($content){ $content = mb_convert_encoding($content, "UTF-8", $_encoding); } $extra["file_encoding"] = $_encoding; } $extra["content"] = $content; ext_Result::sendResult('edit', true, ext_Lang::msg('reopenfile').': '.$item, $extra); } // header $s_item=get_rel_item($dir,$item); if(strlen($s_item)>50) $s_item="...".substr($s_item,-47); $id_hash = substr('f'.md5($s_item),0, 10); $s_info = pathinfo( $s_item ); $s_extension = str_replace('.', '', $s_info['extension'] ); switch (strtolower($s_extension)) { case 'txt': $cp_lang = 'basic'; break; case 'cs': $cp_lang = 'csharp'; break; case 'css': $cp_lang = 'css'; break; case 'html': case 'htm': case 'xhtml': $cp_lang = 'html'; break; case 'java': $cp_lang = 'java'; break; case 'js': $cp_lang = 'js'; break; case 'pl': $cp_lang = 'perl'; break; case 'py': $cp_lang = 'python'; break; case 'ruby': $cp_lang = 'ruby'; break; case 'sql': $cp_lang = 'sql'; break; case 'vb': case 'vbs': $cp_lang = 'vb'; break; case 'php': $cp_lang = 'php'; break; case 'xml': $cp_lang = 'xml'; break; default: $cp_lang = ''; } $content = $GLOBALS['ext_File']->file_get_contents( $fname ); if( get_magic_quotes_runtime()) { $content = stripslashes( $content ); } $cw = 250; $langs = $GLOBALS["language"]; if ($langs == "japanese"){ $cw = 200; if ($content){ $_encoding = strtoupper(mb_detect_encoding($content, Array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN"), true)); $content = mb_convert_encoding($content, "UTF-8", $_encoding); if ($_encoding == "SJIS-WIN"){ $_encoding_label = "SJIS"; } elseif ($_encoding == "EUCJP-WIN"){ $_encoding_label = "EUC-JP"; } elseif ($_encoding == "ISO-2022-JP"){ $_encoding_label = "JIS"; } elseif ($_encoding == "ASCII"){ $_encoding_label = "UTF-8"; } else { $_encoding_label = $_encoding; } } else { $_encoding_label = "UTF-8"; } } ?> { "xtype": "form", "id": "", "labelWidth": "300", "autoScroll": "true", "url":"", "title": " 50 ? substr( htmlentities($s_item,ENT_QUOTES), strlen($s_item)-30, 30 ) : htmlentities($s_item,ENT_QUOTES); ?>", "frame": "true", "closable": "true", "tbar": [{ "text": "", "handler": function() { statusBarMessage( '', true ); form = Ext.getCmp("").getForm(); form.submit({ waitMsg: 'Saving the File, please wait...', reset: false, success: function(form, action) { datastore.reload(); statusBarMessage( action.result.message, false, true ); }, failure: function(form, action) { statusBarMessage( action.result.error, false, false ); Ext.Msg.alert('!', action.result.error); }, scope: form, // add some vars to the request, similar to hidden fields params: {option: 'com_extplorer', action: 'edit', code: editAreaLoader.getValue("ext_codefield"), dir: '', item: '', dosave: 'yes', token: "" } }); }, "cls":"x-btn-text-icon", "icon": "/images/_save.png" },{ "text": "", "handler": function() { statusBarMessage( '', true ); form = Ext.getCmp("").getForm(); form.submit({ waitMsg: 'Processing Data, please wait...', reset: false, success: function(form, action) { statusBarMessage( action.result.message, false, true ); editAreaLoader.setValue("ext_codefield", action.result.content); }, failure: function(form, action) { statusBarMessage( action.result.error, false, false ); Ext.Msg.alert('!', action.result.error); }, scope: form, // add some vars to the request, similar to hidden fields params: { option: 'com_extplorer', action: 'edit', dir: '', item: '', doreopen: 'yes', token: "" } }); }, "cls":"x-btn-text-icon", "icon": "/images/_reload.png" }, { "text": "", "handler": function() { Ext.getCmp("mainpanel").remove( Ext.getCmp("mainpanel").getActiveTab() ); }, "cls":"x-btn-text-icon", "icon": "/images/_cancel.png" }], "items": [{ "xtype": "displayfield", "value": "" }, { "xtype": "textarea", "hideLabel": true, "name": "thecode", "id": "ext_codefield", "fieldClass": "x-form-field", "value": "", "width": "100%", "height": 500, "plugins": new Ext.ux.plugins.EditAreaEditor({ "id" : "ext_codefield", "syntax": "", "start_highlight": true, "display": "later", "toolbar": "search, go_to_line, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help" lang_tbl)){?> ,"language": "lang_tbl[$langs] ?>" }) }, { "width": "", "xtype": "textfield", "fieldLabel": "", "name": "fname", "value": "", "clear": "true" } ,{ "width": "", "style":"margin-left:10px", "clear":"true", "xtype": "combo", "fieldLabel": "", "name": "file_encoding", "store": [ ["UTF-8", "UTF-8"], ["SJIS-WIN", "SJIS"], ["EUCJP-WIN", "EUC-JP"], ["ISO-2022-JP","JIS"] ], "value" : "", "typeAhead": "true", "mode": "local", "triggerAction": "all", "editable": "false", "forceSelection": "true" } ] } file_put_contents( $file_name, $code ); if( $res==false || PEAR::isError( $res )) { $err = basename($file_name).": ".ext_Lang::err('savefile' ); if( PEAR::isError( $res ) ) { $err .= $res->getMessage(); } ext_Result::sendResult( 'edit', false, $err ); } } } //------------------------------------------------------------------------------ ?>