Dotclear

source: plugins/mkcompat/index.php @ 1513

Revision 1513, 3.5 KB checked in by xave, 14 years ago (diff)

v1.1: global code cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision
  • Property svn:mime-type set to text/plain
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of mkcompat, a plugin for Dotclear 2.
5#
6# Copyright (c) 2009 Dotclear Team and contributors
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')) { return; }
14
15if (!empty($_POST) && is_dir ($_POST['root']))
16{
17          mkcompat::moduleUpgrade($_POST['root']);
18          http::redirect($p_url.'&upd=1&type='.$_POST['type'].'&name='.$_POST['name']);
19}
20?>
21<html>
22  <head>
23    <title><?php echo __('Dotclear 2.1.6 compatibility plugin'); ?></title>
24  </head>
25  <body>
26      <h1><?php echo __('Dotclear 2.1.6 compatibility plugin'); ?></h1>
27<?php
28if (!empty($_GET['upd'])) {
29     if ($_GET['type'] == 'theme')
30          echo '<p class="message">'.sprintf(__('The %s theme has been upgraded'),$_GET['name']).'</p>';
31     if ($_GET['type'] == 'plugin')
32          echo '<p class="message">'.sprintf(__('The %s plugin has been upgraded'),$_GET['name']).'</p>';
33}
34?>
35      <h2><?php echo __('Important notice'); ?></h2>
36      <p><?php echo __('This plugin tries to update your themes and plugins to work smoothly with the latest version of Dotclear. It is provided as-is, may not work, and may even break something. Please do a backup of your modules before using it.'); ?></p>
37      <h2><?php echo __('Themes requiring an upgrade'); ?></h2>
38<?php
39     $core->themes = new dcThemes($core);
40     $core->themes->loadModules($core->blog->themes_path,null);
41     $themes = $core->themes->getModules();
42     unset($themes['default']);
43     
44     foreach ($themes as $k => $v)
45     {
46          if (!mkcompat::themeNeedUpgrade($v['root'])) unset($themes[$k]);
47     }
48     
49     if (count($themes) > 0)
50     {
51          echo '<table>';
52          foreach ($themes as $k => $v)
53          {
54               echo '<tr><th title="'.$v['desc'].'">'.$v['name'].'</th>'.
55                    '<td>'.$v['author'].'</td>'.
56                    '<td>'.$v['version'].'</td>';
57               
58               if ($v['root_writable'])
59               {
60                    echo '<td><form action="'.$p_url.'" method="post">'.
61                    form::hidden('root',$v['root']).
62                    form::hidden('type','theme').
63                    form::hidden('name',$v['name']).
64                    $core->formNonce().
65                    '<input type="submit" name="action" value="'.__('Upgrade').'"></input>'.
66                    '</form></td>';
67               } else {
68                    echo '<td>'.__('You do not have sufficient rights to upgrade this theme.').'</td>';
69               }
70                   
71               echo '</tr>';
72          }
73          echo '</table>';
74     }
75     else
76     {
77          echo '<p>'.__('Upgrade does not seem to be required for any theme.').'</p>';
78     }
79?>
80      <h2><?php echo __('Plugins requiring an upgrade'); ?></h2>
81<?php
82     $plugins = $core->plugins->getModules();
83     
84     foreach ($plugins as $k => $v)
85     {
86          if (!mkcompat::pluginNeedUpgrade($v['root'])) unset($plugins[$k]);
87     }
88     
89     if (count($plugins) > 0)
90     {
91          echo '<table>';
92          foreach ($plugins as $k => $v)
93          {
94               echo '<tr><th title="'.$v['desc'].'">'.$v['name'].'</th>'.
95                    '<td>'.$v['author'].'</td>'.
96                    '<td>'.$v['version'].'</td>';
97               
98               if ($v['root_writable'])
99               {
100                    echo '<td><form action="'.$p_url.'" method="post">'.
101                    form::hidden('root',$v['root']).
102                    form::hidden('type','plugin').
103                    form::hidden('name',$v['name']).
104                    $core->formNonce().
105                    '<input type="submit" name="action" value="'.__('Upgrade').'"></input>'.
106                    '</form></td>';
107               } else {
108                    echo '<td>'.__('You do not have sufficient rights to upgrade this plugin.').'</td>';
109               }
110                   
111               echo '</tr>';
112          }
113          echo '</table>';
114     }
115     else
116     {
117          echo '<p>'.__('Upgrade does not seem to be required for any plugin.').'</p>';
118     }
119?>
120  </body>
121</html>
Note: See TracBrowser for help on using the repository browser.

Sites map