Changeset 3730:5c45a5df9a59 for admin/blog_theme.php
- Timestamp:
- 03/08/18 17:58:39 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blog_theme.php
r3398 r3730 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 require dirname(__FILE__) .'/../inc/admin/prepend.php';13 require dirname(__FILE__) . '/../inc/admin/prepend.php'; 14 14 15 15 dcPage::check('admin'); … … 21 21 # -- Page helper -- 22 22 $list = new adminThemesList( 23 24 25 23 $core->themes, 24 $core->blog->themes_path, 25 $core->blog->settings->system->store_theme_url 26 26 ); 27 27 adminThemesList::$distributed_modules = explode(',', DC_DISTRIB_THEMES); … … 30 30 if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) { 31 31 32 $f= path::real(empty($_GET['src']) ?33 $core->blog->themes_path.'/'.$_GET['shot'].'/screenshot.jpg' :34 $core->blog->themes_path.'/'.$_GET['shot'].'/'.path::clean($_GET['src'])35 36 37 38 $f = dirname(__FILE__).'/images/noscreenshot.png';39 40 41 42 43 header('Content-Type: '.files::getMimeType($f));44 header('Content-Length: '.filesize($f));45 46 47 32 $f = path::real(empty($_GET['src']) ? 33 $core->blog->themes_path . '/' . $_GET['shot'] . '/screenshot.jpg' : 34 $core->blog->themes_path . '/' . $_GET['shot'] . '/' . path::clean($_GET['src']) 35 ); 36 37 if (!file_exists($f)) { 38 $f = dirname(__FILE__) . '/images/noscreenshot.png'; 39 } 40 41 http::cache(array_merge(array($f), get_included_files())); 42 43 header('Content-Type: ' . files::getMimeType($f)); 44 header('Content-Length: ' . filesize($f)); 45 readfile($f); 46 47 exit; 48 48 } 49 49 … … 51 51 if ($list->setConfiguration($core->blog->settings->system->theme)) { 52 52 53 54 55 56 57 58 59 60 61 dcPage::jsPageTabs().62 dcPage::jsColorPicker().63 64 65 66 67 68 69 html::escapeHTML($core->blog->name)=> '',70 __('Blog appearance') => $list->getURL('',false),71 '<span class="page-title">'.__('Theme configuration').'</span>' => ''72 73 74 75 76 77 78 79 80 81 82 53 # Get content before page headers 54 include $list->includeConfiguration(); 55 56 # Gather content 57 $list->getConfiguration(); 58 59 # Display page 60 dcPage::open(__('Blog appearance'), 61 dcPage::jsPageTabs() . 62 dcPage::jsColorPicker() . 63 64 # --BEHAVIOR-- themesToolsHeaders 65 $core->callBehavior('themesToolsHeaders', $core, true), 66 67 dcPage::breadcrumb( 68 array( 69 html::escapeHTML($core->blog->name) => '', 70 __('Blog appearance') => $list->getURL('', false), 71 '<span class="page-title">' . __('Theme configuration') . '</span>' => '' 72 )) 73 ); 74 75 # Display previously gathered content 76 $list->displayConfiguration(); 77 78 dcPage::helpBlock('core_blog_theme_conf'); 79 dcPage::close(); 80 81 # Stop reading code here 82 return; 83 83 } 84 84 85 85 # -- Execute actions -- 86 86 try { 87 $list->doActions(); 88 } 89 catch (Exception $e) { 90 $core->error->add($e->getMessage()); 87 $list->doActions(); 88 } catch (Exception $e) { 89 $core->error->add($e->getMessage()); 91 90 } 92 91 93 92 # -- Page header -- 94 93 dcPage::open(__('Themes management'), 95 dcPage::jsLoad('js/_blog_theme.js').96 dcPage::jsPageTabs().97 dcPage::jsColorPicker().98 99 100 101 102 103 104 html::escapeHTML($core->blog->name)=> '',105 '<span class="page-title">'.__('Blog appearance').'</span>' => ''106 94 dcPage::jsLoad('js/_blog_theme.js') . 95 dcPage::jsPageTabs() . 96 dcPage::jsColorPicker() . 97 98 # --BEHAVIOR-- themesToolsHeaders 99 $core->callBehavior('themesToolsHeaders', $core, false), 100 101 dcPage::breadcrumb( 102 array( 103 html::escapeHTML($core->blog->name) => '', 104 '<span class="page-title">' . __('Blog appearance') . '</span>' => '' 105 )) 107 106 ); 108 107 … … 110 109 if ($core->auth->isSuperAdmin()) { 111 110 112 113 114 115 116 '<div class="multi-part" id="update" title="'.html::escapeHTML(__('Update themes')).'">'.117 '<h3>'.html::escapeHTML(__('Update themes')).'</h3>'.118 '<p>'.sprintf(119 120 121 ).'</p>';122 123 124 125 126 127 128 /*cols */array('checkbox', 'name', 'sshot', 'desc', 'author', 'version', 'current_version', 'parent'),129 /* actions */array('update', 'delete')130 131 132 133 '<p class="info vertical-separator">'.sprintf(134 135 136 ).137 '</p>'.138 139 140 111 # Updated modules from repo 112 $modules = $list->store->get(true); 113 if (!empty($modules)) { 114 echo 115 '<div class="multi-part" id="update" title="' . html::escapeHTML(__('Update themes')) . '">' . 116 '<h3>' . html::escapeHTML(__('Update themes')) . '</h3>' . 117 '<p>' . sprintf( 118 __('There is one theme to update available from repository.', 'There are %s themes to update available from repository.', count($modules)), 119 count($modules) 120 ) . '</p>'; 121 122 $list 123 ->setList('theme-update') 124 ->setTab('themes') 125 ->setModules($modules) 126 ->displayModules( 127 /*cols */array('checkbox', 'name', 'sshot', 'desc', 'author', 'version', 'current_version', 'parent'), 128 /* actions */array('update', 'delete') 129 ); 130 131 echo 132 '<p class="info vertical-separator">' . sprintf( 133 __("Visit %s repository, the resources center for Dotclear."), 134 '<a href="http://themes.dotaddict.org/galerie-dc2/">Dotaddict</a>' 135 ) . 136 '</p>' . 137 138 '</div>'; 139 } 141 140 } 142 141 … … 145 144 if (!empty($modules)) { 146 145 147 148 '<div class="multi-part" id="themes" title="'.__('Installed themes').'">'.149 '<h3>'.__('Installed themes').'</h3>'.150 '<p class="more-info">'.__('You can configure and manage installed themes from this list.').'</p>';151 152 153 154 155 156 157 /* cols */array('sshot', 'distrib', 'name', 'config', 'desc', 'author', 'version', 'parent'),158 /* actions */array('select', 'behavior', 'deactivate', 'delete')159 160 161 162 146 echo 147 '<div class="multi-part" id="themes" title="' . __('Installed themes') . '">' . 148 '<h3>' . __('Installed themes') . '</h3>' . 149 '<p class="more-info">' . __('You can configure and manage installed themes from this list.') . '</p>'; 150 151 $list 152 ->setList('theme-activate') 153 ->setTab('themes') 154 ->setModules($modules) 155 ->displayModules( 156 /* cols */array('sshot', 'distrib', 'name', 'config', 'desc', 'author', 'version', 'parent'), 157 /* actions */array('select', 'behavior', 'deactivate', 'delete') 158 ); 159 160 echo 161 '</div>'; 163 162 } 164 163 … … 167 166 if (!empty($modules)) { 168 167 169 170 '<div class="multi-part" id="deactivate" title="'.__('Deactivated themes').'">'.171 '<h3>'.__('Deactivated themes').'</h3>'.172 '<p class="more-info">'.__('Deactivated themes are installed but not usable. You can activate them from here.').'</p>';173 174 175 176 177 178 179 /* cols */array('name', 'distrib'),180 /* actions */array('activate', 'delete')181 182 183 184 168 echo 169 '<div class="multi-part" id="deactivate" title="' . __('Deactivated themes') . '">' . 170 '<h3>' . __('Deactivated themes') . '</h3>' . 171 '<p class="more-info">' . __('Deactivated themes are installed but not usable. You can activate them from here.') . '</p>'; 172 173 $list 174 ->setList('theme-deactivate') 175 ->setTab('themes') 176 ->setModules($modules) 177 ->displayModules( 178 /* cols */array('name', 'distrib'), 179 /* actions */array('activate', 'delete') 180 ); 181 182 echo 183 '</div>'; 185 184 } 186 185 187 186 if ($core->auth->isSuperAdmin() && $list->isWritablePath()) { 188 187 189 190 $search= $list->getSearch();191 192 193 194 195 '<div class="multi-part" id="new" title="'.__('Add themes').'">'.196 '<h3>'.__('Add themes from repository').'</h3>';197 // 198 199 200 201 202 203 204 205 206 /* cols */array('expander', 'sshot', 'name', 'score', 'config', 'desc', 'author', 'version', 'parent', 'details', 'support'),207 /* actions */array('install'),208 /* nav limit */true209 210 211 212 '<p class="info vertical-separator">'.sprintf(213 214 215 ).216 '</p>'.217 218 219 220 221 222 223 '<div class="multi-part" id="addtheme" title="'.__('Install or upgrade manually').'">'.224 '<h3>'.__('Add themes from a package').'</h3>'.225 '<p class="more-info">'.__('You can install themes by uploading or downloading zip files.').'</p>';226 227 228 229 230 188 # New modules from repo 189 $search = $list->getSearch(); 190 $modules = $search ? $list->store->search($search) : $list->store->get(); 191 192 if (!empty($search) || !empty($modules)) { 193 echo 194 '<div class="multi-part" id="new" title="' . __('Add themes') . '">' . 195 '<h3>' . __('Add themes from repository') . '</h3>'; 196 // '<p>'.__('Search and install themes directly from repository.').'</p>'; 197 198 $list 199 ->setList('theme-new') 200 ->setTab('new') 201 ->setModules($modules) 202 ->displaySearch() 203 ->displayIndex() 204 ->displayModules( 205 /* cols */array('expander', 'sshot', 'name', 'score', 'config', 'desc', 'author', 'version', 'parent', 'details', 'support'), 206 /* actions */array('install'), 207 /* nav limit */true 208 ); 209 210 echo 211 '<p class="info vertical-separator">' . sprintf( 212 __("Visit %s repository, the resources center for Dotclear."), 213 '<a href="http://themes.dotaddict.org/galerie-dc2/">Dotaddict</a>' 214 ) . 215 '</p>' . 216 217 '</div>'; 218 } 219 220 # Add a new plugin 221 echo 222 '<div class="multi-part" id="addtheme" title="' . __('Install or upgrade manually') . '">' . 223 '<h3>' . __('Add themes from a package') . '</h3>' . 224 '<p class="more-info">' . __('You can install themes by uploading or downloading zip files.') . '</p>'; 225 226 $list->displayManualForm(); 227 228 echo 229 '</div>'; 231 230 } 232 231 … … 236 235 # -- Notice for super admin -- 237 236 if ($core->auth->isSuperAdmin() && !$list->isWritablePath()) { 238 239 '<p class="warning">'.__('Some functions are disabled, please give write access to your themes directory to enable them.').'</p>';237 echo 238 '<p class="warning">' . __('Some functions are disabled, please give write access to your themes directory to enable them.') . '</p>'; 240 239 } 241 240
Note: See TracChangeset
for help on using the changeset viewer.