LEPTON CMS 7.0.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
function.edit_module_css.php
Go to the documentation of this file.
1<?php
2
19// include secure.php to protect this file and the whole CMS!
20if(!defined("SEC_FILE")){define("SEC_FILE",'/framework/secure.php' );}
21if (defined('LEPTON_PATH')) {
22 include LEPTON_PATH.SEC_FILE;
23} else {
24 $oneback = "../";
25 $root = $oneback;
26 $level = 1;
27 while (($level < 10) && (!file_exists($root.SEC_FILE))) {
28 $root .= $oneback;
29 $level += 1;
30 }
31 if (file_exists($root.SEC_FILE)) {
32 include $root.SEC_FILE;
33 } else {
34 trigger_error(sprintf("[ <b>%s</b> ] Can't include secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
35 }
36}
37// end include secure file
38
43function edit_module_css( string $mod_dir ) : bool
44{
45 global $page_id, $section_id, $TEXT;
46 LEPTON_handle::register("mod_file_exists");
47
48 // check if the required edit_module_css.php file exists
49 if ( !file_exists( LEPTON_PATH . '/modules/edit_module_files.php' ) )
50 {
51 return false;
52 }
53
54 // check if frontend.css or backend.css exist
55 $frontend_css = mod_file_exists( $mod_dir, 'frontend.css' );
56 $backend_css = mod_file_exists( $mod_dir, 'backend.css' );
57
58 // output the "edit CSS" form
59 if ( $frontend_css || $backend_css )
60 {
61 $oTWIG = lib_twig_box::getInstance();
62
63 $oTWIG->loader->prependPath( LEPTON_PATH."/templates/".DEFAULT_THEME."/templates/" );
64
65 $fields = array(
66 'LEPTON_URL' => LEPTON_URL,
67 'page_id' => $page_id,
68 'section_id' => $section_id,
69 'mod_dir' => $mod_dir,
70 'edit_file' => ( $frontend_css ) ? 'frontend.css' : 'backend.css',
71 'label_submit' => $TEXT['CAP_EDIT_CSS']
72 );
73
74 echo $oTWIG->render(
75 'edit_module_css_form.lte',
76 $fields
77 );
78
79 return true;
80 }
81 else
82 {
83 return false;
84 }
85}
edit_module_css(string $mod_dir)
mod_file_exists($mod_dir, $mod_file='frontend.css')