Dotclear


Ignore:
Timestamp:
09/30/13 18:03:03 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
dcRepo
Message:

Revamp blog themes manager using new dcRepository stuff (no js and no css), and some dcModulesList enhancements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/plugins.php

    r2165 r2171  
    4343); 
    4444 
     45$list::setDistributedModules(array( 
     46     'aboutConfig', 
     47     'akismet', 
     48     'antispam', 
     49     'attachments', 
     50     'blogroll', 
     51     'blowupConfig', 
     52     'daInstaller', 
     53     'fairTrackbacks', 
     54     'importExport', 
     55     'maintenance', 
     56     'pages', 
     57     'pings', 
     58     'simpleMenu', 
     59     'tags', 
     60     'themeEditor', 
     61     'userPref', 
     62     'widgets' 
     63)); 
    4564 
    4665# -- Check for module configuration -- 
     
    112131 
    113132# -- Execute actions -- 
    114 if (empty($_POST['conf']) && $core->auth->isSuperAdmin() && $list->isPathWritable()) { 
    115  
    116      # Plugin upload 
    117      if ((!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file'])) || 
    118           (!empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url']))) 
    119      { 
    120           try 
    121           { 
    122                if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY, $_POST['your_pwd']))) { 
    123                     throw new Exception(__('Password verification failed')); 
    124                } 
    125                 
    126                if (!empty($_POST['upload_pkg'])) { 
    127                     files::uploadStatus($_FILES['pkg_file']); 
    128                      
    129                     $dest = $list->getPath().'/'.$_FILES['pkg_file']['name']; 
    130                     if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) { 
    131                          throw new Exception(__('Unable to move uploaded file.')); 
    132                     } 
    133                } 
    134                else { 
    135                     $url = urldecode($_POST['pkg_url']); 
    136                     $dest = $list->getPath().'/'.basename($url); 
    137                     $repository->download($url, $dest); 
    138                } 
    139  
    140                # --BEHAVIOR-- pluginBeforeAdd 
    141                $core->callBehavior('pluginsBeforeAdd', $plugin_id); 
    142                                
    143                $ret_code = $core->plugins->installPackage($dest, $core->plugins); 
    144  
    145                # --BEHAVIOR-- pluginAfterAdd 
    146                $core->callBehavior('pluginsAfterAdd', $plugin_id); 
    147                 
    148                http::redirect('plugins.php?msg='.($ret_code == 2 ? 'update' : 'install').'#plugins'); 
    149           } 
    150           catch (Exception $e) { 
    151                $core->error->add($e->getMessage()); 
    152           } 
    153      } 
    154      elseif (!empty($_POST['module'])) { 
    155           try { 
    156                $list->executeAction('plugins', $core->plugins, $repository); 
    157           } 
    158           catch (Exception $e) { 
    159                $core->error->add($e->getMessage()); 
    160           } 
     133if (!empty($_POST) && empty($_REQUEST['conf']) && $core->auth->isSuperAdmin() && $list->isPathWritable()) { 
     134     try { 
     135          $list->executeAction('plugins', $core->plugins, $repository); 
     136     } 
     137     catch (Exception $e) { 
     138          $core->error->add($e->getMessage()); 
    161139     } 
    162140} 
     
    185163# -- Succes messages -- 
    186164if (!empty($_GET['msg'])) { 
    187      $list->displayMessage($_GET['msg'],__('Plugins')); 
     165     $list->displayMessage($_GET['msg']); 
    188166} 
    189167 
     
    318296     echo '<p>'.__('You can install plugins by uploading or downloading zip files.').'</p>'; 
    319297      
    320      # 'Upload plugin' form 
    321      echo 
    322      '<form method="post" action="plugins.php" id="uploadpkg" enctype="multipart/form-data" class="fieldset">'. 
    323      '<h4>'.__('Upload a zip file').'</h4>'. 
    324      '<p class="field"><label for="pkg_file" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '.__('Plugin zip file:').'</label> '. 
    325      '<input type="file" id="pkg_file" name="pkg_file" /></p>'. 
    326      '<p class="field"><label for="your_pwd1" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '.__('Your password:').'</label> '. 
    327      form::password(array('your_pwd','your_pwd1'),20,255).'</p>'. 
    328      '<p><input type="submit" name="upload_pkg" value="'.__('Upload plugin').'" />'. 
    329      $core->formNonce(). 
    330      '</p>'. 
    331      '</form>'; 
    332       
    333      # 'Fetch plugin' form 
    334      echo 
    335      '<form method="post" action="plugins.php" id="fetchpkg" class="fieldset">'. 
    336      '<h4>'.__('Download a zip file').'</h4>'. 
    337      '<p class="field"><label for="pkg_url" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '.__('Plugin zip file URL:').'</label> '. 
    338      form::field(array('pkg_url','pkg_url'),40,255).'</p>'. 
    339      '<p class="field"><label for="your_pwd2" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '.__('Your password:').'</label> '. 
    340      form::password(array('your_pwd','your_pwd2'),20,255).'</p>'. 
    341      '<p><input type="submit" name="fetch_pkg" value="'.__('Download plugin').'" />'. 
    342      $core->formNonce().'</p>'. 
    343      '</form>'; 
     298     $list->displayManualForm(); 
    344299 
    345300     echo 
Note: See TracChangeset for help on using the changeset viewer.

Sites map