themes = new dcThemes($core); $core->themes->loadModules($core->blog->themes_path, null); # -- Page helper -- $list = new adminThemesList( $core->themes, $core->blog->themes_path, $core->blog->settings->system->store_theme_url, !empty($_GET['nocache']) ); adminThemesList::$distributed_modules = explode(',', DC_DISTRIB_THEMES); # -- Theme screenshot -- if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) { $f = path::real(empty($_GET['src']) ? $core->blog->themes_path . '/' . $_GET['shot'] . '/screenshot.jpg' : $core->blog->themes_path . '/' . $_GET['shot'] . '/' . path::clean($_GET['src']) ); if (!file_exists($f)) { $f = dirname(__FILE__) . '/images/noscreenshot.png'; } http::cache(array_merge([$f], get_included_files())); header('Content-Type: ' . files::getMimeType($f)); header('Content-Length: ' . filesize($f)); readfile($f); exit; } # -- Display module configuration page -- if ($list->setConfiguration($core->blog->settings->system->theme)) { # Get content before page headers include $list->includeConfiguration(); # Gather content $list->getConfiguration(); # Display page dcPage::open(__('Blog appearance'), dcPage::jsPageTabs() . dcPage::jsColorPicker() . # --BEHAVIOR-- themesToolsHeaders $core->callBehavior('themesToolsHeaders', $core, true), dcPage::breadcrumb( [ html::escapeHTML($core->blog->name) => '', __('Blog appearance') => $list->getURL('', false), '' . __('Theme configuration') . '' => '' ]) ); # Display previously gathered content $list->displayConfiguration(); dcPage::helpBlock('core_blog_theme_conf'); dcPage::close(); # Stop reading code here return; } # -- Execute actions -- try { $list->doActions(); } catch (Exception $e) { $core->error->add($e->getMessage()); } # -- Page header -- dcPage::open(__('Themes management'), dcPage::jsLoad('js/_blog_theme.js') . dcPage::jsPageTabs() . dcPage::jsColorPicker() . # --BEHAVIOR-- themesToolsHeaders $core->callBehavior('themesToolsHeaders', $core, false), dcPage::breadcrumb( [ html::escapeHTML($core->blog->name) => '', '' . __('Blog appearance') . '' => '' ]) ); # -- Display modules lists -- if ($core->auth->isSuperAdmin()) { if (!$core->error->flag()) { if (!empty($_GET['nocache'])) { dcPage::success(__('Manual checking of themes update done successfully.')); } } # Updated modules from repo $modules = $list->store->get(true); if (!empty($modules)) { echo '
' . '

' . html::escapeHTML(__('Update themes')) . '

' . '

' . sprintf( __('There is one theme to update available from repository.', 'There are %s themes to update available from repository.', count($modules)), count($modules) ) . '

'; $list ->setList('theme-update') ->setTab('themes') ->setModules($modules) ->displayModules( /*cols */['checkbox', 'name', 'sshot', 'desc', 'author', 'version', 'current_version', 'parent'], /* actions */['update', 'delete'] ); echo '

' . sprintf( __("Visit %s repository, the resources center for Dotclear."), 'Dotaddict' ) . '

' . '
'; } else { echo '
' . '

' . '

' . '
'; } } # Activated modules $modules = $list->modules->getModules(); if (!empty($modules)) { echo '
' . '

' . __('Installed themes') . '

' . '

' . __('You can configure and manage installed themes from this list.') . '

'; $list ->setList('theme-activate') ->setTab('themes') ->setModules($modules) ->displayModules( /* cols */['sshot', 'distrib', 'name', 'config', 'desc', 'author', 'version', 'parent'], /* actions */['select', 'behavior', 'deactivate', 'delete'] ); echo '
'; } # Deactivated modules $modules = $list->modules->getDisabledModules(); if (!empty($modules)) { echo '
' . '

' . __('Deactivated themes') . '

' . '

' . __('Deactivated themes are installed but not usable. You can activate them from here.') . '

'; $list ->setList('theme-deactivate') ->setTab('themes') ->setModules($modules) ->displayModules( /* cols */['name', 'distrib'], /* actions */['activate', 'delete'] ); echo '
'; } if ($core->auth->isSuperAdmin() && $list->isWritablePath()) { # New modules from repo $search = $list->getSearch(); $modules = $search ? $list->store->search($search) : $list->store->get(); if (!empty($search) || !empty($modules)) { echo '
' . '

' . __('Add themes from repository') . '

'; // '

'.__('Search and install themes directly from repository.').'

'; $list ->setList('theme-new') ->setTab('new') ->setModules($modules) ->displaySearch() ->displayIndex() ->displayModules( /* cols */['expander', 'sshot', 'name', 'score', 'config', 'desc', 'author', 'version', 'parent', 'details', 'support'], /* actions */['install'], /* nav limit */true ); echo '

' . sprintf( __("Visit %s repository, the resources center for Dotclear."), 'Dotaddict' ) . '

' . '
'; } # Add a new plugin echo '
' . '

' . __('Add themes from a package') . '

' . '

' . __('You can install themes by uploading or downloading zip files.') . '

'; $list->displayManualForm(); echo '
'; } # --BEHAVIOR-- themesToolsTabs $core->callBehavior('themesToolsTabs', $core); # -- Notice for super admin -- if ($core->auth->isSuperAdmin() && !$list->isWritablePath()) { echo '

' . __('Some functions are disabled, please give write access to your themes directory to enable them.') . '

'; } dcPage::helpBlock('core_blog_theme'); dcPage::close();