43 $xoTheme->addScript(
'browse.php?Frameworks/jquery/jquery.js');
44 $xoTheme->addScript(
'browse.php?Frameworks/jquery/plugins/jquery.ui.js');
45 $xoTheme->addScript(
'modules/system/js/jquery.easing.js');
46 $xoTheme->addScript(
'modules/system/js/jqueryFileTree.js');
47 $xoTheme->addScript(
'modules/system/js/admin.js');
48 $xoTheme->addScript(
'modules/system/js/templates.js');
49 $xoTheme->addScript(
'modules/system/js/code_mirror/codemirror.js');
51 $xoTheme->addStylesheet( XOOPS_URL .
'/modules/system/css/admin.css');
52 $xoTheme->addStylesheet( XOOPS_URL .
'/modules/system/css/code_mirror/docs.css');
64 $GLOBALS[
'xoopsTpl']->assign(
'index',
true);
70 $tplsetlist = $tplset_handler->getList();
72 foreach ($tplsetlist as $key => $name) {
73 $ele->addOption($key, $name);
75 $form->addElement($ele);
84 $modules->addOptionArray($moduleslist);
85 $form->addElement($modules,
true);
95 case 'tpls_generate_surcharge':
96 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
111 $indexFile = XOOPS_ROOT_PATH.
"/modules/system/include/index.html";
112 $verif_write =
false;
115 if (!is_dir($theme_surcharge))
119 if(!is_dir($theme_surcharge))
120 mkdir($theme_surcharge, 0777);
121 chmod($theme_surcharge, 0777);
122 copy($indexFile, $theme_surcharge.
"/index.html");
134 $tplsets_arr = $tplset_handler->getObjects();
135 $tcount = $tplset_handler->getCount();
144 foreach (array_keys($tplsets_arr) as
$i)
146 $tplsetname = $tplsets_arr[
$i]->getVar(
'tplset_name');
147 $tplstats = $tpltpl_handler->getModuleTplCount($tplsetname);
149 if (count($tplstats) > 0)
151 foreach ($tplstats as
$moddir => $filecount)
157 if(!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname')))
159 mkdir($theme_surcharge.
'/'.
$module->getVar(
'dirname'), 0777);
160 chmod($theme_surcharge.
'/'.
$module->getVar(
'dirname'), 0777);
161 copy($indexFile, $theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/index.html');
165 if (!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'))
167 if(!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'))
168 mkdir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks', 0777);
169 chmod($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks', 0777);
170 copy($indexFile, $theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'.
'/index.html');
178 $templates =& $tpltpl_handler->find($tplsetname,
'module', null,
$moddir);
179 for (
$j=0;
$j<count($templates);
$j++)
181 $filename = $templates[
$j]->getVar(
'tpl_file');
182 if ($tplsetname == $tplset)
186 $tplfile =& $tpltpl_handler->get($templates[
$j]->getVar(
'tpl_id'),
true);
188 if (is_object($tplfile))
190 if(!file_exists($physical_file) ||
$_REQUEST[
'force_generated'] == 1) {
191 $open = fopen(
"".$physical_file.
"",
"w+");
192 if(fwrite($open,
"".$tplfile->getVar(
'tpl_source',
'n')))
195 if(file_exists($physical_file)) {
196 $text .=
'<img width="16" src="'.system_AdminIcons(
'success.png').
'" /></td></tr>';
198 $text .=
'<img width="16" src="'.system_AdminIcons(
'cancel.png').
'" /></td></tr>';
203 $class = ($class ==
"even") ?
"odd" :
"even";
210 $btemplates =& $tpltpl_handler->find($tplsetname,
'block', null,
$moddir);
211 for ($k = 0; $k < count($btemplates); $k++)
213 $filename = $btemplates[$k]->getVar(
'tpl_file');
214 if ($tplsetname == $tplset)
217 $btplfile =& $tpltpl_handler->get($btemplates[$k]->getVar(
'tpl_id'),
true);
219 if (is_object($btplfile))
221 if(!file_exists($physical_file) ||
$_REQUEST[
'force_generated'] == 1)
223 $open = fopen($physical_file,
"w+");
224 if(fwrite($open, $btplfile->getVar(
'tpl_source',
'n')))
226 $text .=
'<tr class="'.$class.
'"><td align="center">'.
_AM_SYSTEM_TEMPLATES_BLOCKS.
'</td><td>'.$physical_file.
'</td><td align="center">';
227 if(file_exists($physical_file)) {
228 $text .=
'<img width="16" src="'.system_AdminIcons(
'success.png').
'" /></td></tr>';
230 $text .=
'<img width="16" src="'.system_AdminIcons(
'cancel.png').
'" /></td></tr>';
235 $class = ($class ==
"even") ?
"odd" :
"even";
247 foreach (array_keys($tplsets_arr) as $i)
249 $tplsetname = $tplsets_arr[
$i]->getVar(
'tplset_name');
250 $tplstats = $tpltpl_handler->getModuleTplCount($tplsetname);
252 if (count($tplstats) > 0)
259 if(!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname')))
261 mkdir($theme_surcharge.
'/'.
$module->getVar(
'dirname'), 0777);
262 chmod($theme_surcharge.
'/'.
$module->getVar(
'dirname'), 0777);
263 copy($indexFile, $theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/index.html');
267 if (!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'))
269 if(!is_dir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'))
270 mkdir($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks', 0777);
271 chmod($theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks', 0777);
272 copy($indexFile, $theme_surcharge.
'/'.
$module->getVar(
'dirname').
'/blocks'.
'/index.html');
277 $select_templates_modules =
$_REQUEST[
'select_templates_modules'];
278 for($l=0; $l<count(
$_REQUEST[
'select_templates_modules']); $l++)
281 $templates =& $tpltpl_handler->find($tplsetname,
'module', null,
$moddir);
282 for (
$j=0;
$j<count($templates);
$j++)
284 $filename = $templates[
$j]->getVar(
'tpl_file');
285 if ($tplsetname == $tplset)
289 $tplfile =& $tpltpl_handler->get($templates[
$j]->getVar(
'tpl_id'),
true);
291 if (is_object($tplfile))
293 if(!file_exists($physical_file) ||
$_REQUEST[
'force_generated'] == 1) {
294 if ($select_templates_modules[$l] == $filename)
296 $open = fopen(
"".$physical_file.
"",
"w+");
297 if(fwrite($open,
"".$tplfile->getVar(
'tpl_source',
'n')))
300 if(file_exists($physical_file)) {
301 $text .=
'<img width="16" src="'.system_AdminIcons(
'success.png').
'" /></td></tr>';
303 $text .=
'<img width="16" src="'.system_AdminIcons(
'cancel.png').
'" /></td></tr>';
309 $class = ($class ==
"even") ?
"odd" :
"even";
316 $btemplates =& $tpltpl_handler->find($tplsetname,
'block', null,
$moddir);
317 for ($k = 0; $k < count($btemplates); $k++)
319 $filename = $btemplates[$k]->getVar(
'tpl_file');
320 if ($tplsetname == $tplset)
323 $btplfile =& $tpltpl_handler->get($btemplates[$k]->getVar(
'tpl_id'),
true);
325 if (is_object($btplfile))
327 if(!file_exists($physical_file) ||
$_REQUEST[
'force_generated'] == 1)
329 if ($select_templates_modules[$l] == $filename)
331 $open = fopen(
"".$physical_file.
"",
"w+");
332 if(fwrite($open,
"".$btplfile->getVar(
'tpl_source',
'n').
""))
334 $text .=
'<tr class="'.$class.
'"><td align="center">'.
_AM_SYSTEM_TEMPLATES_BLOCKS.
'</td><td>'.$physical_file.
'</td><td align="center">';
335 if(file_exists($physical_file)) {
336 $text .=
'<img width="16" src="'.system_AdminIcons(
'success.png').
'" /></td></tr>';
338 $text .=
'<img width="16" src="'.system_AdminIcons(
'cancel.png').
'" /></td></tr>';
344 $class = ($class ==
"even") ?
"odd" :
"even";
357 $xoopsTpl->assign(
'verif', $verif_write);
363 $GLOBALS[
'xoopsTpl']->assign(
'index',
true);
370 $templates_arr =& $tpltpl_handler->find($tplset,
'', null,
$_REQUEST[
'select_modules']);
373 foreach (array_keys($templates_arr) as $i)
375 $modules->addOption($templates_arr[$i]->getVar(
'tpl_file'));
377 $form->addElement($modules);
393 if(isset($path_file))
396 $copy_file = $path_file;
397 copy($copy_file, $path_file.
'.back');
401 $open = fopen(
"".$path_file.
"",
"w+");
402 if(!fwrite($open, utf8_encode(stripslashes(
$_REQUEST[
'templates']))))