splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * additional setting classes specific to these settings |
||
| 4 | * |
||
| 5 | * @author Chris Smith <[email protected]> |
||
| 6 | */ |
||
| 7 | |||
| 8 | if (!class_exists('setting_sepchar')) { |
||
| 9 | /** |
||
| 10 | * Class setting_sepchar |
||
| 11 | */ |
||
| 12 | class setting_sepchar extends setting_multichoice { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @param string $key |
||
| 16 | * @param array|null $param array with metadata of setting |
||
| 17 | */ |
||
| 18 | function __construct($key,$param=null) { |
||
| 19 | $str = '_-.'; |
||
| 20 | for ($i=0;$i<strlen($str);$i++) $this->_choices[] = $str{$i}; |
||
|
0 ignored issues
–
show
|
|||
| 21 | |||
| 22 | // call foundation class constructor |
||
| 23 | parent::__construct($key,$param); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | if (!class_exists('setting_savedir')) { |
||
| 29 | /** |
||
| 30 | * Class setting_savedir |
||
| 31 | */ |
||
| 32 | class setting_savedir extends setting_string { |
||
| 33 | |||
| 34 | /** |
||
| 35 | * update changed setting with user provided value $input |
||
| 36 | * - if changed value fails error check, save it to $this->_input (to allow echoing later) |
||
| 37 | * - if changed value passes error check, set $this->_local to the new value |
||
| 38 | * |
||
| 39 | * @param mixed $input the new value |
||
| 40 | * @return boolean true if changed, false otherwise (also on error) |
||
| 41 | */ |
||
| 42 | function update($input) { |
||
| 43 | if ($this->is_protected()) return false; |
||
| 44 | |||
| 45 | $value = is_null($this->_local) ? $this->_default : $this->_local; |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_default cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 46 | if ($value == $input) return false; |
||
| 47 | |||
| 48 | if (!init_path($input)) { |
||
| 49 | $this->_error = true; |
||
|
0 ignored issues
–
show
The property
_error cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 50 | $this->_input = $input; |
||
|
0 ignored issues
–
show
The property
_input cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 51 | return false; |
||
| 52 | } |
||
| 53 | |||
| 54 | $this->_local = $input; |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 55 | return true; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | if (!class_exists('setting_authtype')) { |
||
| 61 | /** |
||
| 62 | * Class setting_authtype |
||
| 63 | */ |
||
| 64 | class setting_authtype extends setting_multichoice { |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Receives current values for the setting $key |
||
| 68 | * |
||
| 69 | * @param mixed $default default setting value |
||
| 70 | * @param mixed $local local setting value |
||
| 71 | * @param mixed $protected protected setting value |
||
| 72 | */ |
||
| 73 | function initialize($default,$local,$protected) { |
||
| 74 | /** @var $plugin_controller Doku_Plugin_Controller */ |
||
| 75 | global $plugin_controller; |
||
| 76 | |||
| 77 | // retrieve auth types provided by plugins |
||
| 78 | foreach ($plugin_controller->getList('auth') as $plugin) { |
||
| 79 | $this->_choices[] = $plugin; |
||
|
0 ignored issues
–
show
The property
_choices cannot be accessed from this context as it is declared private in class setting_multichoice.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 80 | } |
||
| 81 | |||
| 82 | parent::initialize($default,$local,$protected); |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * update changed setting with user provided value $input |
||
| 87 | * - if changed value fails error check, save it to $this->_input (to allow echoing later) |
||
| 88 | * - if changed value passes error check, set $this->_local to the new value |
||
| 89 | * |
||
| 90 | * @param mixed $input the new value |
||
| 91 | * @return boolean true if changed, false otherwise (also on error) |
||
| 92 | */ |
||
| 93 | function update($input) { |
||
| 94 | /** @var $plugin_controller Doku_Plugin_Controller */ |
||
| 95 | global $plugin_controller; |
||
| 96 | |||
| 97 | // is an update possible/requested? |
||
| 98 | $local = $this->_local; // save this, parent::update() may change it |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 99 | if (!parent::update($input)) return false; // nothing changed or an error caught by parent |
||
| 100 | $this->_local = $local; // restore original, more error checking to come |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 101 | |||
| 102 | // attempt to load the plugin |
||
| 103 | $auth_plugin = $plugin_controller->load('auth', $input); |
||
| 104 | |||
| 105 | // @TODO: throw an error in plugin controller instead of returning null |
||
| 106 | if (is_null($auth_plugin)) { |
||
| 107 | $this->_error = true; |
||
|
0 ignored issues
–
show
The property
_error cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 108 | msg('Cannot load Auth Plugin "' . $input . '"', -1); |
||
| 109 | return false; |
||
| 110 | } |
||
| 111 | |||
| 112 | // verify proper instantiation (is this really a plugin?) @TODO use instanceof? implement interface? |
||
| 113 | if (is_object($auth_plugin) && !method_exists($auth_plugin, 'getPluginName')) { |
||
| 114 | $this->_error = true; |
||
|
0 ignored issues
–
show
The property
_error cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 115 | msg('Cannot create Auth Plugin "' . $input . '"', -1); |
||
| 116 | return false; |
||
| 117 | } |
||
| 118 | |||
| 119 | // did we change the auth type? logout |
||
| 120 | global $conf; |
||
| 121 | if($conf['authtype'] != $input) { |
||
| 122 | msg('Authentication system changed. Please re-login.'); |
||
| 123 | auth_logoff(); |
||
| 124 | } |
||
| 125 | |||
| 126 | $this->_local = $input; |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 127 | return true; |
||
| 128 | } |
||
| 129 | } |
||
| 130 | } |
||
| 131 | |||
| 132 | if (!class_exists('setting_im_convert')) { |
||
| 133 | /** |
||
| 134 | * Class setting_im_convert |
||
| 135 | */ |
||
| 136 | class setting_im_convert extends setting_string { |
||
| 137 | |||
| 138 | /** |
||
| 139 | * update changed setting with user provided value $input |
||
| 140 | * - if changed value fails error check, save it to $this->_input (to allow echoing later) |
||
| 141 | * - if changed value passes error check, set $this->_local to the new value |
||
| 142 | * |
||
| 143 | * @param mixed $input the new value |
||
| 144 | * @return boolean true if changed, false otherwise (also on error) |
||
| 145 | */ |
||
| 146 | function update($input) { |
||
| 147 | if ($this->is_protected()) return false; |
||
| 148 | |||
| 149 | $input = trim($input); |
||
| 150 | |||
| 151 | $value = is_null($this->_local) ? $this->_default : $this->_local; |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_default cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 152 | if ($value == $input) return false; |
||
| 153 | |||
| 154 | if ($input && !file_exists($input)) { |
||
| 155 | $this->_error = true; |
||
|
0 ignored issues
–
show
The property
_error cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 156 | $this->_input = $input; |
||
|
0 ignored issues
–
show
The property
_input cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 157 | return false; |
||
| 158 | } |
||
| 159 | |||
| 160 | $this->_local = $input; |
||
|
0 ignored issues
–
show
The property
_local cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 161 | return true; |
||
| 162 | } |
||
| 163 | } |
||
| 164 | } |
||
| 165 | |||
| 166 | if (!class_exists('setting_disableactions')) { |
||
| 167 | /** |
||
| 168 | * Class setting_disableactions |
||
| 169 | */ |
||
| 170 | class setting_disableactions extends setting_multicheckbox { |
||
| 171 | |||
| 172 | /** |
||
| 173 | * Build html for label and input of setting |
||
| 174 | * |
||
| 175 | * @param DokuWiki_Plugin $plugin object of config plugin |
||
| 176 | * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting |
||
| 177 | * @return array with content array(string $label_html, string $input_html) |
||
| 178 | */ |
||
| 179 | function html(&$plugin, $echo=false) { |
||
| 180 | global $lang; |
||
| 181 | |||
| 182 | // make some language adjustments (there must be a better way) |
||
| 183 | // transfer some DokuWiki language strings to the plugin |
||
| 184 | if (!$plugin->localised) $plugin->setupLocale(); |
||
|
0 ignored issues
–
show
The property
localised cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 185 | $plugin->lang[$this->_key.'_revisions'] = $lang['btn_revs']; |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 186 | |||
| 187 | foreach ($this->_choices as $choice) |
||
|
0 ignored issues
–
show
The property
_choices cannot be accessed from this context as it is declared private in class setting_multicheckbox.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 188 | if (isset($lang['btn_'.$choice])) $plugin->lang[$this->_key.'_'.$choice] = $lang['btn_'.$choice]; |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 189 | |||
| 190 | return parent::html($plugin, $echo); |
||
| 191 | } |
||
| 192 | } |
||
| 193 | } |
||
| 194 | |||
| 195 | if (!class_exists('setting_compression')) { |
||
| 196 | /** |
||
| 197 | * Class setting_compression |
||
| 198 | */ |
||
| 199 | class setting_compression extends setting_multichoice { |
||
| 200 | |||
| 201 | var $_choices = array('0'); // 0 = no compression, always supported |
||
| 202 | |||
| 203 | /** |
||
| 204 | * Receives current values for the setting $key |
||
| 205 | * |
||
| 206 | * @param mixed $default default setting value |
||
| 207 | * @param mixed $local local setting value |
||
| 208 | * @param mixed $protected protected setting value |
||
| 209 | */ |
||
| 210 | function initialize($default,$local,$protected) { |
||
| 211 | |||
| 212 | // populate _choices with the compression methods supported by this php installation |
||
| 213 | if (function_exists('gzopen')) $this->_choices[] = 'gz'; |
||
| 214 | if (function_exists('bzopen')) $this->_choices[] = 'bz2'; |
||
| 215 | |||
| 216 | parent::initialize($default,$local,$protected); |
||
| 217 | } |
||
| 218 | } |
||
| 219 | } |
||
| 220 | |||
| 221 | if (!class_exists('setting_license')) { |
||
| 222 | /** |
||
| 223 | * Class setting_license |
||
| 224 | */ |
||
| 225 | class setting_license extends setting_multichoice { |
||
| 226 | |||
| 227 | var $_choices = array(''); // none choosen |
||
| 228 | |||
| 229 | /** |
||
| 230 | * Receives current values for the setting $key |
||
| 231 | * |
||
| 232 | * @param mixed $default default setting value |
||
| 233 | * @param mixed $local local setting value |
||
| 234 | * @param mixed $protected protected setting value |
||
| 235 | */ |
||
| 236 | function initialize($default,$local,$protected) { |
||
| 237 | global $license; |
||
| 238 | |||
| 239 | foreach($license as $key => $data){ |
||
| 240 | $this->_choices[] = $key; |
||
| 241 | $this->lang[$this->_key.'_o_'.$key] = $data['name']; // stored in setting |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class setting_multichoice.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 242 | } |
||
| 243 | |||
| 244 | parent::initialize($default,$local,$protected); |
||
| 245 | } |
||
| 246 | } |
||
| 247 | } |
||
| 248 | |||
| 249 | |||
| 250 | if (!class_exists('setting_renderer')) { |
||
| 251 | /** |
||
| 252 | * Class setting_renderer |
||
| 253 | */ |
||
| 254 | class setting_renderer extends setting_multichoice { |
||
| 255 | var $_prompts = array(); |
||
| 256 | var $_format = null; |
||
| 257 | |||
| 258 | /** |
||
| 259 | * Receives current values for the setting $key |
||
| 260 | * |
||
| 261 | * @param mixed $default default setting value |
||
| 262 | * @param mixed $local local setting value |
||
| 263 | * @param mixed $protected protected setting value |
||
| 264 | */ |
||
| 265 | function initialize($default,$local,$protected) { |
||
| 266 | $format = $this->_format; |
||
| 267 | |||
| 268 | foreach (plugin_list('renderer') as $plugin) { |
||
| 269 | $renderer = plugin_load('renderer',$plugin); |
||
| 270 | if (method_exists($renderer,'canRender') && $renderer->canRender($format)) { |
||
| 271 | $this->_choices[] = $plugin; |
||
|
0 ignored issues
–
show
The property
_choices cannot be accessed from this context as it is declared private in class setting_multichoice.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 272 | |||
| 273 | $info = $renderer->getInfo(); |
||
| 274 | $this->_prompts[$plugin] = $info['name']; |
||
| 275 | } |
||
| 276 | } |
||
| 277 | |||
| 278 | parent::initialize($default,$local,$protected); |
||
| 279 | } |
||
| 280 | |||
| 281 | /** |
||
| 282 | * Build html for label and input of setting |
||
| 283 | * |
||
| 284 | * @param DokuWiki_Plugin $plugin object of config plugin |
||
| 285 | * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting |
||
| 286 | * @return array with content array(string $label_html, string $input_html) |
||
| 287 | */ |
||
| 288 | function html(&$plugin, $echo=false) { |
||
| 289 | |||
| 290 | // make some language adjustments (there must be a better way) |
||
| 291 | // transfer some plugin names to the config plugin |
||
| 292 | if (!$plugin->localised) $plugin->setupLocale(); |
||
|
0 ignored issues
–
show
The property
localised cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 293 | |||
| 294 | foreach ($this->_choices as $choice) { |
||
|
0 ignored issues
–
show
The property
_choices cannot be accessed from this context as it is declared private in class setting_multichoice.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 295 | if (!isset($plugin->lang[$this->_key.'_o_'.$choice])) { |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 296 | if (!isset($this->_prompts[$choice])) { |
||
| 297 | $plugin->lang[$this->_key.'_o_'.$choice] = sprintf($plugin->lang['renderer__core'],$choice); |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 298 | } else { |
||
| 299 | $plugin->lang[$this->_key.'_o_'.$choice] = sprintf($plugin->lang['renderer__plugin'],$this->_prompts[$choice]); |
||
|
0 ignored issues
–
show
The property
lang cannot be accessed from this context as it is declared private in class DokuWiki_Plugin.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
The property
_key cannot be accessed from this context as it is declared private in class setting.
This check looks for access to properties that are not accessible from the current context. If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class. Loading history...
|
|||
| 300 | } |
||
| 301 | } |
||
| 302 | } |
||
| 303 | return parent::html($plugin, $echo); |
||
| 304 | } |
||
| 305 | } |
||
| 306 | } |
||
| 307 |
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.