2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2009-11-12 14:30:07 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2009-11-18 01:06:08 +00:00
|
|
|
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
2009-11-12 14:30:07 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*/
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
require_once("../class2.php");
|
2017-01-17 01:33:03 +01:00
|
|
|
|
2016-01-13 19:17:37 -08:00
|
|
|
if (!getperms("1"))
|
|
|
|
{
|
|
|
|
e107::redirect('admin');
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2009-08-28 16:11:02 +00:00
|
|
|
|
2017-01-17 01:33:03 +01:00
|
|
|
e107::coreLan('theme', true);
|
2009-08-28 16:11:02 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$e_sub_cat = 'theme_manage';
|
|
|
|
|
2012-06-03 09:45:20 +00:00
|
|
|
e107::css("inline","
|
2015-07-16 01:17:21 -07:00
|
|
|
.block-text h2.caption { text-align: right; margin-bottom: -30px; padding-right: 10px; }
|
2012-11-29 22:03:36 -08:00
|
|
|
.hide { display: none }
|
2012-06-03 09:45:20 +00:00
|
|
|
|
2012-11-29 22:03:36 -08:00
|
|
|
|
|
|
|
|
2012-06-03 09:45:20 +00:00
|
|
|
");
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
require_once(e_HANDLER."theme_handler.php");
|
|
|
|
$themec = new themeHandler;
|
2015-02-10 12:57:38 -08:00
|
|
|
|
2015-07-17 23:09:36 -07:00
|
|
|
// print_a($_GET);
|
2015-02-10 12:57:38 -08:00
|
|
|
|
|
|
|
$mode = varset($_GET['mode'],'main'); // (e_QUERY) ? e_QUERY :"main" ;
|
|
|
|
|
|
|
|
|
2015-07-17 23:09:36 -07:00
|
|
|
if(!empty($_GET['action']))
|
2012-11-29 22:03:36 -08:00
|
|
|
{
|
|
|
|
define('e_IFRAME',true);
|
|
|
|
}
|
2013-05-19 12:16:10 +03:00
|
|
|
|
2015-07-17 23:09:36 -07:00
|
|
|
if(!empty($_GET['action']))
|
2012-12-11 00:34:08 -08:00
|
|
|
{
|
2015-07-17 23:09:36 -07:00
|
|
|
require_once("auth.php");
|
2013-05-19 12:16:10 +03:00
|
|
|
switch ($_GET['action'])
|
|
|
|
{
|
2013-05-19 15:02:05 -07:00
|
|
|
case 'login':
|
|
|
|
$mp = $themec->getMarketplace();
|
|
|
|
echo $mp->renderLoginForm();
|
|
|
|
exit;
|
|
|
|
break;
|
2015-02-14 23:34:15 -08:00
|
|
|
|
|
|
|
/*
|
2013-05-19 17:28:43 +03:00
|
|
|
case 'download':
|
|
|
|
$string = base64_decode($_GET['src']);
|
2013-05-19 18:38:27 +03:00
|
|
|
parse_str($string, $p);
|
2013-05-19 17:28:43 +03:00
|
|
|
$mp = $themec->getMarketplace();
|
|
|
|
$mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
|
|
|
|
// Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers)
|
2015-02-14 23:34:15 -08:00
|
|
|
echo "<pre>Connecting...\n"; flush();
|
2013-05-19 17:28:43 +03:00
|
|
|
// download and flush
|
|
|
|
$mp->download($p['id'], $p['mode'], $p['type']);
|
|
|
|
echo "</pre>"; flush();
|
|
|
|
exit;
|
|
|
|
break;
|
2015-02-14 23:34:15 -08:00
|
|
|
*/
|
|
|
|
|
2013-05-19 12:16:10 +03:00
|
|
|
case 'info':
|
2017-01-06 13:27:48 -08:00
|
|
|
if(!empty($_GET['src']))
|
|
|
|
{
|
|
|
|
$string = base64_decode($_GET['src']);
|
|
|
|
parse_str($string,$p);
|
|
|
|
$themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id']));
|
|
|
|
echo $themec->renderThemeInfo($themeInfo);
|
|
|
|
}
|
2013-05-19 12:16:10 +03:00
|
|
|
break;
|
2013-05-19 17:28:43 +03:00
|
|
|
|
2013-05-19 12:16:10 +03:00
|
|
|
case 'preview':
|
|
|
|
// Theme Info Ajax
|
|
|
|
$tm = (string) $_GET['id'];
|
|
|
|
$data = $themec->getThemeInfo($tm);
|
|
|
|
echo $themec->renderThemeInfo($data);
|
2015-07-17 23:09:36 -07:00
|
|
|
// exit;
|
2013-05-19 12:16:10 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
/*
|
2013-01-31 01:49:00 -08:00
|
|
|
if(vartrue($_GET['src'])) // Process Theme Download.
|
2013-03-03 16:53:17 -08:00
|
|
|
{
|
2013-01-30 18:37:42 -08:00
|
|
|
$string = base64_decode($_GET['src']);
|
|
|
|
parse_str($string,$p);
|
2013-01-31 01:49:00 -08:00
|
|
|
|
|
|
|
if(vartrue($_GET['info']))
|
|
|
|
{
|
|
|
|
echo $themec->renderThemeInfo($p);
|
|
|
|
// print_a($p);
|
|
|
|
exit;
|
|
|
|
}
|
2013-03-03 16:53:17 -08:00
|
|
|
|
2013-01-30 18:37:42 -08:00
|
|
|
$remotefile = $p['url'];
|
|
|
|
|
2013-03-03 16:53:17 -08:00
|
|
|
e107::getFile()->download($remotefile,'theme');
|
|
|
|
exit;
|
2013-01-30 18:37:42 -08:00
|
|
|
|
|
|
|
}
|
2013-05-19 12:16:10 +03:00
|
|
|
*/
|
2013-03-03 16:53:17 -08:00
|
|
|
// Theme Info Ajax
|
2013-05-19 12:16:10 +03:00
|
|
|
// FIXME addd action=preview to the url, remove this block
|
2015-07-17 23:09:36 -07:00
|
|
|
if(!empty($_GET['id']))
|
|
|
|
{
|
|
|
|
$tm = (string) $_GET['id'];
|
|
|
|
$data = $themec->getThemeInfo($tm);
|
|
|
|
echo $themec->renderThemeInfo($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once(e_ADMIN."footer.php");
|
2012-11-28 04:32:05 -08:00
|
|
|
exit;
|
2013-05-19 12:16:10 +03:00
|
|
|
|
2012-11-28 04:32:05 -08:00
|
|
|
}
|
2013-01-30 18:37:42 -08:00
|
|
|
else
|
|
|
|
{
|
2012-11-29 22:03:36 -08:00
|
|
|
require_once("auth.php");
|
|
|
|
|
2013-03-03 16:53:17 -08:00
|
|
|
/*
|
2012-11-29 22:03:36 -08:00
|
|
|
echo '
|
2012-11-28 04:32:05 -08:00
|
|
|
|
2013-02-25 02:47:23 -08:00
|
|
|
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
|
2012-11-28 04:32:05 -08:00
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
2013-01-31 01:49:00 -08:00
|
|
|
|
2012-11-28 04:32:05 -08:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p>Loading…</p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<a href="#" data-dismiss="modal" class="btn btn-primary">Close</a>
|
|
|
|
</div>
|
2013-03-03 16:53:17 -08:00
|
|
|
</div>';
|
|
|
|
*/
|
2012-11-29 22:03:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-28 04:32:05 -08:00
|
|
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2015-02-10 12:57:38 -08:00
|
|
|
|
2015-02-10 23:13:53 -08:00
|
|
|
|
2015-02-10 12:57:38 -08:00
|
|
|
if($mode == 'download' && !empty($_GET['src']))
|
|
|
|
{
|
|
|
|
define('e_IFRAME', true);
|
|
|
|
$frm = e107::getForm();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
$string = base64_decode($_GET['src']);
|
|
|
|
parse_str($string, $data);
|
2015-07-17 23:09:36 -07:00
|
|
|
|
|
|
|
if(!empty($data['price']))
|
|
|
|
{
|
|
|
|
e107::getRedirect()->go($data['url']);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-01-06 11:19:09 -08:00
|
|
|
if(deftrue('e_DEBUG_MARKETPLACE'))
|
2016-11-21 15:17:12 -08:00
|
|
|
{
|
|
|
|
echo "<b>DEBUG MODE ACTIVE (no downloading)</b><br />";
|
|
|
|
echo '$_GET: ';
|
|
|
|
print_a($_GET);
|
|
|
|
|
|
|
|
echo 'base64 decoded and parsed as $data:';
|
|
|
|
print_a($data);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-02-10 12:57:38 -08:00
|
|
|
|
|
|
|
$mp = $themec->getMarketplace();
|
2016-09-29 10:06:55 +02:00
|
|
|
$mes->addSuccess(TPVLAN_85);
|
2015-02-10 12:57:38 -08:00
|
|
|
|
2015-07-17 23:09:36 -07:00
|
|
|
if($mp->download($data['id'], $data['mode'], 'theme')) // download and unzip theme.
|
2015-02-10 12:57:38 -08:00
|
|
|
{
|
|
|
|
// Auto install?
|
|
|
|
// $text = e107::getPlugin()->install($data['plugin_folder']);
|
|
|
|
// $mes->addInfo($text);
|
2017-01-30 07:52:25 -08:00
|
|
|
echo $mes->render('default', 'success');
|
|
|
|
e107::getTheme()->clearCache();
|
2015-02-10 12:57:38 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo $mes->addError('Unable to continue')->render('default', 'error');
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $mes->render('default', 'debug');
|
|
|
|
|
|
|
|
}
|
2017-01-31 07:52:19 -08:00
|
|
|
elseif(!empty($_POST['selectadmin']))
|
2009-07-06 05:59:42 +00:00
|
|
|
{
|
|
|
|
$mode = "admin";
|
|
|
|
}
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
if(!empty($_POST['upload']))
|
2009-07-18 03:41:49 +00:00
|
|
|
{
|
2015-02-10 23:13:53 -08:00
|
|
|
$mode = "upload";
|
2009-07-18 03:41:49 +00:00
|
|
|
}
|
2017-01-31 07:52:19 -08:00
|
|
|
elseif(!empty($_POST['selectmain']) || isset($_POST['setUploadTheme']))
|
2009-07-06 05:59:42 +00:00
|
|
|
{
|
|
|
|
$mode = "main";
|
|
|
|
}
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
if($mode == 'convert')
|
|
|
|
{
|
|
|
|
new theme_builder;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$themec -> showThemes($mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-28 04:32:05 -08:00
|
|
|
// <a data-toggle="modal" href="'.e_SELF.'" data-target="#myModal" class="btn" >Launch demo modal</a>
|
|
|
|
|
|
|
|
|
2009-07-06 05:59:42 +00:00
|
|
|
|
|
|
|
|
2009-07-09 11:37:36 +00:00
|
|
|
require_once("footer.php");
|
|
|
|
|
2009-07-06 05:59:42 +00:00
|
|
|
function theme_adminmenu()
|
|
|
|
{
|
2013-01-30 16:51:06 -08:00
|
|
|
//global $mode;
|
2012-11-26 03:23:20 -08:00
|
|
|
|
2013-01-30 16:51:06 -08:00
|
|
|
$mode = varset($_GET['mode'],'main');
|
|
|
|
|
|
|
|
// $e107 = &e107::getInstance();
|
2009-07-06 05:59:42 +00:00
|
|
|
|
|
|
|
$var['main']['text'] = TPVLAN_33;
|
|
|
|
$var['main']['link'] = e_SELF;
|
|
|
|
|
|
|
|
$var['admin']['text'] = TPVLAN_34;
|
2013-01-30 16:51:06 -08:00
|
|
|
$var['admin']['link'] = e_SELF."?mode=admin";
|
2009-07-06 05:59:42 +00:00
|
|
|
|
|
|
|
$var['choose']['text'] = TPVLAN_51;
|
2013-01-30 16:51:06 -08:00
|
|
|
$var['choose']['link'] = e_SELF."?mode=choose";
|
2013-01-25 19:30:26 -08:00
|
|
|
|
2016-01-30 16:58:58 +01:00
|
|
|
$var['online']['text'] = TPVLAN_62;
|
2013-01-30 16:51:06 -08:00
|
|
|
$var['online']['link'] = e_SELF."?mode=online";
|
2009-07-06 05:59:42 +00:00
|
|
|
|
|
|
|
$var['upload']['text'] = TPVLAN_38;
|
2013-01-30 16:51:06 -08:00
|
|
|
$var['upload']['link'] = e_SELF."?mode=upload";
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$var['convert']['text'] = ADLAN_CL_6;
|
2013-02-22 15:43:58 -08:00
|
|
|
$var['convert']['link'] = e_SELF."?mode=convert";
|
2009-07-06 05:59:42 +00:00
|
|
|
|
2013-01-30 16:51:06 -08:00
|
|
|
// $selected = (e_QUERY) ? e_QUERY : "main";
|
2017-02-01 14:14:02 -08:00
|
|
|
$icon = e107::getParser()->toIcon('e-themes-24');
|
|
|
|
$caption = $icon."<span>".TPVLAN_26."</span>";
|
2009-07-06 05:59:42 +00:00
|
|
|
|
|
|
|
|
2017-02-01 14:14:02 -08:00
|
|
|
e107::getNav()->admin($caption, $mode, $var);
|
2009-07-06 05:59:42 +00:00
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
class theme_builder
|
|
|
|
{
|
|
|
|
var $themeName = "";
|
|
|
|
var $remove = array();
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$tp = e107::getParser();
|
|
|
|
|
|
|
|
e107::getMessage()->addDebug("Disable debug to save generated files. ");
|
|
|
|
|
|
|
|
|
|
|
|
$this->themeName = $tp->filter($_GET['newtheme'],'w');
|
|
|
|
|
|
|
|
if(!empty($_GET['src']))
|
|
|
|
{
|
|
|
|
$this->themeSrc = $tp->filter($_GET['src'],'w');
|
|
|
|
$this->copyTheme();
|
|
|
|
/* $src = $tp->filter($_GET['src'],'w');
|
|
|
|
$name = $tp->filter($_GET['f']);
|
|
|
|
$title = $tp->filter($_GET['t']);
|
|
|
|
|
|
|
|
$this->copyTheme($src,$name,$title);*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
if(vartrue($_GET['step']) == 3)
|
|
|
|
{
|
|
|
|
$this->step3();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(vartrue($_GET['step']) == 2)
|
|
|
|
{
|
|
|
|
$this->step2();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
$ret = $this->step1();
|
|
|
|
$ret2 = $this->copyThemeForm();
|
|
|
|
|
|
|
|
$tabs = array(
|
|
|
|
0 => array('caption'=>$ret['caption'], 'text'=>$ret['text']),
|
|
|
|
1 => array('caption'=>$ret2['caption'], 'text'=>$ret2['text']),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
2017-02-09 22:54:20 +01:00
|
|
|
$ns->tablerender(ADLAN_140.SEP.ADLAN_CL_6,e107::getForm()->tabs($tabs));
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function step1()
|
|
|
|
{
|
|
|
|
|
|
|
|
$fl = e107::getFile();
|
|
|
|
$frm = e107::getForm();
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
|
|
|
|
$plugFolders = $fl->get_dirs(e_THEME);
|
|
|
|
foreach($plugFolders as $dir)
|
|
|
|
{
|
|
|
|
if(file_exists(e_THEME.$dir."/theme.xml") || $dir == 'templates')
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$newDir[$dir] = $dir;
|
|
|
|
}
|
|
|
|
|
2016-01-30 16:58:58 +01:00
|
|
|
$mes->addInfo(' '.TPVLAN_64.' <br />
|
|
|
|
'.TPVLAN_65.'
|
|
|
|
<ul>
|
|
|
|
<li> '.TPVLAN_66.'</li>
|
|
|
|
<li> '.TPVLAN_67.'</li>
|
2013-02-22 15:43:58 -08:00
|
|
|
</ul>
|
2016-01-30 16:58:58 +01:00
|
|
|
');
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
$text = $frm->open('createPlugin','get',e_SELF."?mode=convert");
|
|
|
|
$text .= "<table class='table adminform'>
|
|
|
|
<colgroup>
|
|
|
|
<col class='col-label' />
|
|
|
|
<col class='col-control' />
|
|
|
|
</colgroup>
|
2017-01-31 07:52:19 -08:00
|
|
|
<tbody>
|
2013-02-22 15:43:58 -08:00
|
|
|
<tr>
|
2016-01-30 16:58:58 +01:00
|
|
|
<td> ".TPVLAN_68."</td>
|
2013-04-25 17:29:46 -07:00
|
|
|
<td>".$frm->select("newtheme",$newDir)."</td>
|
2013-02-22 15:43:58 -08:00
|
|
|
</tr>";
|
|
|
|
|
2013-02-22 21:34:06 -08:00
|
|
|
/*
|
2013-02-22 15:43:58 -08:00
|
|
|
$text .= "
|
|
|
|
<tr>
|
|
|
|
<td>Create Files</td>
|
|
|
|
<td>".$frm->checkbox('createFiles',1,1)."</td>
|
|
|
|
</tr>";
|
2013-02-22 21:34:06 -08:00
|
|
|
*/
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$text .= "</tbody>
|
2013-02-22 15:43:58 -08:00
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
2016-01-30 16:58:58 +01:00
|
|
|
".$frm->admin_button('step', 2,'other',LAN_GO)."
|
2013-02-22 15:43:58 -08:00
|
|
|
</div>";
|
|
|
|
|
|
|
|
$text .= $frm->close();
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
return array('caption'=>TPVLAN_88, 'text'=>$mes->render() . $text);
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2016-09-29 10:06:55 +02:00
|
|
|
$ns->tablerender(TPVLAN_26.SEP.TPVLAN_88.SEP. TPVLAN_CONV_1, $mes->render() . $text);
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function step2()
|
|
|
|
{
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
$frm = e107::getForm();
|
|
|
|
|
2013-06-21 01:25:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$data = array(
|
|
|
|
'main' => array('name','lang','version','date', 'compatibility'),
|
2017-01-31 07:52:19 -08:00
|
|
|
'author' => array('name','url'),
|
2016-01-30 16:58:58 +01:00
|
|
|
'summary' => array('summary'),
|
2013-02-22 15:43:58 -08:00
|
|
|
'description' => array('description'),
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
'keywords' => array('one','two'),
|
|
|
|
'category' => array('category'),
|
2017-01-31 07:52:19 -08:00
|
|
|
'livedemo' => array('livedemo'),
|
2016-01-30 16:58:58 +01:00
|
|
|
'copyright' => array('copyright'),
|
2013-06-21 01:25:47 -07:00
|
|
|
'stylesheets' => array('stylesheets')
|
2013-02-22 15:43:58 -08:00
|
|
|
// 'adminLinks' => array('url','description','icon','iconSmall','primary'),
|
|
|
|
// 'sitelinks' => array('url','description','icon','iconSmall')
|
|
|
|
);
|
|
|
|
|
|
|
|
$legacyFile = e_THEME.$this->themeName."/theme.php";
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$newThemeXML = e_THEME.$this->themeName."/theme.xml";
|
|
|
|
if(file_exists($newThemeXML))
|
2013-02-22 15:43:58 -08:00
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
$info = e107::getTheme()->getThemeInfo($this->themeName);
|
|
|
|
|
|
|
|
e107::getDebug()->log($info);
|
|
|
|
|
|
|
|
if($this->themeSrc) // New theme copied from another
|
|
|
|
{
|
|
|
|
$defaults = array(
|
|
|
|
"main-name" => ucfirst($this->themeName),
|
|
|
|
'category-category' => vartrue($info['category']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$defaults = array(
|
|
|
|
"main-name" => vartrue($info['name']),
|
|
|
|
"main-date" => vartrue($info['date']),
|
|
|
|
"main-version" => vartrue($info['version']),
|
|
|
|
"author-name" => vartrue($info['author']),
|
|
|
|
"author-url" => vartrue($info['website']),
|
|
|
|
"description-description" => vartrue($info['description']),
|
|
|
|
"summary-summary" => vartrue($info['summary']),
|
|
|
|
'category-category' => vartrue($info['category']),
|
|
|
|
// "custompages" => vartrue($leg['CUSTOMPAGES']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!empty($info['keywords']['word']))
|
|
|
|
{
|
|
|
|
$defaults['keywords-one'] = $info['keywords']['word'][0];
|
|
|
|
$defaults['keywords-two'] = $info['keywords']['word'][1];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
elseif(file_exists($legacyFile))
|
|
|
|
{
|
|
|
|
$legacyData = file_get_contents($legacyFile);
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$regex = '/\$([\w]*)\s*=\s*("|\')([\w @.\/:<\>,\'\[\] !()]*)("|\');/im';
|
|
|
|
preg_match_all($regex, $legacyData, $matches);
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$leg = array();
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
foreach($matches[1] as $i => $m)
|
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
$leg[$m] = strip_tags($matches[3][$i]);
|
2013-02-22 15:43:58 -08:00
|
|
|
if(substr($m,0,5) == 'theme' || $m == "CUSTOMPAGES")
|
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
$search[] = $matches[0][$i];
|
|
|
|
}
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$defaults = array(
|
|
|
|
"main-name" => vartrue($leg['themename']),
|
|
|
|
"author-name" => vartrue($leg['themeauthor']),
|
|
|
|
"author-url" => vartrue($leg['themewebsite']),
|
|
|
|
"description-description" => '',
|
|
|
|
"summary-summary" => vartrue($leg['themeinfo']),
|
|
|
|
"custompages" => vartrue($leg['CUSTOMPAGES']),
|
|
|
|
);
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$search[] = "Steve Dunstan";
|
|
|
|
$search[] = "jalist@e107.org";
|
2017-01-31 07:52:19 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
$_SESSION['themebulder-remove'] = $search;
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
$mes->addInfo("Loading theme.php file");
|
|
|
|
}
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$text = $frm->open('newtheme-step3','post', e_SELF.'?mode=convert&src='.$this->themeSrc.'&newtheme='.$this->themeName.'&step=3');
|
2013-02-22 15:43:58 -08:00
|
|
|
$text .= "<table class='table adminlist'>";
|
|
|
|
foreach($data as $key=>$val)
|
|
|
|
{
|
|
|
|
$text.= "<tr><td>$key</td><td>
|
|
|
|
<div class='controls'>";
|
|
|
|
foreach($val as $type)
|
|
|
|
{
|
|
|
|
$nm = $key.'-'.$type;
|
|
|
|
$name = "xml[$nm]";
|
2016-03-15 23:37:38 -07:00
|
|
|
$size = (count($val)==1) ? 'col-md-7' : 'col-md-2';
|
2013-02-22 15:43:58 -08:00
|
|
|
$text .= "<div class='{$size}'>".$this->xmlInput($name, $key."-". $type, vartrue($defaults[$nm]))."</div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$text .= "</div></td></tr>";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$text .= "</table>";
|
|
|
|
$text .= "
|
|
|
|
<div class='buttons-bar center'>"
|
2017-01-31 07:52:19 -08:00
|
|
|
.$frm->hidden('newtheme', $this->themeName);
|
|
|
|
$text .= $frm->hidden('xml[custompages]', trim(vartrue($leg['CUSTOMPAGES'])))
|
2016-01-30 16:58:58 +01:00
|
|
|
.$frm->admin_button('step', 3,'other',LAN_GENERATE)."
|
2013-02-22 15:43:58 -08:00
|
|
|
</div>";
|
|
|
|
|
|
|
|
$text .= $frm->close();
|
2013-02-22 22:35:15 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
// return array('caption'=>TPVLAN_88.SEP. TPVLAN_CONV_2, 'text'=>$mes->render() . $text);
|
|
|
|
|
|
|
|
$ns->tablerender(TPVLAN_26.SEP.ADLAN_CL_6.SEP. TPVLAN_CONV_2, $mes->render() . $text);
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function step3()
|
|
|
|
{
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
|
|
|
|
// print_a($_POST);
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
if(!empty($_POST['xml']))
|
2013-02-22 15:43:58 -08:00
|
|
|
{
|
|
|
|
$xmlText = $this->createXml($_POST['xml']);
|
2017-01-31 07:52:19 -08:00
|
|
|
$ns->tablerender("theme.xml", $mes->render(). "<pre>".$xmlText."</pre>");
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$legacyFile = e_THEME.$this->themeName."/theme.php";
|
|
|
|
if(file_exists($legacyFile) && empty($this->themeSrc))
|
|
|
|
{
|
|
|
|
$legacyData = file_get_contents($legacyFile);
|
|
|
|
$legacyData = e107::getTheme()->upgradeThemeCode($legacyData);
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$output = nl2br(htmlentities($legacyData));
|
|
|
|
|
|
|
|
$ns->tablerender("theme.php (updated)", $output);
|
|
|
|
}
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
}
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createXml($data)
|
|
|
|
{
|
|
|
|
$ns = e107::getRender();
|
|
|
|
$mes = e107::getMessage();
|
|
|
|
$tp = e107::getParser();
|
|
|
|
|
|
|
|
foreach($data as $key=>$val)
|
|
|
|
{
|
|
|
|
$key = strtoupper(str_replace("-","_",$key));
|
|
|
|
$newArray[$key] = $val;
|
|
|
|
}
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
if(!empty($newArray['CUSTOMPAGES']))
|
2013-02-22 15:43:58 -08:00
|
|
|
{
|
|
|
|
$newArray['CUSTOMPAGES'] = trim($newArray['CUSTOMPAGES']);
|
2013-06-21 01:25:47 -07:00
|
|
|
$LAYOUTS = "\n<layout name='custom' title='Custom'>\n";
|
2013-02-22 15:43:58 -08:00
|
|
|
$LAYOUTS .= " <custompages>{CUSTOMPAGES}</custompages>\n";
|
|
|
|
$LAYOUTS .= " </layout>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$LAYOUTS = "";
|
|
|
|
}
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
if(!empty($newArray['STYLESHEETS_STYLESHEETS']))
|
2013-06-21 01:25:47 -07:00
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
$STYLESHEETS = '';
|
2013-06-21 01:25:47 -07:00
|
|
|
foreach($newArray['STYLESHEETS_STYLESHEETS'] as $val)
|
|
|
|
{
|
2017-01-31 07:52:19 -08:00
|
|
|
if(empty($val['file']))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-06-21 01:25:47 -07:00
|
|
|
$STYLESHEETS .= "\t\t<css file=\"".$val['file']."\" name=\"".$val['name']."\" />\n";
|
|
|
|
}
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
if(!empty($STYLESHEETS))
|
|
|
|
{
|
|
|
|
$STYLESHEETS = "\n\t<stylesheets>\n".$STYLESHEETS."\t</stylesheets>";
|
|
|
|
}
|
|
|
|
|
2013-06-21 01:25:47 -07:00
|
|
|
unset($newArray['STYLESHEETS_STYLESHEETS']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$STYLESHEETS = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
$newArray['STYLESHEETS'] = $STYLESHEETS;
|
|
|
|
|
|
|
|
// print_a($newArray);
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
$template = <<<TEMPLATE
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2017-01-31 07:52:19 -08:00
|
|
|
<e107Theme name="{MAIN_NAME}" lan="{MAIN_LANG}" version="{MAIN_VERSION}" date="{MAIN_DATE}" compatibility="{MAIN_COMPATIBILITY}" livedemo="{LIVEDEMO_LIVEDEMO}">
|
2013-02-22 15:43:58 -08:00
|
|
|
<author name="{AUTHOR_NAME}" url="{AUTHOR_URL}" />
|
|
|
|
<summary lan="">{SUMMARY_SUMMARY}</summary>
|
|
|
|
<description lan="">{DESCRIPTION_DESCRIPTION}</description>
|
2017-01-31 07:52:19 -08:00
|
|
|
<category>{CATEGORY_CATEGORY}</category>
|
2013-02-22 15:43:58 -08:00
|
|
|
<keywords>
|
|
|
|
<word>{KEYWORDS_ONE}</word>
|
|
|
|
<word>{KEYWORDS_TWO}</word>
|
|
|
|
</keywords>
|
|
|
|
<copyright>{COPYRIGHT_COPYRIGHT}</copyright>
|
|
|
|
<screenshots>
|
|
|
|
<image>preview.jpg</image>
|
|
|
|
<image>fullpreview.jpg</image>
|
2013-06-21 01:25:47 -07:00
|
|
|
</screenshots>{STYLESHEETS}
|
2013-02-22 15:43:58 -08:00
|
|
|
<layouts>
|
2013-06-21 01:25:47 -07:00
|
|
|
<layout name='default' title='Default' default='true' />{LAYOUTS}
|
2013-02-22 15:43:58 -08:00
|
|
|
</layouts>
|
|
|
|
</e107Theme>
|
|
|
|
TEMPLATE;
|
|
|
|
|
|
|
|
|
|
|
|
$template = str_replace("{LAYOUTS}",$LAYOUTS, $template);
|
|
|
|
|
|
|
|
$result = e107::getParser()->simpleParse($template, $newArray);
|
|
|
|
$path = e_THEME.$this->themeName."/theme.xml";
|
|
|
|
|
2013-06-21 01:25:47 -07:00
|
|
|
|
|
|
|
if(E107_DEBUG_LEVEL > 0)
|
|
|
|
{
|
|
|
|
$mes->addDebug("Debug Mode active - no file saved. ");
|
|
|
|
return htmlentities($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
if(file_put_contents($path,$result))
|
|
|
|
{
|
|
|
|
$mes->addSuccess("Saved: ".$path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$mes->addError("Couldn't Save: ".$path);
|
|
|
|
}
|
|
|
|
|
2017-01-31 11:45:21 -08:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
return htmlentities($result);
|
|
|
|
|
2009-07-09 11:37:36 +00:00
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-21 01:25:47 -07:00
|
|
|
function xmlInput($name, $info, $default='')
|
2013-02-22 15:43:58 -08:00
|
|
|
{
|
|
|
|
$frm = e107::getForm();
|
|
|
|
list($cat,$type) = explode("-",$info);
|
|
|
|
|
|
|
|
$size = 30;
|
|
|
|
$help = '';
|
2016-03-15 23:37:38 -07:00
|
|
|
$sizex = '';
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
switch ($info)
|
|
|
|
{
|
|
|
|
|
|
|
|
case 'main-name':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_3;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
2017-01-31 07:52:19 -08:00
|
|
|
$pattern = "[A-Za-z 0-9]*";
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'main-lang':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_4;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = false;
|
2016-03-15 23:37:38 -07:00
|
|
|
$placeholder= "LAN equivalent";
|
2013-02-22 15:43:58 -08:00
|
|
|
$pattern = "[A-Z0-9_]*";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'main-date':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_6;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
2017-01-31 07:52:19 -08:00
|
|
|
$default = (empty($default)) ? time() : strtotime($default);
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'main-version':
|
|
|
|
$default = '1.0';
|
|
|
|
$required = true;
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_5;
|
2013-02-22 15:43:58 -08:00
|
|
|
$pattern = "^[\d]{1,2}\.[\d]{1,2}$";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'main-compatibility':
|
|
|
|
$default = '2.0';
|
|
|
|
$required = true;
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_7;
|
2013-02-22 15:43:58 -08:00
|
|
|
$pattern = "^[\d]{1,2}\.[\d]{1,2}$";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'author-name':
|
|
|
|
$default = (vartrue($default)) ? $default : USERNAME;
|
|
|
|
$required = true;
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_8;
|
2013-02-22 15:43:58 -08:00
|
|
|
$pattern = "[A-Za-z \.0-9]*";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'author-url':
|
|
|
|
$required = true;
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_9;
|
2013-02-22 15:43:58 -08:00
|
|
|
// $pattern = "https?://.+";
|
|
|
|
break;
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
case 'livedemo-livedemo':
|
|
|
|
$required = false;
|
|
|
|
$help = TPVLAN_CONV_16;
|
|
|
|
$placeholder= "http://demo-of-my-theme.com";
|
|
|
|
// $pattern = "https?://.+";
|
|
|
|
break;
|
2013-02-22 15:43:58 -08:00
|
|
|
|
|
|
|
//case 'main-installRequired':
|
|
|
|
// return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO);
|
|
|
|
//break;
|
|
|
|
|
|
|
|
case 'summary-summary':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_10;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
2016-03-15 23:37:38 -07:00
|
|
|
$size = 200;
|
2013-02-22 15:43:58 -08:00
|
|
|
$placeholder= " ";
|
|
|
|
$pattern = "[A-Za-z,() \.0-9]*";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'keywords-one':
|
|
|
|
case 'keywords-two':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_11;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
|
|
|
$size = 20;
|
|
|
|
$placeholder= " ";
|
|
|
|
$pattern = '^[a-z]*$';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'description-description':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_12;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
|
|
|
$size = 100;
|
|
|
|
$placeholder = " ";
|
|
|
|
$pattern = "[A-Za-z \.0-9]*";
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'category-category':
|
2016-01-30 16:58:58 +01:00
|
|
|
$help = TPVLAN_CONV_13;
|
2013-02-22 15:43:58 -08:00
|
|
|
$required = true;
|
|
|
|
$size = 20;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$req = ($required == true) ? "&required=1" : "";
|
|
|
|
$placeholder = (varset($placeholder)) ? $placeholder : $type;
|
|
|
|
$pat = ($pattern) ? "&pattern=".$pattern : "";
|
2016-03-15 23:37:38 -07:00
|
|
|
$text = '';
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
switch ($type)
|
|
|
|
{
|
2013-06-21 01:25:47 -07:00
|
|
|
|
|
|
|
case 'stylesheets':
|
|
|
|
$fl = e107::getFile();
|
|
|
|
|
|
|
|
$fl->setMode('full');
|
2017-01-31 07:52:19 -08:00
|
|
|
$stylesheets = $fl->get_files(e_THEME.$this->themeName."/", "\.css", null, 1);
|
2013-06-21 01:25:47 -07:00
|
|
|
foreach($stylesheets as $key=>$path)
|
|
|
|
{
|
|
|
|
$file = str_replace(e_THEME.$this->themeName."/",'',$path);
|
|
|
|
$text .= "<div class='row-fluid'>";
|
|
|
|
$text .= "<div class='controls'>";
|
2016-03-15 23:37:38 -07:00
|
|
|
$text .= "<div class='col-md-3'>".$frm->checkbox($name.'['.$key.'][file]',$file, false, array('label'=>$file))."
|
2016-01-30 16:58:58 +01:00
|
|
|
<div class='field-help'>".TPVLAN_CONV_14."</div></div>";
|
2016-03-15 23:37:38 -07:00
|
|
|
$text .= "<div class='col-md-3'>".$frm->text($name.'['.$key.'][name]', $default, $size, 'placeholder='.$file . $req. $pat)."
|
2016-01-30 16:58:58 +01:00
|
|
|
<div class='field-help'>".TPVLAN_CONV_15."</div></div>";
|
2013-06-21 01:25:47 -07:00
|
|
|
// $text .= "<div class='span2'>".$frm->checkbox('css['.$key.'][file]',$file, false, array('label'=>$file))."</div>";
|
|
|
|
// $text .= "<div class='span2'>".$frm->text('css['.$key.'][name]', $default, $size, 'placeholder='.$placeholder . $req. $pat)."</div>";
|
|
|
|
$text .= "</div>";
|
|
|
|
$text .= "</div>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $text;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
case 'date':
|
2017-01-31 07:52:19 -08:00
|
|
|
$text = $frm->datepicker($name, $default, 'format=yyyy-mm-dd'.$req.'&size=block-level');
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'description':
|
2017-01-31 07:52:19 -08:00
|
|
|
$text = $frm->textarea($name,$default, 3, 100, $req.'&size=block-level'); // pattern not supported.
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'category':
|
2013-02-22 22:35:15 -08:00
|
|
|
|
|
|
|
$allowedCategories = array(
|
|
|
|
'generic', 'adult', 'blog', 'clan', 'children',
|
|
|
|
'corporate', 'forum', 'gaming', 'gallery', 'news',
|
|
|
|
'social', 'video', 'multimedia');
|
|
|
|
|
|
|
|
sort($allowedCategories);
|
2013-02-22 15:43:58 -08:00
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
$text = $frm->select($name, $allowedCategories,$default,'useValues=1&required=1', true);
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
2016-03-15 23:37:38 -07:00
|
|
|
$text = $frm->text($name, $default, $size, 'placeholder='.$placeholder . $req. $pat.'&size=block-level');
|
2013-02-22 15:43:58 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$text .= ($help) ? "<span class='field-help'>".$help."</span>" : "";
|
|
|
|
return $text;
|
|
|
|
|
2017-01-31 07:52:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function copyThemeForm()
|
|
|
|
{
|
|
|
|
|
|
|
|
$frm = e107::getForm();
|
|
|
|
|
|
|
|
$list = e107::getTheme()->clearCache()->getThemeList(); // (e_THEME);
|
|
|
|
|
|
|
|
$folders = array_keys($list);
|
|
|
|
|
|
|
|
$text = $frm->open('copytheme','get','theme.php?mode=convert');
|
|
|
|
$text .= "<table class='table adminform'>
|
|
|
|
<colgroup>
|
|
|
|
<col class='col-label' />
|
|
|
|
<col class='col-control' />
|
|
|
|
</colgroup>
|
|
|
|
<tr>
|
2017-02-09 22:54:20 +01:00
|
|
|
<td>".TPVLAN_91."</td>
|
2017-01-31 07:52:19 -08:00
|
|
|
<td>".$frm->select("src",$folders,'',array('useValues'=>1))."</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
2017-02-09 22:54:20 +01:00
|
|
|
<td>".TPVLAN_92."</td>
|
2017-01-31 07:52:19 -08:00
|
|
|
<td>".$frm->text("newtheme",'',25, array('pattern'=>'[a-z_0-9]*', 'required'=>1))."</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
";
|
|
|
|
|
|
|
|
/*
|
|
|
|
$text .= "
|
|
|
|
<tr>
|
|
|
|
<td>Create Files</td>
|
|
|
|
<td>".$frm->checkbox('createFiles',1,1)."</td>
|
|
|
|
</tr>";
|
|
|
|
*/
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
|
|
|
".$frm->admin_button('step', 2,'success', LAN_CREATE)."
|
|
|
|
</div>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$text .= $frm->close();
|
|
|
|
|
|
|
|
|
|
|
|
// $text = "Create a new theme based on ".e->select('copytheme',$list);
|
|
|
|
|
|
|
|
|
2017-02-09 22:54:20 +01:00
|
|
|
return array('caption'=>LAN_CREATE, 'text'=>$text);
|
2017-01-31 07:52:19 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private function copyTheme()
|
|
|
|
{
|
|
|
|
if(empty($this->themeSrc) || empty($this->themeName) || is_dir(e_THEME.$this->themeName))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(e107::getFile()->copy(e_THEME.$this->themeSrc, e_THEME.$this->themeName))
|
|
|
|
{
|
|
|
|
$newfiles = scandir(e_THEME.$this->themeName);
|
|
|
|
|
|
|
|
foreach($newfiles as $file)
|
|
|
|
{
|
|
|
|
if(is_dir(e_THEME.$this->themeName.'/'.$file) || $file === '.' || $file === '..')
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(strpos($file,"admin_") === 0)
|
|
|
|
{
|
|
|
|
unlink(e_THEME.$this->themeName.'/'.$file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 15:43:58 -08:00
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-29 10:06:55 +02:00
|
|
|
?>
|