PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.5
VikBooking Hotel Booking Engine & PMS v1.6.5
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / admin / views / edittmplfile / tmpl / default.php

default.php in VikBooking Hotel Booking Engine & PMS 1.6.5, at admin/views/edittmplfile/tmpl/default.php

78 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage com_vikbooking
5 * @author Alessio Gaggii - e4j - Extensionsforjoomla.com
6 * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 * @link https://vikwp.com
9 */
10
11 defined('ABSPATH') or die('No script kiddies please!');
12
13 $fpath = $this->fpath;
14
15 $editor = JEditor::getInstance('codemirror');
16 $fcode = '';
17 $fp = !empty($fpath) ? fopen($fpath, "rb") : false;
18 if (empty($fpath) || $fp === false) {
19 ?>
20 <p class="err"><?php echo JText::translate('VBOTMPLFILENOTREAD'); ?></p>
21 <?php
22 } else {
23 while (!feof($fp)) {
24 $fcode .= fread($fp, 8192);
25 }
26 fclose($fp);
27 ?>
28 <form name="adminForm" id="adminForm" action="index.php" method="post">
29 <fieldset class="adminform">
30 <legend class="adminlegend"><?php echo JText::translate('VBOEDITTMPLFILE'); ?></legend>
31 <p class="vbo-path-tmpl-file"><?php echo $fpath; ?></p>
32 <?php
33 if (interface_exists('Throwable')) {
34 /**
35 * With PHP >= 7 supporting throwable exceptions for Fatal Errors
36 * we try to avoid issues with third party plugins that make use
37 * of the WP native function get_current_screen().
38 *
39 * @wponly
40 */
41 try {
42 echo $editor->display("cont", $fcode, '100%', 300, 70, 20, $buttons = false, $id = "vik_editor_cont", $asset = null, $author = null, $params = ['syntax' => 'php']);
43 } catch (Throwable $t) {
44 echo $t->getMessage() . ' in ' . $t->getFile() . ':' . $t->getLine() . '<br/>';
45 }
46 } else {
47 // we cannot catch Fatal Errors in PHP 5.x
48 echo $editor->display("cont", $fcode, '100%', 300, 70, 20, $buttons = false, $id = "vik_editor_cont", $asset = null, $author = null, $params = ['syntax' => 'php']);
49 }
50 ?>
51 <br clear="all" />
52 <p style="text-align: center;">
53 <button type="button" class="btn btn-success" onclick="vboSubmitTmplFile(this);"><?php echo JText::translate('VBOSAVETMPLFILE'); ?></button>
54 </p>
55 </fieldset>
56 <input type="hidden" name="path" value="<?php echo $fpath; ?>">
57 <input type="hidden" name="option" value="com_vikbooking" />
58 <input type="hidden" name="task" value="savetmplfile" />
59 <?php echo JHtml::fetch('form.token'); ?>
60 </form>
61
62 <script type="text/javascript">
63 function vboSubmitTmplFile(elem) {
64 /**
65 * @wponly the real textarea may not update with the new codemirror content
66 * and so we force the update of the textarea before submitting the form.
67 */
68 try {
69 Joomla.editors.instances['vik_editor_cont'].element.codemirror.save();
70 } catch (err) {
71 console.error(err);
72 }
73 jQuery(elem).closest('form').submit();
74 }
75 </script>
76 <?php
77 }
78