mirror of
https://github.com/Codiad/Codiad.git
synced 2026-03-10 11:16:48 +01:00
change $_POST['action'] to $_GET['action'] check if an extension exists before printing it out.
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
|
|
/*
|
|
* (c) Codiad & ccvca (https://github.com/ccvca)
|
|
* @author ccvca (https://github.com/ccvca)
|
|
* This Code is released under the same licence as Codiad (https://github.com/Codiad/Codiad)
|
|
* See [root]/license.txt for more. This information must remain intact.
|
|
*/
|
|
|
|
require_once 'class.fileextension_textmode.php';
|
|
|
|
//check Session is done in constructor
|
|
$fileExTM = new fileextension_textmode();
|
|
|
|
if(!isset($_GET['action'])){
|
|
die('Missing $_GET["action"]');
|
|
}
|
|
switch($_GET['action']){
|
|
//////////////////////////////////////////////////////////////////
|
|
//The form for edit the assotiations
|
|
//////////////////////////////////////////////////////////////////
|
|
case 'fileextension_textmode_form':
|
|
//////////////////////////////////////////////////////////////////
|
|
//Reading the current extensions
|
|
//////////////////////////////////////////////////////////////////
|
|
$ext = false;
|
|
//ignore warnings
|
|
$ext = @Common::getJSON(fileextension_textmode::storeFilename);
|
|
|
|
if(!is_array($ext)){
|
|
//default extensions
|
|
$ext = $fileExTM->getDefaultExtensions();
|
|
}
|
|
|
|
$textModes = $fileExTM->getAvailiableTextModes();
|
|
|
|
if(!@ksort($ext)){
|
|
die(json_encode(array('status' => 'error', 'msg' => 'Internal PHP error.') ));
|
|
}
|
|
?>
|
|
<div id="FileExtTextModeDiv">
|
|
<label>Edit file extensions</label>
|
|
<table id="FileExtTextModeTable">
|
|
<thead>
|
|
<tr>
|
|
<th>File extension</th>
|
|
<th>Text mode</th></tr>
|
|
</thead>
|
|
<tbody id="FileExtTextModeTableTbody">
|
|
<?php
|
|
foreach($ext as $ex => $mode){
|
|
//////////////////////////////////////////////////////////////////
|
|
//print only valid assotiations
|
|
//////////////////////////////////////////////////////////////////
|
|
if(!$fileExTM->validTextMode($mode)){
|
|
continue;
|
|
}?>
|
|
<tr>
|
|
<td><input class="FileExtension" type="text" name="extension[]" value="<?php echo $ex ?>" /></td>
|
|
<td><?php echo $fileExTM->getTextModeSelect($mode)?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<button class="btn-left" onClick="codiad.fileext_textmode.addFieldToForm()">Add New Extension</button><button class="btn-mid" onClick="codiad.fileext_textmode.sendForm();">Save Scheme</button><button class="btn-right" onClick="codiad.modal.unload();"><?php echo Common::get_i18n('Close')?></button>
|
|
<?php
|
|
break;
|
|
}
|
|
?>
|