Blame view

js/_tiny_mce/plugins/ajaxfilemanager/ajax_text_editor.php 5.89 KB
42868d70   andryeyev   Создал GIT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  <?php
  		/**
  	 * Ajax image editor platform
  	 * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  	 * @link www.phpletter.com
  	 * @since 22/May/2007
  	 *
  	 */
  	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
  		$session->gc();
  		$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
  		if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
  		{
  				$path = $_GET['path'];
  		}else 
  		{
  			die(TXT_FILE_NOT_FOUND);
  		}
  		if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
  		{
  			$syntax = getFileExt($path);			
  		}else 
  		{
  			switch (getFileExt($path))
  			{
  				case 'htm':
  					$syntax = 'html';
  					break;
  				default:
  					$syntax = 'basic';
  			}
  		}
  		if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
  		{
  			die(TXT_DISALLOWED_EXT);	
  		}
  	?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="author" content="Logan Cai" />
  <meta name="website" content="http://www.phpletter.com" />
  <script type="text/javascript" src="jscripts/ajaxtexteditor_compressed.js"></script>
  <!--<script type="text/javascript" src="jscripts/jquery.js"></script>
  <script type="text/javascript" src="jscripts/form.js"></script>
  <script type="text/javascript" src="jscripts/select.js"></script>
  <script type="text/javascript" src="jscripts/jqModal.js"></script>
  <script type="text/javascript" src="jscripts/ajax_text_editor_general.js"></script>
  -->
  <script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
  <script type="text/javascript">
  				var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
  				var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
  				var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
  				var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
  				var currentFolder = '<?php echo dirname($path); ?>';
  				var currentName = '<?php echo basename($path); ?>';
  
  		jQuery(document).ready(
  		function()
  		{
  				editAreaLoader.init({				
  				id: "content"	// id of the textarea to transform		
  				,start_highlight: false	// if start with highlight
  				,allow_resize: "both"
  				,gecko_spellcheck:true
  				,allow_toggle: true
  				,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as"
  				,save_callback:"save"
  				,save_as_callback:"save_as"
  				,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
  				,syntax: "<?php echo $syntax; ?>"	
  			});				
  				jQuery('#windowSaveAs').jqm();		
  				jQuery('#windowProcessing').jqm({modal:true});				
  		}
  	);		
  
  		
  
  			
  </script>
  
  <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/editor.css" type="text/css" rel="stylesheet" />
  <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
  <title>Ajax Text Editor</title>
  </head>
  <body>
  
  <div id="pageBody">
  	<textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea>
  </div>
  <div id="windowProcessing" class="jqmWindow" style="display:none">
  	<form name="frmProcessing" id="frmProcessing" method="POST" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
  		<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
  		<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />	
  		<input type="hidden" name="save_as_request" id="save_as_request" value="0" />
  		<div style="display:none"><textarea name="text" id="text"></textarea></div> 
  	</form> 
  	<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
  	<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
  </div>
  <div id="windowSaveAs" class="jqmWindow" style="display:none">
      	<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
        <form id="formSaveAs" name="formSaveAs" action="" method="post">
      	<table class="tableForm" cellpadding="0" cellspacing="0">
        	<thead>
          	<tr>
            	<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
            </tr>
          </thead>
          <tbody>
          	<tr>
            	<th>
              	<label><?php echo IMG_LBL_NEW_NAME; ?></label>
              </th>
              <td>
              	<input type="text" id="new_name" class="input" name="new_name" value="" />
                &nbsp;.&nbsp;<select id="ext" name="ext">
                <?php
  								foreach(getValidTextEditorExts() as $v)
  								{
  									?>
  									<option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option>
  									<?php
  								}
  							?>
                </select>
              </td>
            </tr>
            <tr>
            	<th>
              	<label><?php echo IMG_LBL_SAVE_TO; ?></label>
              </th>
              <td>
              	<select class="input" name="save_to" id="save_to">
                	
                </select>
              </td>
            </tr>
            <tr>
            	<th>&nbsp;
              </th>
              <td>
              <span class="comments">*</span>
              <?php echo IMG_NEW_NAME_COMMENTS; ?>
              </td>
            </tr>
          </tbody>
          <tfoot>
          	<tr>
          	<th>&nbsp;</th>
            <td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return do_save_as();" /></td>
            </tr>
          </tfoot>
        </table>
        </form>
      </div>
  
  </body></html>