Changeset 2431:4e82469144be
- Timestamp:
- 10/17/13 20:02:55 (12 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.moduleslist.php
r2428 r2431 146 146 public function isDeletablePath($root) 147 147 { 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) 150 150 && $this->core->auth->isSuperAdmin(); 151 151 } … … 256 256 } 257 257 258 echo 258 echo 259 259 '<div class="modules-search">'. 260 260 '<form action="'.$this->getURL().'" method="get">'. … … 263 263 '<input type="submit" value="'.__('OK').'" /> '; 264 264 265 if ($query) { 266 echo 265 if ($query) { 266 echo 267 267 ' <a href="'.$this->getURL().'" class="button">'.__('Reset search').'</a>'; 268 268 } 269 269 270 echo 270 echo 271 271 '</p>'. 272 272 '<p class="form-note">'. … … 276 276 277 277 if ($query) { 278 echo 278 echo 279 279 '<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)), 281 281 count($this->data), html::escapeHTML($query) 282 282 ). … … 434 434 * Sanitize a module. 435 435 * 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 438 438 * be used in lists. 439 439 * … … 444 444 $label = empty($module['label']) ? $id : $module['label']; 445 445 $name = __(empty($module['name']) ? $label : $module['name']); 446 446 447 447 return array_merge( 448 448 # Default values … … 521 521 public function displayModules($cols=array('name', 'version', 'desc'), $actions=array(), $nav_limit=false) 522 522 { 523 echo 523 echo 524 524 '<div class="table-outer">'. 525 525 '<table id="'.html::escapeHTML($this->list_id).'" class="modules'.(in_array('expander', $cols) ? ' expandable' : '').'">'. … … 527 527 528 528 if (in_array('name', $cols)) { 529 echo 529 echo 530 530 '<th class="first nowrap"'.(in_array('icon', $cols) ? ' colspan="2"' : '').'>'.__('Name').'</th>'; 531 531 } 532 532 533 533 if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 534 echo 534 echo 535 535 '<th class="nowrap">'.__('Score').'</th>'; 536 536 } 537 537 538 538 if (in_array('version', $cols)) { 539 echo 539 echo 540 540 '<th class="nowrap count" scope="col">'.__('Version').'</th>'; 541 541 } 542 542 543 543 if (in_array('current_version', $cols)) { 544 echo 544 echo 545 545 '<th class="nowrap count" scope="col">'.__('Current version').'</th>'; 546 546 } 547 547 548 548 if (in_array('desc', $cols)) { 549 echo 549 echo 550 550 '<th class="nowrap" scope="col">'.__('Details').'</th>'; 551 551 } 552 552 553 553 if (in_array('distrib', $cols)) { 554 echo 554 echo 555 555 '<th'.(in_array('desc', $cols) ? '' : ' class="maximal"').'></th>'; 556 556 } 557 557 558 558 if (!empty($actions) && $this->core->auth->isSuperAdmin()) { 559 echo 559 echo 560 560 '<th class="minimal nowrap">'.__('Action').'</th>'; 561 561 } 562 562 563 echo 563 echo 564 564 '</tr>'; 565 565 … … 585 585 } 586 586 587 echo 587 echo 588 588 '<tr class="line" id="'.html::escapeHTML($this->list_id).'_m_'.html::escapeHTML($id).'">'; 589 589 590 590 $tds = 0; 591 591 592 592 if (in_array('icon', $cols)) { 593 593 $tds++; 594 echo 594 echo 595 595 '<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" />', 597 597 html::escapeHTML($id), file_exists($module['root'].'/icon.png') ? 'index.php?pf='.$id.'/icon.png' : 'images/module.png' 598 598 ).'</td>'; … … 600 600 601 601 $tds++; 602 echo 602 echo 603 603 '<td class="module-name nowrap" scope="row">'.html::escapeHTML($module['name']).'</td>'; 604 604 … … 606 606 if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 607 607 $tds++; 608 echo 608 echo 609 609 '<td class="module-version nowrap count"><span class="debug">'.$module['score'].'</span></td>'; 610 610 } … … 612 612 if (in_array('version', $cols)) { 613 613 $tds++; 614 echo 614 echo 615 615 '<td class="module-version nowrap count">'.html::escapeHTML($module['version']).'</td>'; 616 616 } … … 618 618 if (in_array('current_version', $cols)) { 619 619 $tds++; 620 echo 620 echo 621 621 '<td class="module-current-version nowrap count">'.html::escapeHTML($module['current_version']).'</td>'; 622 622 } … … 624 624 if (in_array('desc', $cols)) { 625 625 $tds++; 626 echo 626 echo 627 627 '<td class="module-desc maximal">'.html::escapeHTML($module['desc']).'</td>'; 628 628 } … … 630 630 if (in_array('distrib', $cols)) { 631 631 $tds++; 632 echo 633 '<td class="module-distrib">'.(self::isDistributedModule($id) ? 632 echo 633 '<td class="module-distrib">'.(self::isDistributedModule($id) ? 634 634 '<img src="images/dotclear_pw.png" alt="'. 635 635 __('Plugin from official distribution').'" title="'. 636 __('Plugin from official distribution').'" />' 636 __('Plugin from official distribution').'" />' 637 637 : '').'</td>'; 638 638 } … … 642 642 643 643 $tds++; 644 echo 644 echo 645 645 '<td class="module-actions nowrap">'. 646 646 … … 658 658 } 659 659 660 echo 660 echo 661 661 '</tr>'; 662 662 … … 667 667 668 668 if (!empty($module['author']) || !empty($module['details']) || !empty($module['support'])) { 669 echo 669 echo 670 670 '<div><ul class="mod-more">'; 671 671 … … 683 683 $more[] = '<a class="module-support" href="'.$module['support'].'">'.__('Support').'</a>'; 684 684 } 685 685 686 686 if (!empty($more)) { 687 687 echo … … 696 696 697 697 if ($config || !empty($module['section']) || !empty($module['section'])) { 698 echo 698 echo 699 699 '<div><ul class="mod-more">'; 700 700 … … 724 724 $count++; 725 725 } 726 echo 726 echo 727 727 '</table></div>'; 728 728 729 729 if(!$count && $this->getSearch() === null) { 730 echo 730 echo 731 731 '<p class="message">'.__('No plugins matched your search.').'</p>'; 732 732 } … … 735 735 $buttons = $this->getGlobalActions($actions); 736 736 737 echo 737 echo 738 738 '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 739 739 '<div>'. … … 768 768 # Deactivate 769 769 case 'activate': if ($module['root_writable']) { 770 $submits[] = 770 $submits[] = 771 771 '<input type="submit" name="activate" value="'.__('Activate').'" />'; 772 772 } break; … … 774 774 # Activate 775 775 case 'deactivate': if ($module['root_writable']) { 776 $submits[] = 776 $submits[] = 777 777 '<input type="submit" name="deactivate" value="'.__('Deactivate').'" class="reset" />'; 778 778 } break; … … 781 781 case 'delete': if ($this->isDeletablePath($module['root'])) { 782 782 $dev = !preg_match('!^'.$this->path_pattern.'!', $module['root']) && defined('DC_DEV') && DC_DEV ? ' debug' : ''; 783 $submits[] = 783 $submits[] = 784 784 '<input type="submit" class="delete '.$dev.'" name="delete" value="'.__('Delete').'" />'; 785 785 } break; … … 787 787 # Install (from store) 788 788 case 'install': if ($this->path_writable) { 789 $submits[] = 789 $submits[] = 790 790 '<input type="submit" name="install" value="'.__('Install').'" />'; 791 791 } break; … … 793 793 # Update (from store) 794 794 case 'update': if ($this->path_writable) { 795 $submits[] = 795 $submits[] = 796 796 '<input type="submit" name="update" value="'.__('Update').'" />'; 797 797 } break; … … 829 829 # Deactivate 830 830 case 'activate': if ($this->path_writable) { 831 $submits[] = 831 $submits[] = 832 832 '<input type="submit" name="activate" value="'.__('Activate all plugins from this list').'" />'; 833 833 } break; … … 835 835 # Activate 836 836 case 'deactivate': if ($this->path_writable) { 837 $submits[] = 837 $submits[] = 838 838 '<input type="submit" name="deactivate" value="'.__('Deactivate all plugins from this list').'" class="reset" />'; 839 839 } break; … … 841 841 # Update (from store) 842 842 case 'update': if ($this->path_writable) { 843 $submits[] = 843 $submits[] = 844 844 '<input type="submit" name="update" value="'.__('Update all plugins from this list').'" />'; 845 845 } break; … … 870 870 public function doActions() 871 871 { 872 if (empty($_POST) || !empty($_REQUEST['conf']) 872 if (empty($_POST) || !empty($_REQUEST['conf']) 873 873 || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 874 874 return null; … … 1119 1119 } 1120 1120 # Manual actions 1121 elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 1121 elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 1122 1122 || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 1123 1123 { … … 1128 1128 if (!empty($_POST['upload_pkg'])) { 1129 1129 files::uploadStatus($_FILES['pkg_file']); 1130 1130 1131 1131 $dest = $this->getPath().'/'.$_FILES['pkg_file']['name']; 1132 1132 if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) { … … 1220 1220 return false; 1221 1221 } 1222 1222 1223 1223 if (!empty($_REQUEST['module']) && empty($id)) { 1224 1224 $id = $_REQUEST['module']; … … 1343 1343 public function displayModules($cols=array('name', 'config', 'version', 'desc'), $actions=array(), $nav_limit=false) 1344 1344 { 1345 echo 1345 echo 1346 1346 '<div id="'.html::escapeHTML($this->list_id).'" class="modules'.(in_array('expander', $cols) ? ' expandable' : '').' one-box">'; 1347 1347 … … 1371 1371 $distrib = self::isDistributedModule($id) ? ' dc-box' : ''; 1372 1372 1373 $line = 1373 $line = 1374 1374 '<div class="box '.($current ? 'medium current-theme' : 'theme').$distrib.'">'; 1375 1375 1376 1376 if (in_array('name', $cols) && !$current) { 1377 $line .= 1377 $line .= 1378 1378 '<h4 class="module-name">'.html::escapeHTML($module['name']).'</h4>'; 1379 1379 } … … 1381 1381 # Display score only for debug purpose 1382 1382 if (in_array('score', $cols) && $this->getSearch() !== null && defined('DC_DEBUG') && DC_DEBUG) { 1383 $line .= 1383 $line .= 1384 1384 '<p class="module-score debug">'.sprintf(__('Score: %s'), $module['score']).'</p>'; 1385 1385 } … … 1399 1399 } 1400 1400 1401 $line .= 1401 $line .= 1402 1402 '<div class="module-sshot"><img src="'.$sshot.'" alt="'. 1403 1403 sprintf(__('%s screenshot.'), html::escapeHTML($module['name'])).'" /></div>'; 1404 1404 } 1405 1405 1406 $line .= 1406 $line .= 1407 1407 '<div class="module-infos toggle-bloc">'; 1408 1408 1409 1409 if (in_array('name', $cols) && $current) { 1410 $line .= 1410 $line .= 1411 1411 '<h4 class="module-name">'.html::escapeHTML($module['name']).'</h4>'; 1412 1412 } … … 1416 1416 1417 1417 if (in_array('desc', $cols)) { 1418 $line .= 1418 $line .= 1419 1419 '<span class="module-desc">'.html::escapeHTML($module['desc']).'</span> '; 1420 1420 } 1421 1421 1422 1422 if (in_array('author', $cols)) { 1423 $line .= 1423 $line .= 1424 1424 '<span class="module-author">'.sprintf(__('by %s'),html::escapeHTML($module['author'])).'</span> '; 1425 1425 } 1426 1426 1427 1427 if (in_array('version', $cols)) { 1428 $line .= 1428 $line .= 1429 1429 '<span class="module-version">'.sprintf(__('version %s'),html::escapeHTML($module['version'])).'</span> '; 1430 1430 } 1431 1431 1432 1432 if (in_array('current_version', $cols)) { 1433 $line .= 1433 $line .= 1434 1434 '<span class="module-current-version">'.sprintf(__('(current version %s)'),html::escapeHTML($module['current_version'])).'</span> '; 1435 1435 } … … 1437 1437 if (in_array('parent', $cols) && !empty($module['parent'])) { 1438 1438 if ($this->modules->moduleExists($module['parent'])) { 1439 $line .= 1439 $line .= 1440 1440 '<span class="module-parent-ok">'.sprintf(__('(built on "%s")'),html::escapeHTML($module['parent'])).'</span> '; 1441 1441 } 1442 1442 else { 1443 $line .= 1443 $line .= 1444 1444 '<span class="module-parent-missing">'.sprintf(__('(requires "%s")'),html::escapeHTML($module['parent'])).'</span> '; 1445 1445 } … … 1453 1453 1454 1454 if ($has_details) { 1455 $line .= 1455 $line .= 1456 1456 '<a class="module-details" href="'.$module['details'].'">'.__('Details').'</a>'; 1457 1457 } 1458 1458 1459 1459 if ($has_support) { 1460 $line .= 1460 $line .= 1461 1461 ' - <a class="module-support" href="'.$module['support'].'">'.__('Support').'</a>'; 1462 1462 } … … 1466 1466 } 1467 1467 1468 $line .= 1468 $line .= 1469 1469 '</p>'. 1470 1470 '</div>'; 1471 1471 1472 $line .= 1472 $line .= 1473 1473 '<div class="module-actions toggle-bloc">'; 1474 1474 1475 1475 # Plugins actions 1476 1476 if ($current) { … … 1481 1481 http::concatURL($this->core->blog->settings->system->themes_url, '/'.$id) : 1482 1482 http::concatURL($this->core->blog->url, $this->core->blog->settings->system->themes_url.'/'.$id); 1483 $line .= 1483 $line .= 1484 1484 '<p><a href="'.$theme_url.'/style.css">'.__('View stylesheet').'</a></p>'; 1485 1485 } … … 1488 1488 1489 1489 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.'&conf=1', false).'" class="button submit">'.__('Configure theme').'</a></p>'; 1492 1492 } 1493 1493 1494 1494 # --BEHAVIOR-- adminCurrentThemeDetails 1495 $line .= 1495 $line .= 1496 1496 $this->core->callBehavior('adminCurrentThemeDetails', $this->core, $id, $module); 1497 1497 … … 1508 1508 1509 1509 implode(' ', $this->getActions($id, $module, $actions)). 1510 1510 1511 1511 '</p>'. 1512 1512 '</form>'; 1513 1513 } 1514 1514 1515 $line .=1516 '</div>';1517 1518 1515 $line .= 1519 1516 '</div>'; 1520 1517 1518 $line .= 1519 '</div>'; 1520 1521 1521 $count++; 1522 1522 1523 1523 $res = $current ? $line.$res : $res.$line; 1524 1524 } 1525 echo 1525 echo 1526 1526 $res. 1527 1527 '</div>'; 1528 1528 1529 1529 if(!$count && $this->getSearch() === null) { 1530 echo 1530 echo 1531 1531 '<p class="message">'.__('No themes matched your search.').'</p>'; 1532 1532 } … … 1535 1535 $buttons = $this->getGlobalActions($actions); 1536 1536 1537 echo 1537 echo 1538 1538 '<form action="'.$this->getURL().'" method="post" class="global-actions-buttons">'. 1539 1539 '<div>'. … … 1557 1557 # Select theme to use on curent blog 1558 1558 if (in_array('select', $actions) && $this->path_writable) { 1559 $submits[] = 1559 $submits[] = 1560 1560 '<input type="submit" name="select" value="'.__('Use this one').'" />'; 1561 1561 } … … 1578 1578 # Update (from store) 1579 1579 case 'update': if ($this->path_writable) { 1580 $submits[] = 1580 $submits[] = 1581 1581 '<input type="submit" name="update" value="'.__('Update all themes from this list').'" />'; 1582 1582 } break; … … 1600 1600 public function doActions() 1601 1601 { 1602 if (empty($_POST) || !empty($_REQUEST['conf']) 1602 if (empty($_POST) || !empty($_REQUEST['conf']) 1603 1603 || !$this->core->auth->isSuperAdmin() || !$this->isWritablePath()) { 1604 1604 return null; … … 1806 1806 } 1807 1807 # Manual actions 1808 elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 1808 elseif (!empty($_POST['upload_pkg']) && !empty($_FILES['pkg_file']) 1809 1809 || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 1810 1810 { … … 1815 1815 if (!empty($_POST['upload_pkg'])) { 1816 1816 files::uploadStatus($_FILES['pkg_file']); 1817 1817 1818 1818 $dest = $this->getPath().'/'.$_FILES['pkg_file']['name']; 1819 1819 if (!move_uploaded_file($_FILES['pkg_file']['tmp_name'], $dest)) {
Note: See TracChangeset
for help on using the changeset viewer.