Changeset 2182:eaaf345b04f3
- Timestamp:
- 10/01/13 09:44:02 (12 years ago)
- Branch:
- dcRepo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blog_theme.php
r2175 r2182 66 66 } 67 67 68 # -- Check for module configuration --69 $conf_file = false;70 if (!empty($_REQUEST['conf']) && !empty($_REQUEST['module'])) {71 if (!$core->themes->moduleExists($_REQUEST['module'])) {72 $core->error->add(__('Unknow module ID'));73 }74 else {75 $module = $core->themes->getModules($_REQUEST['module']);76 $module = adminModulesList::parseModuleInfo($_REQUEST['module'], $module);77 78 if (!file_exists(path::real($module['root'].'/_config.php'))) {79 $core->error->add(__('This module has no configuration file.'));80 }81 else {82 $conf_file = path::real($module['root'].'/_config.php');83 }84 }85 }86 87 68 # -- Display module configuration page -- 88 if ($conf_file) { 69 if ($list->setConfigurationFile($core->themes, $core->blog->settings->system->theme)) { 70 71 # Get content before page headers 72 include $list->getConfigurationFile(); 73 74 # Gather content 75 $list->setConfigurationContent(); 76 77 # Display page 89 78 dcPage::open(__('Blog appearance'), 79 dcPage::jsPageTabs(). 80 dcPage::jsColorPicker(). 90 81 91 82 # --BEHAVIOR-- themesToolsHeaders 92 $core->callBehavior('themesToolsHeaders', $core, $module['id']),83 $core->callBehavior('themesToolsHeaders', $core, true), 93 84 94 85 dcPage::breadcrumb( … … 104 95 } 105 96 106 try { 107 if (!$module['standalone_config']) { 108 echo 109 '<form id="module_config" action="'.$list->getPageURL('conf=1').'" method="post" enctype="multipart/form-data">'. 110 '<h3>'.sprintf(__('Configure theme "%s"'), html::escapeHTML($module['name'])).'</h3>'. 111 '<p><a class="back" href="'.$list->getPageURL().'#themes">'.__('Back').'</a></p>'; 112 } 113 define('DC_CONTEXT_THEME', true); 114 115 include $conf_file; 116 117 if (!$module['standalone_config']) { 118 echo 119 '<p class="clear"><input type="submit" name="save" value="'.__('Save').'" />'. 120 form::hidden('module', $module['id']). 121 $core->formNonce().'</p>'. 122 '</form>'; 123 } 124 } 125 catch (Exception $e) { 126 echo '<div class="error"><p>'.$e->getMessage().'</p></div>'; 127 } 97 # Display previously gathered content 98 $list->getConfigurationContent(); 128 99 129 100 dcPage::close(); -
admin/plugins.php
r2175 r2182 63 63 )); 64 64 65 # -- Check for module configuration --66 $conf_file = false;67 if (!empty($_REQUEST['conf']) && !empty($_REQUEST['module'])) {68 if (!$core->plugins->moduleExists($_REQUEST['module'])) {69 $core->error->add(__('Unknow module ID'));70 }71 else {72 $module = $core->plugins->getModules($_REQUEST['module']);73 $module = adminModulesList::parseModuleInfo($_REQUEST['module'], $module);74 75 if (!file_exists(path::real($module['root'].'/_config.php'))) {76 $core->error->add(__('This module has no configuration file.'));77 }78 else {79 $conf_file = path::real($module['root'].'/_config.php');80 }81 }82 }83 84 65 # -- Display module configuration page -- 85 if ($conf_file) { 66 if ($list->setConfigurationFile($core->plugins)) { 67 68 # Get content before page headers 69 include $list->getConfigurationFile(); 70 71 # Gather content 72 $list->setConfigurationContent(); 73 74 # Display page 86 75 dcPage::open(__('Plugins management'), 87 76 88 77 # --BEHAVIOR-- pluginsToolsHeaders 89 $core->callBehavior('pluginsToolsHeaders', $core, $module['id']),78 $core->callBehavior('pluginsToolsHeaders', $core, true), 90 79 91 80 dcPage::breadcrumb( … … 97 86 ); 98 87 88 # Message 99 89 if (!empty($_GET['done'])){ 100 90 dcPage::success(__('Plugin successfully configured.')); 101 91 } 102 92 103 try { 104 if (!$module['standalone_config']) { 105 echo 106 '<form id="module_config" action="'.$list->getPageURL('conf=1').'" method="post" enctype="multipart/form-data">'. 107 '<h3>'.sprintf(__('Configure plugin "%s"'), html::escapeHTML($module['name'])).'</h3>'. 108 '<p><a class="back" href="'.$list->getPageURL().'#plugins">'.__('Back').'</a></p>'; 109 } 110 define('DC_CONTEXT_PLUGIN', true); 111 112 include $conf_file; 113 114 if (!$module['standalone_config']) { 115 echo 116 '<p class="clear"><input type="submit" name="save" value="'.__('Save').'" />'. 117 form::hidden('module', $module['id']). 118 $core->formNonce().'</p>'. 119 '</form>'; 120 } 121 } 122 catch (Exception $e) { 123 echo '<div class="error"><p>'.$e->getMessage().'</p></div>'; 124 } 93 # Display previously gathered content 94 $list->getConfigurationContent(); 125 95 126 96 dcPage::close(); -
inc/admin/lib.moduleslist.php
r2179 r2182 10 10 11 11 protected $list_id = 'unknow'; 12 13 protected $config_module = ''; 14 protected $config_file = ''; 15 protected $config_content = ''; 12 16 13 17 protected $path = false; … … 473 477 } 474 478 479 # Select (from repository) 480 if (in_array('choose', $actions) && $this->path_writable) { 481 $submits[] = '<input type="submit" name="choose" value="'.__('Choose').'" />'; 482 } 483 475 484 # Parse form 476 485 if (!empty($submits)) { … … 702 711 } 703 712 713 /** 714 * 715 * We need to get configuration content in three steps 716 * and out of this class to keep backward compatibility. 717 * 718 * if ($xxx->setConfigurationFile()) { 719 * include $xxx->getConfigurationFile(); 720 * } 721 * $xxx->setConfigurationContent(); 722 * ... [put here page headers and other stuff] 723 * $xxx->getConfigurationContent(); 724 * 725 */ 726 public function setConfigurationFile(dcModules $modules, $id=null) 727 { 728 if (empty($_REQUEST['conf']) || empty($_REQUEST['module']) && !$id) { 729 return false; 730 } 731 732 if (!empty($_REQUEST['module']) && empty($id)) { 733 $id = $_REQUEST['module']; 734 } 735 736 if (!$modules->moduleExists($id)) { 737 $core->error->add(__('Unknow module ID')); 738 return false; 739 } 740 741 $module = $modules->getModules($id); 742 $module = self::parseModuleInfo($id, $module); 743 $file = path::real($module['root'].'/_config.php'); 744 745 if (!file_exists($file)) { 746 $core->error->add(__('This module has no configuration file.')); 747 return false; 748 } 749 750 $this->config_module = $module; 751 $this->config_file = $file; 752 $this->config_content = ''; 753 754 if (!defined('DC_CONTEXT_MODULE')) { 755 define('DC_CONTEXT_MODULE', true); 756 } 757 758 return true; 759 } 760 761 public function getConfigurationFile() 762 { 763 if (!$this->config_file) { 764 return null; 765 } 766 767 ob_start(); 768 769 return $this->config_file; 770 } 771 772 public function setConfigurationContent() 773 { 774 if ($this->config_file) { 775 $this->config_content = ob_get_contents(); 776 } 777 778 ob_end_clean(); 779 780 return !empty($this->file_content); 781 } 782 783 public function getConfigurationContent() 784 { 785 if (!$this->config_file) { 786 return null; 787 } 788 789 if (!$this->config_module['standalone_config']) { 790 echo 791 '<form id="module_config" action="'.$this->getPageURL('conf=1').'" method="post" enctype="multipart/form-data">'. 792 '<h3>'.sprintf(__('Configure plugin "%s"'), html::escapeHTML($this->config_module['name'])).'</h3>'. 793 '<p><a class="back" href="'.$this->getPageURL().'#plugins">'.__('Back').'</a></p>'; 794 } 795 796 echo $this->config_content; 797 798 if (!$this->config_module['standalone_config']) { 799 echo 800 '<p class="clear"><input type="submit" name="save" value="'.__('Save').'" />'. 801 form::hidden('module', $this->config_module['id']). 802 $this->core->formNonce().'</p>'. 803 '</form>'; 804 } 805 806 return true; 807 } 808 704 809 public static function sanitizeString($str) 705 810 { … … 828 933 if ($current && $has_conf) { 829 934 $line .= 830 '<a href="'.$this->getPageURL(' conf=1').'" class="button">'.__('Configure theme').'</a> ';935 '<a href="'.$this->getPageURL('module='.$id.'&conf=1', false).'" class="button">'.__('Configure theme').'</a> '; 831 936 } 832 937 $line .= -
plugins/maintenance/_config.php
r2165 r2182 10 10 # 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 if (!defined('DC_CONTEXT_ PLUGIN')) { return; }12 if (!defined('DC_CONTEXT_MODULE')) { return; } 13 13 14 14 $core->blog->settings->addNamespace('maintenance');
Note: See TracChangeset
for help on using the changeset viewer.