Changeset 20714 for trunk/plugins/LocalFilesEditor/include/tpl.inc.php
- Timestamp:
- Feb 12, 2013, 11:19:57 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/LocalFilesEditor/include/tpl.inc.php
r11654 r20714 1 1 <?php 2 3 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 3 5 $edited_file = isset($_POST['edited_file']) ? $_POST['edited_file'] : ''; 4 $edited_file = ''; 5 6 if (isset($_POST['edit'])) 7 { 8 $_POST['template'] = $_POST['file_to_edit']; 9 } 10 11 if (!empty($_POST['template'])) 12 { 13 if (preg_match('#\.\./#', $_POST['template'])) 14 { 15 die('Hacking attempt! template extension must be in template-extension directory'); 16 } 17 18 if (!preg_match('#\.tpl$#', $_POST['template'])) 19 { 20 die('Hacking attempt! template extension must be a *.tpl file'); 21 } 22 23 $template->assign('template', $_POST['template']); 24 25 $edited_file = './template-extension/'.$_POST['template']; 26 } 27 6 28 $content_file = ''; 7 8 if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) 29 if (file_exists($edited_file)) 9 30 { 10 $edited_file = $_POST['file_to_edit']; 11 if (file_exists($edited_file)) 12 { 13 $content_file = file_get_contents($edited_file); 14 } 15 else 16 { 17 $content_file = ''; 18 } 31 $content_file = file_get_contents($edited_file); 19 32 } 20 33 … … 51 64 else 52 65 { 66 $template->assign('template', $filename); 53 67 $edited_file = $_POST['tpl_parent'] . '/' . $filename; 54 68 $content_file = ($_POST['tpl_model'] == '0') ? '' : file_get_contents($_POST['tpl_model']); … … 118 132 foreach (get_extents() as $pwg_template) 119 133 { 120 $value = './template-extension/' .$pwg_template;134 $value = $pwg_template; 121 135 $options[$value] = str_replace('/', ' / ', $pwg_template); 122 136 if ($edited_file == $value) $selected = $value; … … 127 141 $selected = $edited_file; 128 142 } 129 $template->assign('css_lang_tpl', array( 130 'OPTIONS' => $options, 131 'SELECTED' => $selected, 132 'NEW_FILE_URL' => $my_base_url.'-tpl&newfile', 133 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right' 134 ) 135 ); 143 $template->assign( 144 'css_lang_tpl', 145 array( 146 'SELECT_NAME' => 'file_to_edit', 147 'OPTIONS' => $options, 148 'SELECTED' => $selected, 149 'NEW_FILE_URL' => $my_base_url.'-tpl&newfile', 150 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right' 151 ) 152 ); 136 153 } 137 154
Note: See TracChangeset
for help on using the changeset viewer.