Dotclear


Ignore:
Timestamp:
10/25/13 00:53:21 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
2.6
Message:

Fix user perms on plugins and themes list. (plugins that use list behaviors must check their own rights), fixes #1815

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.moduleslist.php

    r2488 r2490  
    795795 
    796796                    # Deactivate 
    797                     case 'activate': if ($module['root_writable']) { 
     797                    case 'activate': if ($this->core->auth->isSuperAdmin() && $module['root_writable']) { 
    798798                         $submits[] = 
    799799                         '<input type="submit" name="activate['.html::escapeHTML($id).']" value="'.__('Activate').'" />'; 
     
    801801 
    802802                    # Activate 
    803                     case 'deactivate': if ($module['root_writable']) { 
     803                    case 'deactivate': if ($this->core->auth->isSuperAdmin() && $module['root_writable']) { 
    804804                         $submits[] = 
    805805                         '<input type="submit" name="deactivate['.html::escapeHTML($id).']" value="'.__('Deactivate').'" class="reset" />'; 
     
    807807 
    808808                    # Delete 
    809                     case 'delete': if ($this->isDeletablePath($module['root'])) { 
     809                    case 'delete': if ($this->core->auth->isSuperAdmin() && $this->isDeletablePath($module['root'])) { 
    810810                         $dev = !preg_match('!^'.$this->path_pattern.'!', $module['root']) && defined('DC_DEV') && DC_DEV ? ' debug' : ''; 
    811811                         $submits[] = 
     
    814814 
    815815                    # Install (from store) 
    816                     case 'install': if ($this->path_writable) { 
     816                    case 'install': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    817817                         $submits[] = 
    818818                         '<input type="submit" name="install['.html::escapeHTML($id).']" value="'.__('Install').'" />'; 
     
    820820 
    821821                    # Update (from store) 
    822                     case 'update': if ($this->path_writable) { 
     822                    case 'update': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    823823                         $submits[] = 
    824824                         '<input type="submit" name="update['.html::escapeHTML($id).']" value="'.__('Update').'" />'; 
     
    857857 
    858858                    # Deactivate 
    859                     case 'activate': if ($this->path_writable) { 
     859                    case 'activate': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    860860                         $submits[] = 
    861861                         '<input type="submit" name="activate" value="'.($with_selection ? 
     
    866866 
    867867                    # Activate 
    868                     case 'deactivate': if ($this->path_writable) { 
     868                    case 'deactivate': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    869869                         $submits[] = 
    870870                         '<input type="submit" name="deactivate" value="'.($with_selection ? 
     
    875875 
    876876                    # Update (from store) 
    877                     case 'update': if ($this->path_writable) { 
     877                    case 'update': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    878878                         $submits[] = 
    879879                         '<input type="submit" name="update" value="'.($with_selection ? 
     
    909909     { 
    910910          if (empty($_POST) || !empty($_REQUEST['conf']) 
    911           || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 
     911          || !$this->isWritablePath()) { 
    912912               return null; 
    913913          } 
     
    915915          $modules = !empty($_POST['modules']) && is_array($_POST['modules']) ? array_values($_POST['modules']) : array(); 
    916916 
    917           if (!empty($_POST['delete'])) { 
     917          if ($this->core->auth->isSuperAdmin() && !empty($_POST['delete'])) { 
    918918 
    919919               if (is_array($_POST['delete'])) { 
     
    970970          } 
    971971 
    972           elseif (!empty($_POST['install'])) { 
     972          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['install'])) { 
    973973 
    974974               if (is_array($_POST['install'])) { 
     
    10081008          } 
    10091009 
    1010           elseif (!empty($_POST['activate'])) { 
     1010          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['activate'])) { 
    10111011 
    10121012               if (is_array($_POST['activate'])) { 
     
    10431043          } 
    10441044 
    1045           elseif (!empty($_POST['deactivate'])) { 
     1045          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['deactivate'])) { 
    10461046 
    10471047               if (is_array($_POST['deactivate'])) { 
     
    10911091          } 
    10921092 
    1093           elseif (!empty($_POST['update'])) { 
     1093          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['update'])) { 
    10941094 
    10951095               if (is_array($_POST['update'])) { 
     
    16331633 
    16341634                    # Update (from store) 
    1635                     case 'update': if ($this->path_writable) { 
     1635                    case 'update': if ($this->core->auth->isSuperAdmin() && $this->path_writable) { 
    16361636                         $submits[] = 
    16371637                         '<input type="submit" name="update" value="'.($with_selection ? 
     
    16591659     public function doActions() 
    16601660     { 
    1661           if (empty($_POST) || !empty($_REQUEST['conf']) 
    1662           || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 
     1661          if (empty($_POST) || !empty($_REQUEST['conf']) || !$this->isWritablePath()) { 
    16631662               return null; 
    16641663          } 
     
    16861685          } 
    16871686 
    1688           elseif (!empty($_POST['activate'])) { 
     1687          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['activate'])) { 
    16891688 
    16901689               if (is_array($_POST['activate'])) { 
     
    17211720          } 
    17221721 
    1723           elseif (!empty($_POST['deactivate'])) { 
     1722          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['deactivate'])) { 
    17241723 
    17251724               if (is_array($_POST['deactivate'])) { 
     
    17691768          } 
    17701769 
    1771           elseif (!empty($_POST['delete'])) { 
     1770          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['delete'])) { 
    17721771 
    17731772               if (is_array($_POST['delete'])) { 
     
    18241823          } 
    18251824 
    1826           elseif (!empty($_POST['install'])) { 
     1825          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['install'])) { 
    18271826 
    18281827               if (is_array($_POST['install'])) { 
     
    18621861          } 
    18631862 
    1864           elseif (!empty($_POST['update'])) { 
     1863          elseif ($this->core->auth->isSuperAdmin() && !empty($_POST['update'])) { 
    18651864 
    18661865               if (is_array($_POST['update'])) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map