[Options] Fixes shoddy get_option() function
这个提交包含在:
		
							父节点
							
								
									985e71638d
								
							
						
					
					
						当前提交
						eaf814b336
					
				
					共有  3 个文件被更改,包括 18 次插入 和 24 次删除
				
			
		|  | @ -75,7 +75,7 @@ class Options extends CI_Controller { | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| 			// Update theme choice within the options system
 | 			// Update theme choice within the options system
 | ||||||
| 			$theme_update_status = $this->optionslib->update('theme', $this->input->post('theme')); | 			$theme_update_status = $this->optionslib->update('theme', $this->input->post('theme'), 'yes'); | ||||||
| 
 | 
 | ||||||
| 			// If theme update is complete set a flashsession with a success note
 | 			// If theme update is complete set a flashsession with a success note
 | ||||||
| 			if($theme_update_status == TRUE) { | 			if($theme_update_status == TRUE) { | ||||||
|  |  | ||||||
|  | @ -45,12 +45,23 @@ class OptionsLib { | ||||||
|     function get_option($option_name) { |     function get_option($option_name) { | ||||||
|         // Make Codeigniter functions available to library
 |         // Make Codeigniter functions available to library
 | ||||||
|         $CI =& get_instance(); |         $CI =& get_instance(); | ||||||
| 
 |         if (strpos($option_name, 'option_') !== false) {  | ||||||
|         if (strpos($option_name, 'option_')) {  |             if(!$CI->config->item($option_name)) { | ||||||
|             if(!$CI->config->item('option_'.$option_name)) { |  | ||||||
|                  //Load the options model
 |                  //Load the options model
 | ||||||
|                 $CI->load->model('options_model'); |                 $CI->load->model('options_model'); | ||||||
|  |                 $removed_options_tag = trim($option_name, 'option_'); | ||||||
|  |                 // call library function to get options value
 | ||||||
|  |                 $options_result = $CI->options_model->item($removed_options_tag); | ||||||
|                      |                      | ||||||
|  |                 // return option_value as a string
 | ||||||
|  |                 return $options_result; | ||||||
|  |             } else { | ||||||
|  |                 return $CI->config->item($option_name); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             if(!$CI->config->item($option_name)) { | ||||||
|  |                 //Load the options model
 | ||||||
|  |                $CI->load->model('options_model'); | ||||||
|                // call library function to get options value
 |                // call library function to get options value
 | ||||||
|                $options_result = $CI->options_model->item($option_name); |                $options_result = $CI->options_model->item($option_name); | ||||||
|                     |                     | ||||||
|  | @ -59,24 +70,7 @@ class OptionsLib { | ||||||
|            } else { |            } else { | ||||||
|                 return $CI->config->item($option_name); |                 return $CI->config->item($option_name); | ||||||
|            } |            } | ||||||
|         } else { |  | ||||||
| 
 |  | ||||||
|                 return $CI->config->item($option_name); |  | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         if(!$CI->config->item('option_'.$option_name)) { |  | ||||||
|             //Load the options model
 |  | ||||||
|             $CI->load->model('options_model'); |  | ||||||
|              |  | ||||||
|             // call library function to get options value
 |  | ||||||
|             $options_result = $CI->options_model->item($option_name); |  | ||||||
| 
 |  | ||||||
|             // return option_value as a string
 |  | ||||||
|             return $options_result; |  | ||||||
|         } else { |  | ||||||
|             return $CI->config->item($option_name); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Function to save new option to options table
 |     // Function to save new option to options table
 | ||||||
|  |  | ||||||
|  | @ -50,7 +50,7 @@ | ||||||
| 								<?php | 								<?php | ||||||
| 								foreach ($themes as $theme) { | 								foreach ($themes as $theme) { | ||||||
| 									echo '<option value="' . $theme->foldername . '"'; | 									echo '<option value="' . $theme->foldername . '"'; | ||||||
| 									if ($this->optionslib->get_option('theme') == $theme->foldername) { | 									if ($this->optionslib->get_option('option_theme') == $theme->foldername) { | ||||||
| 										echo 'selected="selected"'; | 										echo 'selected="selected"'; | ||||||
| 									} | 									} | ||||||
| 									echo '>' . $theme->name . '</option>'; | 									echo '>' . $theme->name . '</option>'; | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用