Dotclear

Changeset 2431:4e82469144be


Ignore:
Timestamp:
10/17/13 20:02:55 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Message:

escape & in url, fixes #1785

File:
1 edited

Legend:

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

    r2428 r2431  
    146146     public function isDeletablePath($root) 
    147147     { 
    148           return $this->path_writable  
    149                && (preg_match('!^'.$this->path_pattern.'!', $root) || defined('DC_DEV') && DC_DEV)  
     148          return $this->path_writable 
     149               && (preg_match('!^'.$this->path_pattern.'!', $root) || defined('DC_DEV') && DC_DEV) 
    150150               && $this->core->auth->isSuperAdmin(); 
    151151     } 
     
    256256          } 
    257257 
    258           echo  
     258          echo 
    259259          '<div class="modules-search">'. 
    260260          '<form action="'.$this->getURL().'" method="get">'. 
     
    263263          '<input type="submit" value="'.__('OK').'" /> '; 
    264264 
    265           if ($query) {  
    266                echo  
     265          if ($query) { 
     266               echo 
    267267               ' <a href="'.$this->getURL().'" class="button">'.__('Reset search').'</a>'; 
    268268          } 
    269269 
    270           echo  
     270          echo 
    271271          '</p>'. 
    272272          '<p class="form-note">'. 
     
    276276 
    277277          if ($query) { 
    278                echo  
     278               echo 
    279279               '<p class="message">'.sprintf( 
    280                     __('Found %d result for search "%s":', 'Found %d results for search "%s":', count($this->data)),  
     280                    __('Found %d result for search "%s":', 'Found %d results for search "%s":', count($this->data)), 
    281281                    count($this->data), html::escapeHTML($query) 
    282282                    ). 
     
    434434      * Sanitize a module. 
    435435      * 
    436       * This clean infos of a module by adding default keys  
    437       * and clean some of them, sanitize module can safely  
     436      * This clean infos of a module by adding default keys 
     437      * and clean some of them, sanitize module can safely 
    438438      * be used in lists. 
    439439      * 
     
    444444          $label = empty($module['label']) ? $id : $module['label']; 
    445445          $name = __(empty($module['name']) ? $label : $module['name']); 
    446            
     446 
    447447          return array_merge( 
    448448               # Default values 
     
    521521     public function displayModules($cols=array('name', 'version', 'desc'), $actions=array(), $nav_limit=false) 
    522522     { 
    523           echo  
     523          echo 
    524524          '<div class="table-outer">'. 
    525525          '<table id="'.html::escapeHTML($this->list_id).'" class="modules'.(in_array('expander', $cols) ? ' expandable' : '').'">'. 
     
    527527 
    528528          if (in_array('name', $cols)) { 
    529                echo  
     529               echo 
    530530               '<th class="first nowrap"'.(in_array('icon', $cols) ? ' colspan="2"' : '').'>'.__('Name').'</th>'; 
    531531          } 
    532532 
    533533          if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 
    534                echo  
     534               echo 
    535535               '<th class="nowrap">'.__('Score').'</th>'; 
    536536          } 
    537537 
    538538          if (in_array('version', $cols)) { 
    539                echo  
     539               echo 
    540540               '<th class="nowrap count" scope="col">'.__('Version').'</th>'; 
    541541          } 
    542542 
    543543          if (in_array('current_version', $cols)) { 
    544                echo  
     544               echo 
    545545               '<th class="nowrap count" scope="col">'.__('Current version').'</th>'; 
    546546          } 
    547547 
    548548          if (in_array('desc', $cols)) { 
    549                echo  
     549               echo 
    550550               '<th class="nowrap" scope="col">'.__('Details').'</th>'; 
    551551          } 
    552552 
    553553          if (in_array('distrib', $cols)) { 
    554                echo  
     554               echo 
    555555               '<th'.(in_array('desc', $cols) ? '' : ' class="maximal"').'></th>'; 
    556556          } 
    557557 
    558558          if (!empty($actions) && $this->core->auth->isSuperAdmin()) { 
    559                echo  
     559               echo 
    560560               '<th class="minimal nowrap">'.__('Action').'</th>'; 
    561561          } 
    562562 
    563           echo  
     563          echo 
    564564          '</tr>'; 
    565565 
     
    585585               } 
    586586 
    587                echo  
     587               echo 
    588588               '<tr class="line" id="'.html::escapeHTML($this->list_id).'_m_'.html::escapeHTML($id).'">'; 
    589                 
     589 
    590590               $tds = 0; 
    591591 
    592592               if (in_array('icon', $cols)) { 
    593593                    $tds++; 
    594                     echo  
     594                    echo 
    595595                    '<td class="module-icon nowrap">'.sprintf( 
    596                          '<img alt="%1$s" title="%1$s" src="%2$s" />',  
     596                         '<img alt="%1$s" title="%1$s" src="%2$s" />', 
    597597                         html::escapeHTML($id), file_exists($module['root'].'/icon.png') ? 'index.php?pf='.$id.'/icon.png' : 'images/module.png' 
    598598                    ).'</td>'; 
     
    600600 
    601601               $tds++; 
    602                echo  
     602               echo 
    603603               '<td class="module-name nowrap" scope="row">'.html::escapeHTML($module['name']).'</td>'; 
    604604 
     
    606606               if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 
    607607                    $tds++; 
    608                     echo  
     608                    echo 
    609609                    '<td class="module-version nowrap count"><span class="debug">'.$module['score'].'</span></td>'; 
    610610               } 
     
    612612               if (in_array('version', $cols)) { 
    613613                    $tds++; 
    614                     echo  
     614                    echo 
    615615                    '<td class="module-version nowrap count">'.html::escapeHTML($module['version']).'</td>'; 
    616616               } 
     
    618618               if (in_array('current_version', $cols)) { 
    619619                    $tds++; 
    620                     echo  
     620                    echo 
    621621                    '<td class="module-current-version nowrap count">'.html::escapeHTML($module['current_version']).'</td>'; 
    622622               } 
     
    624624               if (in_array('desc', $cols)) { 
    625625                    $tds++; 
    626                     echo  
     626                    echo 
    627627                    '<td class="module-desc maximal">'.html::escapeHTML($module['desc']).'</td>'; 
    628628               } 
     
    630630               if (in_array('distrib', $cols)) { 
    631631                    $tds++; 
    632                     echo  
    633                     '<td class="module-distrib">'.(self::isDistributedModule($id) ?  
     632                    echo 
     633                    '<td class="module-distrib">'.(self::isDistributedModule($id) ? 
    634634                         '<img src="images/dotclear_pw.png" alt="'. 
    635635                         __('Plugin from official distribution').'" title="'. 
    636                          __('Plugin from official distribution').'" />'  
     636                         __('Plugin from official distribution').'" />' 
    637637                    : '').'</td>'; 
    638638               } 
     
    642642 
    643643                    $tds++; 
    644                     echo  
     644                    echo 
    645645                    '<td class="module-actions nowrap">'. 
    646646 
     
    658658               } 
    659659 
    660                echo  
     660               echo 
    661661               '</tr>'; 
    662662 
     
    667667 
    668668                    if (!empty($module['author']) || !empty($module['details']) || !empty($module['support'])) { 
    669                          echo  
     669                         echo 
    670670                         '<div><ul class="mod-more">'; 
    671671 
     
    683683                              $more[] = '<a class="module-support" href="'.$module['support'].'">'.__('Support').'</a>'; 
    684684                         } 
    685                           
     685 
    686686                         if (!empty($more)) { 
    687687                              echo 
     
    696696 
    697697                    if ($config || !empty($module['section']) || !empty($module['section'])) { 
    698                          echo  
     698                         echo 
    699699                         '<div><ul class="mod-more">'; 
    700700 
     
    724724               $count++; 
    725725          } 
    726           echo  
     726          echo 
    727727          '</table></div>'; 
    728728 
    729729          if(!$count && $this->getSearch() === null) { 
    730                echo  
     730               echo 
    731731               '<p class="message">'.__('No plugins matched your search.').'</p>'; 
    732732          } 
     
    735735               $buttons = $this->getGlobalActions($actions); 
    736736 
    737                echo  
     737               echo 
    738738               '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 
    739739               '<div>'. 
     
    768768                    # Deactivate 
    769769                    case 'activate': if ($module['root_writable']) { 
    770                          $submits[] =  
     770                         $submits[] = 
    771771                         '<input type="submit" name="activate" value="'.__('Activate').'" />'; 
    772772                    } break; 
     
    774774                    # Activate 
    775775                    case 'deactivate': if ($module['root_writable']) { 
    776                          $submits[] =  
     776                         $submits[] = 
    777777                         '<input type="submit" name="deactivate" value="'.__('Deactivate').'" class="reset" />'; 
    778778                    } break; 
     
    781781                    case 'delete': if ($this->isDeletablePath($module['root'])) { 
    782782                         $dev = !preg_match('!^'.$this->path_pattern.'!', $module['root']) && defined('DC_DEV') && DC_DEV ? ' debug' : ''; 
    783                          $submits[] =  
     783                         $submits[] = 
    784784                         '<input type="submit" class="delete '.$dev.'" name="delete" value="'.__('Delete').'" />'; 
    785785                    } break; 
     
    787787                    # Install (from store) 
    788788                    case 'install': if ($this->path_writable) { 
    789                          $submits[] =  
     789                         $submits[] = 
    790790                         '<input type="submit" name="install" value="'.__('Install').'" />'; 
    791791                    } break; 
     
    793793                    # Update (from store) 
    794794                    case 'update': if ($this->path_writable) { 
    795                          $submits[] =  
     795                         $submits[] = 
    796796                         '<input type="submit" name="update" value="'.__('Update').'" />'; 
    797797                    } break; 
     
    829829                    # Deactivate 
    830830                    case 'activate': if ($this->path_writable) { 
    831                          $submits[] =  
     831                         $submits[] = 
    832832                         '<input type="submit" name="activate" value="'.__('Activate all plugins from this list').'" />'; 
    833833                    } break; 
     
    835835                    # Activate 
    836836                    case 'deactivate': if ($this->path_writable) { 
    837                          $submits[] =  
     837                         $submits[] = 
    838838                         '<input type="submit" name="deactivate" value="'.__('Deactivate all plugins from this list').'" class="reset" />'; 
    839839                    } break; 
     
    841841                    # Update (from store) 
    842842                    case 'update': if ($this->path_writable) { 
    843                          $submits[] =  
     843                         $submits[] = 
    844844                         '<input type="submit" name="update" value="'.__('Update all plugins from this list').'" />'; 
    845845                    } break; 
     
    870870     public function doActions() 
    871871     { 
    872           if (empty($_POST) || !empty($_REQUEST['conf'])  
     872          if (empty($_POST) || !empty($_REQUEST['conf']) 
    873873          || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 
    874874               return null; 
     
    11191119          } 
    11201120          # Manual actions 
    1121           elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file'])  
     1121          elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 
    11221122               || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 
    11231123          { 
     
    11281128               if (!empty($_POST['upload_pkg'])) { 
    11291129                    files::uploadStatus($_FILES['pkg_file']); 
    1130                      
     1130 
    11311131                    $dest = $this->getPath().'/'.$_FILES['pkg_file']['name']; 
    11321132                    if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) { 
     
    12201220               return false; 
    12211221          } 
    1222            
     1222 
    12231223          if (!empty($_REQUEST['module']) && empty($id)) { 
    12241224               $id = $_REQUEST['module']; 
     
    13431343     public function displayModules($cols=array('name', 'config', 'version', 'desc'), $actions=array(), $nav_limit=false) 
    13441344     { 
    1345           echo  
     1345          echo 
    13461346          '<div id="'.html::escapeHTML($this->list_id).'" class="modules'.(in_array('expander', $cols) ? ' expandable' : '').' one-box">'; 
    13471347 
     
    13711371               $distrib = self::isDistributedModule($id) ? ' dc-box' : ''; 
    13721372 
    1373                $line =  
     1373               $line = 
    13741374               '<div class="box '.($current ? 'medium current-theme' : 'theme').$distrib.'">'; 
    13751375 
    13761376               if (in_array('name', $cols) && !$current) { 
    1377                     $line .=  
     1377                    $line .= 
    13781378                    '<h4 class="module-name">'.html::escapeHTML($module['name']).'</h4>'; 
    13791379               } 
     
    13811381               # Display score only for debug purpose 
    13821382               if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 
    1383                     $line .=  
     1383                    $line .= 
    13841384                    '<p class="module-score debug">'.sprintf(__('Score: %s'), $module['score']).'</p>'; 
    13851385               } 
     
    13991399                    } 
    14001400 
    1401                     $line .=  
     1401                    $line .= 
    14021402                    '<div class="module-sshot"><img src="'.$sshot.'" alt="'. 
    14031403                    sprintf(__('%s screenshot.'), html::escapeHTML($module['name'])).'" /></div>'; 
    14041404               } 
    14051405 
    1406                $line .=  
     1406               $line .= 
    14071407               '<div class="module-infos toggle-bloc">'; 
    14081408 
    14091409               if (in_array('name', $cols) && $current) { 
    1410                     $line .=  
     1410                    $line .= 
    14111411                    '<h4 class="module-name">'.html::escapeHTML($module['name']).'</h4>'; 
    14121412               } 
     
    14161416 
    14171417               if (in_array('desc', $cols)) { 
    1418                     $line .=  
     1418                    $line .= 
    14191419                    '<span class="module-desc">'.html::escapeHTML($module['desc']).'</span> '; 
    14201420               } 
    14211421 
    14221422               if (in_array('author', $cols)) { 
    1423                     $line .=  
     1423                    $line .= 
    14241424                    '<span class="module-author">'.sprintf(__('by %s'),html::escapeHTML($module['author'])).'</span> '; 
    14251425               } 
    14261426 
    14271427               if (in_array('version', $cols)) { 
    1428                     $line .=  
     1428                    $line .= 
    14291429                    '<span class="module-version">'.sprintf(__('version %s'),html::escapeHTML($module['version'])).'</span> '; 
    14301430               } 
    14311431 
    14321432               if (in_array('current_version', $cols)) { 
    1433                     $line .=  
     1433                    $line .= 
    14341434                    '<span class="module-current-version">'.sprintf(__('(current version %s)'),html::escapeHTML($module['current_version'])).'</span> '; 
    14351435               } 
     
    14371437               if (in_array('parent', $cols) && !empty($module['parent'])) { 
    14381438                    if ($this->modules->moduleExists($module['parent'])) { 
    1439                          $line .=  
     1439                         $line .= 
    14401440                         '<span class="module-parent-ok">'.sprintf(__('(built on "%s")'),html::escapeHTML($module['parent'])).'</span> '; 
    14411441                    } 
    14421442                    else { 
    1443                          $line .=  
     1443                         $line .= 
    14441444                         '<span class="module-parent-missing">'.sprintf(__('(requires "%s")'),html::escapeHTML($module['parent'])).'</span> '; 
    14451445                    } 
     
    14531453 
    14541454                    if ($has_details) { 
    1455                          $line .=  
     1455                         $line .= 
    14561456                         '<a class="module-details" href="'.$module['details'].'">'.__('Details').'</a>'; 
    14571457                    } 
    14581458 
    14591459                    if ($has_support) { 
    1460                          $line .=  
     1460                         $line .= 
    14611461                         ' - <a class="module-support" href="'.$module['support'].'">'.__('Support').'</a>'; 
    14621462                    } 
     
    14661466               } 
    14671467 
    1468                $line .=  
     1468               $line .= 
    14691469               '</p>'. 
    14701470               '</div>'; 
    14711471 
    1472                $line .=  
     1472               $line .= 
    14731473               '<div class="module-actions toggle-bloc">'; 
    1474                 
     1474 
    14751475               # Plugins actions 
    14761476               if ($current) { 
     
    14811481                              http::concatURL($this->core->blog->settings->system->themes_url, '/'.$id) : 
    14821482                              http::concatURL($this->core->blog->url, $this->core->blog->settings->system->themes_url.'/'.$id); 
    1483                          $line .=  
     1483                         $line .= 
    14841484                         '<p><a href="'.$theme_url.'/style.css">'.__('View stylesheet').'</a></p>'; 
    14851485                    } 
     
    14881488 
    14891489                    if (file_exists(path::real($this->core->blog->themes_path.'/'.$id).'/_config.php')) { 
    1490                          $line .=  
    1491                          '<p><a href="'.$this->getURL('module='.$id.'&conf=1', false).'" class="button submit">'.__('Configure theme').'</a></p>'; 
     1490                         $line .= 
     1491                         '<p><a href="'.$this->getURL('module='.$id.'&amp;conf=1', false).'" class="button submit">'.__('Configure theme').'</a></p>'; 
    14921492                    } 
    14931493 
    14941494                    # --BEHAVIOR-- adminCurrentThemeDetails 
    1495                     $line .=  
     1495                    $line .= 
    14961496                    $this->core->callBehavior('adminCurrentThemeDetails', $this->core, $id, $module); 
    14971497 
     
    15081508 
    15091509                    implode(' ', $this->getActions($id, $module, $actions)). 
    1510   
     1510 
    15111511                    '</p>'. 
    15121512                    '</form>'; 
    15131513               } 
    15141514 
    1515                $line .=  
    1516                '</div>'; 
    1517  
    15181515               $line .= 
    15191516               '</div>'; 
    15201517 
     1518               $line .= 
     1519               '</div>'; 
     1520 
    15211521               $count++; 
    15221522 
    15231523               $res = $current ? $line.$res : $res.$line; 
    15241524          } 
    1525           echo  
     1525          echo 
    15261526          $res. 
    15271527          '</div>'; 
    15281528 
    15291529          if(!$count && $this->getSearch() === null) { 
    1530                echo  
     1530               echo 
    15311531               '<p class="message">'.__('No themes matched your search.').'</p>'; 
    15321532          } 
     
    15351535               $buttons = $this->getGlobalActions($actions); 
    15361536 
    1537                echo  
     1537               echo 
    15381538               '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 
    15391539               '<div>'. 
     
    15571557               # Select theme to use on curent blog 
    15581558               if (in_array('select', $actions) && $this->path_writable) { 
    1559                     $submits[] =  
     1559                    $submits[] = 
    15601560                    '<input type="submit" name="select" value="'.__('Use this one').'" />'; 
    15611561               } 
     
    15781578                    # Update (from store) 
    15791579                    case 'update': if ($this->path_writable) { 
    1580                          $submits[] =  
     1580                         $submits[] = 
    15811581                         '<input type="submit" name="update" value="'.__('Update all themes from this list').'" />'; 
    15821582                    } break; 
     
    16001600     public function doActions() 
    16011601     { 
    1602           if (empty($_POST) || !empty($_REQUEST['conf'])  
     1602          if (empty($_POST) || !empty($_REQUEST['conf']) 
    16031603          || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 
    16041604               return null; 
     
    18061806          } 
    18071807          # Manual actions 
    1808           elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file'])  
     1808          elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 
    18091809               || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 
    18101810          { 
     
    18151815               if (!empty($_POST['upload_pkg'])) { 
    18161816                    files::uploadStatus($_FILES['pkg_file']); 
    1817                      
     1817 
    18181818                    $dest = $this->getPath().'/'.$_FILES['pkg_file']['name']; 
    18191819                    if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map