Skip to content

Commit

Permalink
Default "empty" theme
Browse files Browse the repository at this point in the history
  • Loading branch information
nicodim99 committed Oct 16, 2017
1 parent c29afc2 commit 001891c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cms/.dbschema/core.sql
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS `dir_data` (
PRIMARY KEY (`id`)
);

INSERT INTO dir_data VALUES ( 1, 1, 'default', 'default', 7, '', 1, NOW(), '', 0, 1, NULL, 1, '', '', '', '');
INSERT INTO dir_data VALUES ( 1, 1, 'default', 'default', 7, '', 1, NOW(), '', 0, 1, 'themes/default', 1, '', '', '', '');

INSERT INTO `mail_templates` (`event`, `active`, `content_type`, `mail_subject`, `mail_body`, `mail_from_name`, `mail_from_email`, `mail_to`) VALUES
('USER_RECOVER', 1, 'text/plain', "{{ _('Ваш пароль на сайт') }} {{server.name}}", "{{ _('Ваш новый пароль: ') }} {{password}}", '', 'no-reply@cetera.ru', '{{user.email}}');
1 change: 1 addition & 0 deletions cms/include/classes/Cetera/ObjectDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ public static function fix_params($params)
if (!isset($params['describ']) && isset($params['description'])) $params['describ'] = $params['description'];
if (!isset($params['alias']) && isset($params['name'])) $params['alias'] = $params['name'];
if (!isset($params['alias']) && isset($params['table'])) $params['alias'] = $params['table'];
$params['alias'] = str_replace(' ','_',$params['alias']);
return $params;
}

Expand Down
4 changes: 3 additions & 1 deletion cms/include/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
**/

/** Версия */
define('VERSION', '3.38.4');
define('VERSION', '3.38.5');

/** Название продукта */
define('APP_NAME', 'Cetera CMS');
Expand Down Expand Up @@ -62,6 +62,7 @@

define ('DB_SCHEMA', CMSROOT.'.dbschema/core.xml');
define ('DB_DATA', CMSROOT.'.dbschema/core.sql');
define ('DEFAULT_THEME', CMSROOT.'.dbschema/.templates.zip');
define ('TEMPLATES_DIR', DOCROOT.'.templates');
define ('TWIG_TEMPLATES_PATH', 'design');

Expand All @@ -78,6 +79,7 @@
define('PLUGIN_INSTALL', 'install.php');

define('THEME_DIR', 'themes');
define('THEME_DEFAULT_DIR', 'default');
define('THEME_INFO', 'info.json');
define('THEME_DB_SCHEMA', 'schema.xml');
define('THEME_DB_DATA','data.sql');
Expand Down
42 changes: 38 additions & 4 deletions cms/include/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
$res['success'] = true;
$res['error'] = false;

if ($_POST['create'])
{
if ($_POST['create']) {

$theme = 'corp';
if ($_POST['theme']) $theme = $_POST['theme'];
Expand Down Expand Up @@ -55,7 +54,42 @@
$str .= '</table></div>';
$res['text'] = $str;

}
}
else {
$str = '<div class="scroll" style="width: 475px;"><table class="setup" cellspacing="0" cellpadding="0" width="100%" border="0">';

ob_start();

if (check_dir(DOCROOT.THEME_DIR.'/'.THEME_DEFAULT_DIR, 1, FALSE)) {
$res['error'] = true;
}
else try {
$zip = new \ZipArchive;
if($zip->open(DEFAULT_THEME)===TRUE) {

if(!$zip->extractTo(DOCROOT.THEME_DIR.'/'.THEME_DEFAULT_DIR)) {
throw new Exception($translator->_('Не удалось распаковать архив'));
}
else {
$str .= '<tr><td class="left">'.$translator->_('Установлена стандартная тема').'</td></tr>';
}

}
else {
throw new Exception($translator->_('Не удалось открыть архив'));
}
} catch (\Exception $e) {
$res['error'] = true;
$res['success'] = false;
$str .= status(1, $e->getMessage()).'</td></tr>';
}

$str .= ob_get_contents();
ob_end_clean();

$str .= '</table></div>';
$res['text'] = $str;
}

if (!$res['error']) finish_setup();

Expand Down Expand Up @@ -215,12 +249,12 @@

if (check_file(PREFS_FILE, 1)) $res['error'] = true;
if (check_dir(TEMPLATES_DIR, 1, FALSE)) $res['error'] = true;
if (check_dir(DOCROOT.THEME_DIR, 1, FALSE)) $res['error'] = true;
if (check_dir(CACHE_DIR, 2)) $res['warning'] = true;
if (check_dir(IMAGECACHE_DIR, 2)) $res['warning'] = true;
if (check_dir(FILECACHE_DIR, 2)) $res['warning'] = true;
check_dir(USER_UPLOADS_DIR, 2);
check_dir(DOCROOT.PLUGIN_DIR, 2);
check_dir(DOCROOT.THEME_DIR, 2);
$str .= ob_get_contents();
ob_end_clean();

Expand Down

0 comments on commit 001891c

Please sign in to comment.