Annotation of /mambo/branches/4.6/administrator/components/com_config/admin.config.php
Parent Directory
|
Revision Log
Revision 1 -
(view)
(download)
Original Path: mambo/trunk/administrator/components/com_config/admin.config.php
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @version $Id: admin.config.php,v 1.4 2005/11/25 23:30:20 csouza Exp $ | ||
| 4 : | * @package Mambo | ||
| 5 : | * @subpackage Config | ||
| 6 : | * @copyright (C) 2000 - 2005 Miro International Pty Ltd | ||
| 7 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 8 : | * Mambo is Free Software | ||
| 9 : | */ | ||
| 10 : | |||
| 11 : | /** ensure this file is being included by a parent file */ | ||
| 12 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 13 : | |||
| 14 : | if (!$acl->acl_check( 'administration', 'config', 'users', $my->usertype )) { | ||
| 15 : | mosRedirect( 'index2.php', _NOT_AUTH ); | ||
| 16 : | } | ||
| 17 : | |||
| 18 : | /** | ||
| 19 : | * @package Mambo | ||
| 20 : | * @subpackage Config | ||
| 21 : | */ | ||
| 22 : | class mosConfig extends mosDBTable { | ||
| 23 : | /** @var int */ | ||
| 24 : | var $config_offline=null; | ||
| 25 : | /** @var string */ | ||
| 26 : | var $config_host=null; | ||
| 27 : | /** @var string */ | ||
| 28 : | var $config_user=null; | ||
| 29 : | /** @var string */ | ||
| 30 : | var $config_password=null; | ||
| 31 : | /** @var string */ | ||
| 32 : | var $config_db=null; | ||
| 33 : | /** @var string */ | ||
| 34 : | var $config_dbprefix=null; | ||
| 35 : | /** @var string */ | ||
| 36 : | var $config_lang=null; | ||
| 37 : | /** @var string */ | ||
| 38 : | var $config_path=null; | ||
| 39 : | /** @var string */ | ||
| 40 : | var $config_live_site=null; | ||
| 41 : | /** @var string */ | ||
| 42 : | var $config_sitename=null; | ||
| 43 : | /** @var int */ | ||
| 44 : | var $config_auth=null; | ||
| 45 : | /** @var int */ | ||
| 46 : | var $config_lifetime=null; | ||
| 47 : | /** @var string */ | ||
| 48 : | var $config_offline_message=null; | ||
| 49 : | /** @var string */ | ||
| 50 : | var $config_error_message=null; | ||
| 51 : | /** @var int */ | ||
| 52 : | var $config_useractivation=null; | ||
| 53 : | /** @var int */ | ||
| 54 : | var $config_uniquemail=null; | ||
| 55 : | /** @var string */ | ||
| 56 : | var $config_metadesc=null; | ||
| 57 : | /** @var string */ | ||
| 58 : | var $config_metakeys=null; | ||
| 59 : | /** @var int */ | ||
| 60 : | var $config_metaauthor=null; | ||
| 61 : | /** @var int */ | ||
| 62 : | var $config_metatitle=null; | ||
| 63 : | /** @var int */ | ||
| 64 : | var $config_debug=0; | ||
| 65 : | /** @var string */ | ||
| 66 : | var $config_locale=null; | ||
| 67 : | /** @var int */ | ||
| 68 : | var $config_offset=null; | ||
| 69 : | /** @var int */ | ||
| 70 : | var $config_hideauthor=null; | ||
| 71 : | /** @var int */ | ||
| 72 : | var $config_hidecreate=null; | ||
| 73 : | /** @var int */ | ||
| 74 : | var $config_hidemodify=null; | ||
| 75 : | /** @var int */ | ||
| 76 : | var $config_hidepdf=null; | ||
| 77 : | /** @var int */ | ||
| 78 : | var $config_hideprint=null; | ||
| 79 : | /** @var int */ | ||
| 80 : | var $config_hideemail=null; | ||
| 81 : | /** @var int */ | ||
| 82 : | var $config_enable_log_items=null; | ||
| 83 : | /** @var int */ | ||
| 84 : | var $config_enable_log_searches=null; | ||
| 85 : | /** @var int */ | ||
| 86 : | var $config_enable_stats=null; | ||
| 87 : | /** @var int */ | ||
| 88 : | var $config_sef=0; | ||
| 89 : | /** @var int */ | ||
| 90 : | var $config_vote=0; | ||
| 91 : | /** @var int */ | ||
| 92 : | var $config_gzip=0; | ||
| 93 : | /** @var int */ | ||
| 94 : | var $config_multipage_toc=0; | ||
| 95 : | /** @var int */ | ||
| 96 : | var $config_allowUserRegistration=0; | ||
| 97 : | /** @var int */ | ||
| 98 : | var $config_error_reporting=0; | ||
| 99 : | /** @var int */ | ||
| 100 : | var $config_register_globals=0; | ||
| 101 : | /** @var int */ | ||
| 102 : | var $config_link_titles=0; | ||
| 103 : | /** @var int */ | ||
| 104 : | var $config_list_limit=0; | ||
| 105 : | /** @var int */ | ||
| 106 : | var $config_caching=0; | ||
| 107 : | /** @var string */ | ||
| 108 : | var $config_cachepath=null; | ||
| 109 : | /** @var string */ | ||
| 110 : | var $config_cachetime=null; | ||
| 111 : | /** @var string */ | ||
| 112 : | var $config_mailer=null; | ||
| 113 : | /** @var string */ | ||
| 114 : | var $config_mailfrom=null; | ||
| 115 : | /** @var string */ | ||
| 116 : | var $config_fromname=null; | ||
| 117 : | /** @var string */ | ||
| 118 : | var $config_sendmail='/usr/sbin/sendmail'; | ||
| 119 : | /** @var string */ | ||
| 120 : | var $config_smtpauth=0; | ||
| 121 : | /** @var string */ | ||
| 122 : | var $config_smtpuser=null; | ||
| 123 : | /** @var string */ | ||
| 124 : | var $config_smtppass=null; | ||
| 125 : | /** @var string */ | ||
| 126 : | var $config_smtphost=null; | ||
| 127 : | /** @var string */ | ||
| 128 : | var $_alias=null; | ||
| 129 : | /** @var int */ | ||
| 130 : | var $config_back_button=0; | ||
| 131 : | /** @var int */ | ||
| 132 : | var $config_item_navigation=0; | ||
| 133 : | /** @var int */ | ||
| 134 : | var $config_ml_support=0; | ||
| 135 : | /** @var string */ | ||
| 136 : | var $config_secret=null; | ||
| 137 : | /** @var int */ | ||
| 138 : | var $config_pagetitles=1; | ||
| 139 : | /** @var int */ | ||
| 140 : | var $config_readmore=1; | ||
| 141 : | /** @var int */ | ||
| 142 : | var $config_hits=1; | ||
| 143 : | /** @var int */ | ||
| 144 : | var $config_icons=1; | ||
| 145 : | /** @var string */ | ||
| 146 : | var $config_favicon=null; | ||
| 147 : | /** @var string */ | ||
| 148 : | var $config_fileperms='0644'; | ||
| 149 : | /** @var string */ | ||
| 150 : | var $config_dirperms='0755'; | ||
| 151 : | /** @var string */ | ||
| 152 : | var $config_helpurl=''; | ||
| 153 : | |||
| 154 : | function mosConfig() { | ||
| 155 : | $this->_alias = array( | ||
| 156 : | 'config_offline' =>'mosConfig_offline', | ||
| 157 : | 'config_host' =>'mosConfig_host', | ||
| 158 : | 'config_user' =>'mosConfig_user', | ||
| 159 : | 'config_password' =>'mosConfig_password', | ||
| 160 : | 'config_db' =>'mosConfig_db', | ||
| 161 : | 'config_dbprefix' =>'mosConfig_dbprefix', | ||
| 162 : | 'config_lang' =>'mosConfig_lang', | ||
| 163 : | 'config_path' =>'mosConfig_absolute_path', | ||
| 164 : | 'config_live_site' =>'mosConfig_live_site', | ||
| 165 : | 'config_sitename' =>'mosConfig_sitename', | ||
| 166 : | 'config_auth' =>'mosConfig_shownoauth', | ||
| 167 : | 'config_useractivation' =>'mosConfig_useractivation', | ||
| 168 : | 'config_uniquemail' =>'mosConfig_uniquemail', | ||
| 169 : | 'config_offline_message' =>'mosConfig_offline_message', | ||
| 170 : | 'config_error_message' =>'mosConfig_error_message', | ||
| 171 : | 'config_debug' =>'mosConfig_debug', | ||
| 172 : | 'config_lifetime' =>'mosConfig_lifetime', | ||
| 173 : | 'config_metadesc' =>'mosConfig_MetaDesc', | ||
| 174 : | 'config_metakeys' =>'mosConfig_MetaKeys', | ||
| 175 : | 'config_metaauthor' =>'mosConfig_MetaAuthor', | ||
| 176 : | 'config_metatitle' =>'mosConfig_MetaTitle', | ||
| 177 : | 'config_locale' =>'mosConfig_locale', | ||
| 178 : | 'config_offset' =>'mosConfig_offset', | ||
| 179 : | 'config_hideauthor' =>'mosConfig_hideAuthor', | ||
| 180 : | 'config_hidecreate' =>'mosConfig_hideCreateDate', | ||
| 181 : | 'config_hidemodify' =>'mosConfig_hideModifyDate', | ||
| 182 : | 'config_hidepdf' =>'mosConfig_hidePdf', | ||
| 183 : | 'config_hideprint' =>'mosConfig_hidePrint', | ||
| 184 : | 'config_hideemail' =>'mosConfig_hideEmail', | ||
| 185 : | 'config_enable_log_items' =>'mosConfig_enable_log_items', | ||
| 186 : | 'config_enable_log_searches' =>'mosConfig_enable_log_searches', | ||
| 187 : | 'config_enable_stats' =>'mosConfig_enable_stats', | ||
| 188 : | 'config_sef' =>'mosConfig_sef', | ||
| 189 : | 'config_vote' =>'mosConfig_vote', | ||
| 190 : | 'config_gzip' =>'mosConfig_gzip', | ||
| 191 : | 'config_multipage_toc' =>'mosConfig_multipage_toc', | ||
| 192 : | 'config_allowUserRegistration' =>'mosConfig_allowUserRegistration', | ||
| 193 : | 'config_link_titles' =>'mosConfig_link_titles', | ||
| 194 : | 'config_error_reporting' =>'mosConfig_error_reporting', | ||
| 195 : | 'config_register_globals' =>'mosConfig_register_globals', | ||
| 196 : | 'config_list_limit' =>'mosConfig_list_limit', | ||
| 197 : | 'config_caching' =>'mosConfig_caching', | ||
| 198 : | 'config_cachepath' =>'mosConfig_cachepath', | ||
| 199 : | 'config_cachetime' =>'mosConfig_cachetime', | ||
| 200 : | 'config_mailer' =>'mosConfig_mailer', | ||
| 201 : | 'config_mailfrom' =>'mosConfig_mailfrom', | ||
| 202 : | 'config_fromname' =>'mosConfig_fromname', | ||
| 203 : | 'config_sendmail' =>'mosConfig_sendmail', | ||
| 204 : | 'config_smtpauth' =>'mosConfig_smtpauth', | ||
| 205 : | 'config_smtpuser' =>'mosConfig_smtpuser', | ||
| 206 : | 'config_smtppass' =>'mosConfig_smtppass', | ||
| 207 : | 'config_smtphost' =>'mosConfig_smtphost', | ||
| 208 : | 'config_back_button' =>'mosConfig_back_button', | ||
| 209 : | 'config_item_navigation' =>'mosConfig_item_navigation', | ||
| 210 : | 'config_secret' =>'mosConfig_secret', | ||
| 211 : | 'config_pagetitles' =>'mosConfig_pagetitles', | ||
| 212 : | 'config_readmore' =>'mosConfig_readmore', | ||
| 213 : | 'config_hits' =>'mosConfig_hits', | ||
| 214 : | 'config_icons' =>'mosConfig_icons', | ||
| 215 : | 'config_favicon' =>'mosConfig_favicon', | ||
| 216 : | 'config_fileperms' =>'mosConfig_fileperms', | ||
| 217 : | 'config_dirperms' =>'mosConfig_dirperms', | ||
| 218 : | 'config_ml_support' =>'mosConfig_mbf_content', | ||
| 219 : | 'config_helpurl' =>'mosConfig_helpurl' | ||
| 220 : | ); | ||
| 221 : | } | ||
| 222 : | |||
| 223 : | function getVarText() { | ||
| 224 : | $txt = ''; | ||
| 225 : | foreach ($this->_alias as $k=>$v) { | ||
| 226 : | $txt .= "\$$v = '".addslashes( $this->$k )."';\n"; | ||
| 227 : | } | ||
| 228 : | return $txt; | ||
| 229 : | } | ||
| 230 : | |||
| 231 : | function bindGlobals() { | ||
| 232 : | foreach ($this->_alias as $k=>$v) { | ||
| 233 : | if(isset($GLOBALS[$v])) | ||
| 234 : | $this->$k = $GLOBALS[$v]; | ||
| 235 : | } | ||
| 236 : | } | ||
| 237 : | } | ||
| 238 : | |||
| 239 : | require_once( str_replace('\\','/',dirname(__FILE__)) . '/admin.config.html.php' ); | ||
| 240 : | $confightml = new HTML_config(); | ||
| 241 : | |||
| 242 : | |||
| 243 : | switch ( $task ) { | ||
| 244 : | case 'apply': | ||
| 245 : | case 'save': | ||
| 246 : | saveconfig( $task ); | ||
| 247 : | break; | ||
| 248 : | |||
| 249 : | case 'cancel': | ||
| 250 : | mosRedirect( 'index2.php' ); | ||
| 251 : | break; | ||
| 252 : | |||
| 253 : | default: | ||
| 254 : | showconfig($confightml, $database, $option); | ||
| 255 : | break; | ||
| 256 : | } | ||
| 257 : | |||
| 258 : | |||
| 259 : | function showconfig($confightml, &$database, $option) { | ||
| 260 : | global $database, $mosConfig_absolute_path; | ||
| 261 : | $row = new mosConfig(); | ||
| 262 : | $row->bindGlobals(); | ||
| 263 : | |||
| 264 : | // compile list of the languages | ||
| 265 : | $langs = array(); | ||
| 266 : | $menuitems = array(); | ||
| 267 : | |||
| 268 : | if ($handle=opendir( "$mosConfig_absolute_path/language/" )) { | ||
| 269 : | $i=0; | ||
| 270 : | while (false !== ($file = readdir($handle))) { | ||
| 271 : | if (!strcasecmp(substr($file,-4),".php") && $file <> "." && $file <> ".." && strcasecmp(substr($file,-11),".ignore.php")) { | ||
| 272 : | $langs[] = mosHTML::makeOption( substr($file,0,-4) ); | ||
| 273 : | } | ||
| 274 : | } | ||
| 275 : | } | ||
| 276 : | |||
| 277 : | // sort list of languages | ||
| 278 : | sort($langs); | ||
| 279 : | reset($langs); | ||
| 280 : | |||
| 281 : | // compile list of the editors | ||
| 282 : | $query = "SELECT id AS value, name AS text" | ||
| 283 : | . "\n FROM #__mambots" | ||
| 284 : | . "\n WHERE folder='editors' AND published >= 0" | ||
| 285 : | . "\n ORDER BY ordering, name" | ||
| 286 : | ; | ||
| 287 : | $database->setQuery( $query ); | ||
| 288 : | $edits = $database->loadObjectList(); | ||
| 289 : | |||
| 290 : | $query = "SELECT id" | ||
| 291 : | . "\n FROM #__mambots" | ||
| 292 : | . "\n WHERE folder='editors' AND published = 1" | ||
| 293 : | . "\n LIMIT 1" | ||
| 294 : | ; | ||
| 295 : | $database->setQuery( $query ); | ||
| 296 : | $editor = $database->loadResult(); | ||
| 297 : | |||
| 298 : | $lists = array(); | ||
| 299 : | // build the html select list | ||
| 300 : | $lists['editor'] = mosHTML::selectList( $edits, 'editor', 'class="inputbox" size="1"', 'value', 'text', $editor ); | ||
| 301 : | |||
| 302 : | // build the html select list | ||
| 303 : | $lists['lang'] = mosHTML::selectList( $langs, 'config_lang', 'class="inputbox" size="1"', 'value', 'text', $row->config_lang ); | ||
| 304 : | // make a generic -24 - 24 list | ||
| 305 : | for ($i=-24;$i<=24;$i++) { | ||
| 306 : | $timeoffset[] = mosHTML::makeOption( $i, $i ); | ||
| 307 : | } | ||
| 308 : | |||
| 309 : | // get list of menuitems | ||
| 310 : | $query = "SELECT id AS value, name AS text FROM #__menu" | ||
| 311 : | . "\n WHERE (type='content_section' OR type='components' OR type='content_typed')" | ||
| 312 : | . "\n AND published=1" | ||
| 313 : | . "\n AND access=0" | ||
| 314 : | . "\n ORDER BY name" | ||
| 315 : | ; | ||
| 316 : | $database->setQuery( $query ); | ||
| 317 : | $menuitems = array_merge( $menuitems, $database->loadObjectList() ); | ||
| 318 : | |||
| 319 : | $show_hide = array( | ||
| 320 : | mosHTML::makeOption( 1, 'Hide' ), | ||
| 321 : | mosHTML::makeOption( 0, 'Show' ), | ||
| 322 : | ); | ||
| 323 : | |||
| 324 : | $show_hide_r = array( | ||
| 325 : | mosHTML::makeOption( 0, 'Hide' ), | ||
| 326 : | mosHTML::makeOption( 1, 'Show' ), | ||
| 327 : | ); | ||
| 328 : | |||
| 329 : | $list_length = array( | ||
| 330 : | mosHTML::makeOption( 5, 5 ), | ||
| 331 : | mosHTML::makeOption( 10, 10 ), | ||
| 332 : | mosHTML::makeOption( 15, 15 ), | ||
| 333 : | mosHTML::makeOption( 20, 20 ), | ||
| 334 : | mosHTML::makeOption( 25, 25 ), | ||
| 335 : | mosHTML::makeOption( 30, 30 ), | ||
| 336 : | mosHTML::makeOption( 50, 50 ), | ||
| 337 : | ); | ||
| 338 : | |||
| 339 : | $errors = array( | ||
| 340 : | mosHTML::makeOption( -1, 'System Default' ), | ||
| 341 : | mosHTML::makeOption( 0, 'None' ), | ||
| 342 : | mosHTML::makeOption( E_ERROR|E_WARNING|E_PARSE, 'Simple' ), | ||
| 343 : | mosHTML::makeOption( E_ALL , 'Maximum' ) | ||
| 344 : | ); | ||
| 345 : | |||
| 346 : | $register_globals = array( | ||
| 347 : | mosHTML::makeOption( 1, 'On' ), | ||
| 348 : | mosHTML::makeOption( 0, 'Off' ), | ||
| 349 : | ); | ||
| 350 : | |||
| 351 : | $mailer = array( | ||
| 352 : | mosHTML::makeOption( 'mail', 'PHP mail function', true ), | ||
| 353 : | mosHTML::makeOption( 'sendmail', 'Sendmail', true ), | ||
| 354 : | mosHTML::makeOption( 'smtp', 'SMTP Server', true ) | ||
| 355 : | ); | ||
| 356 : | |||
| 357 : | // build the html select lists | ||
| 358 : | $lists['offline'] = mosHTML::yesnoRadioList( 'config_offline', 'class="inputbox"', $row->config_offline ); | ||
| 359 : | |||
| 360 : | $lists['auth'] = mosHTML::yesnoRadioList( 'config_auth', 'class="inputbox"', $row->config_auth ); | ||
| 361 : | |||
| 362 : | $lists['metaauthor'] = mosHTML::yesnoRadioList( 'config_metaauthor', 'class="inputbox"', $row->config_metaauthor ); | ||
| 363 : | |||
| 364 : | $lists['metatitle'] = mosHTML::yesnoRadioList( 'config_metatitle', 'class="inputbox"', $row->config_metatitle ); | ||
| 365 : | |||
| 366 : | $lists['useractivation'] = mosHTML::yesnoRadioList( 'config_useractivation', 'class="inputbox"', $row->config_useractivation ); | ||
| 367 : | |||
| 368 : | $lists['uniquemail'] = mosHTML::yesnoRadioList( 'config_uniquemail', 'class="inputbox"', $row->config_uniquemail ); | ||
| 369 : | |||
| 370 : | $lists['allowuserregistration'] = mosHTML::yesnoRadioList( 'config_allowUserRegistration', 'class="inputbox"', $row->config_allowUserRegistration ); | ||
| 371 : | |||
| 372 : | $lists['debug'] = mosHTML::yesnoRadioList( 'config_debug', 'class="inputbox"', $row->config_debug ); | ||
| 373 : | |||
| 374 : | $lists['offset'] = mosHTML::selectList( $timeoffset, 'config_offset', 'class="inputbox" size="1"', 'value', 'text', $row->config_offset ); | ||
| 375 : | |||
| 376 : | $lists['hideauthor'] = mosHTML::RadioList( $show_hide, 'config_hideauthor', 'class="inputbox"', $row->config_hideauthor, 'value', 'text' ); | ||
| 377 : | |||
| 378 : | $lists['hidecreate'] = mosHTML::RadioList( $show_hide, 'config_hidecreate', 'class="inputbox"', $row->config_hidecreate, 'value', 'text' ); | ||
| 379 : | |||
| 380 : | $lists['hidemodify'] = mosHTML::RadioList( $show_hide, 'config_hidemodify', 'class="inputbox"', $row->config_hidemodify, 'value', 'text' ); | ||
| 381 : | |||
| 382 : | if (is_writable( "$mosConfig_absolute_path/media/" )) { | ||
| 383 : | $lists['hidepdf'] = mosHTML::RadioList( $show_hide, 'config_hidepdf', 'class="inputbox"', $row->config_hidepdf, 'value', 'text' ); | ||
| 384 : | } else { | ||
| 385 : | $lists['hidepdf'] = '<input type="hidden" name="config_hidepdf" value="1" /><strong>Yes</strong>'; | ||
| 386 : | } | ||
| 387 : | |||
| 388 : | $lists['hideprint'] = mosHTML::RadioList( $show_hide, 'config_hideprint', 'class="inputbox"', $row->config_hideprint, 'value', 'text' ); | ||
| 389 : | |||
| 390 : | $lists['hideemail'] = mosHTML::RadioList( $show_hide, 'config_hideemail', 'class="inputbox"', $row->config_hideemail, 'value', 'text' ); | ||
| 391 : | |||
| 392 : | $lists['log_items'] = mosHTML::yesnoRadioList( 'config_enable_log_items', 'class="inputbox"', $row->config_enable_log_items ); | ||
| 393 : | |||
| 394 : | $lists['log_searches'] = mosHTML::yesnoRadioList( 'config_enable_log_searches', 'class="inputbox"', $row->config_enable_log_searches ); | ||
| 395 : | |||
| 396 : | $lists['enable_stats'] = mosHTML::yesnoRadioList( 'config_enable_stats', 'class="inputbox"', $row->config_enable_stats ); | ||
| 397 : | |||
| 398 : | $lists['sef'] = mosHTML::yesnoRadioList( 'config_sef', 'class="inputbox" onclick="javascript: if (document.adminForm.config_sef[1].checked) { alert(\'Remember to rename htaccess.txt to .htaccess\') }"', $row->config_sef ); | ||
| 399 : | |||
| 400 : | $lists['vote'] = mosHTML::RadioList( $show_hide_r, 'config_vote', 'class="inputbox"', $row->config_vote, 'value', 'text' ); | ||
| 401 : | |||
| 402 : | $lists['gzip'] = mosHTML::yesnoRadioList( 'config_gzip', 'class="inputbox"', $row->config_gzip ); | ||
| 403 : | |||
| 404 : | $lists['multipage_toc'] = mosHTML::RadioList( $show_hide_r, 'config_multipage_toc', 'class="inputbox"', $row->config_multipage_toc, 'value', 'text' ); | ||
| 405 : | |||
| 406 : | $lists['pagetitles'] = mosHTML::yesnoRadioList( 'config_pagetitles', 'class="inputbox"', $row->config_pagetitles ); | ||
| 407 : | |||
| 408 : | $lists['error_reporting'] = mosHTML::selectList( $errors, 'config_error_reporting', 'class="inputbox" size="1"', 'value', 'text', $row->config_error_reporting ); | ||
| 409 : | |||
| 410 : | $lists['register_globals'] = mosHTML::RadioList( $register_globals, 'config_register_globals', 'class="inputbox" size="1"', $row->config_register_globals, 'value', 'text' ); | ||
| 411 : | |||
| 412 : | $lists['link_titles'] = mosHTML::yesnoRadioList( 'config_link_titles', 'class="inputbox"', $row->config_link_titles ); | ||
| 413 : | |||
| 414 : | $lists['caching'] = mosHTML::yesnoRadioList( 'config_caching', 'class="inputbox"', $row->config_caching ); | ||
| 415 : | |||
| 416 : | $lists['mailer'] = mosHTML::selectList( $mailer, 'config_mailer', 'class="inputbox" size="1"', 'value', 'text', $row->config_mailer ); | ||
| 417 : | |||
| 418 : | $lists['smtpauth'] = mosHTML::yesnoRadioList( 'config_smtpauth', 'class="inputbox"', $row->config_smtpauth ); | ||
| 419 : | |||
| 420 : | $lists['list_length'] = mosHTML::selectList( $list_length, 'config_list_limit', 'class="inputbox" size="1"', 'value', 'text', ( $row->config_list_limit ? $row->config_list_limit : 50 ) ); | ||
| 421 : | |||
| 422 : | $lists['back_button'] = mosHTML::RadioList( $show_hide_r, 'config_back_button', 'class="inputbox"', $row->config_back_button, 'value', 'text' ); | ||
| 423 : | |||
| 424 : | $lists['item_navigation'] = mosHTML::RadioList( $show_hide_r, 'config_item_navigation', 'class="inputbox"', $row->config_item_navigation, 'value', 'text' ); | ||
| 425 : | |||
| 426 : | $lists['ml_support'] = mosHTML::yesnoRadioList( 'config_ml_support', 'class="inputbox" onclick="javascript: if (document.adminForm.config_ml_support[1].checked) { alert(\'Remember to install the MambelFish component.\') }"', $row->config_ml_support ); | ||
| 427 : | |||
| 428 : | $lists['readmore'] = mosHTML::RadioList( $show_hide_r, 'config_readmore', 'class="inputbox"', $row->config_readmore, 'value', 'text' ); | ||
| 429 : | |||
| 430 : | $lists['hits'] = mosHTML::RadioList( $show_hide_r, 'config_hits', 'class="inputbox"', $row->config_hits, 'value', 'text' ); | ||
| 431 : | |||
| 432 : | $lists['icons'] = mosHTML::RadioList( $show_hide_r, 'config_icons', 'class="inputbox"', $row->config_icons, 'value', 'text' ); | ||
| 433 : | |||
| 434 : | // $lists['favicon'] = mosHTML::RadioList( $show_hide_r, 'config_icons', 'class="inputbox"', $row->config_icons, 'value', 'text' ); | ||
| 435 : | |||
| 436 : | $confightml->showconfig( $row, $lists, $option ); | ||
| 437 : | } | ||
| 438 : | |||
| 439 : | function saveconfig( $task ) { | ||
| 440 : | global $database, $mosConfig_absolute_path; | ||
| 441 : | |||
| 442 : | $row = new mosConfig(); | ||
| 443 : | if (!$row->bind( $_POST )) { | ||
| 444 : | mosRedirect( "index2.php", $row->getError() ); | ||
| 445 : | } | ||
| 446 : | |||
| 447 : | $editor = intval( mosGetParam( $_POST, 'editor', 0 ) ); | ||
| 448 : | if ($editor > 0) { | ||
| 449 : | $query = "UPDATE #__mambots" | ||
| 450 : | . "\n SET published = 0" | ||
| 451 : | . "\n WHERE published >= 0 AND folder='editors'" | ||
| 452 : | ; | ||
| 453 : | $database->setQuery( $query ); | ||
| 454 : | $database->query() or die( $database->getErrorMsg() ); | ||
| 455 : | |||
| 456 : | $query = "UPDATE #__mambots" | ||
| 457 : | . "\n SET published = 1" | ||
| 458 : | . "\n WHERE id = $editor" | ||
| 459 : | ; | ||
| 460 : | $database->setQuery( $query ); | ||
| 461 : | $database->query() or die( $database->getErrorMsg() ); | ||
| 462 : | } | ||
| 463 : | |||
| 464 : | $config = "<?php \n"; | ||
| 465 : | $config .= $row->getVarText(); | ||
| 466 : | $config .= "setlocale (LC_TIME, \$mosConfig_locale);\n"; | ||
| 467 : | $config .= '?>'; | ||
| 468 : | |||
| 469 : | $fname = '../configuration.php'; | ||
| 470 : | $enable_write = mosGetParam($_POST,'enable_write',0); | ||
| 471 : | $oldperms = fileperms($fname); | ||
| 472 : | if ($enable_write) @chmod($fname, $oldperms | 0222); | ||
| 473 : | if ( $fp = fopen($fname, 'w') ) { | ||
| 474 : | fputs($fp, $config, strlen($config)); | ||
| 475 : | fclose($fp); | ||
| 476 : | if ($enable_write) { | ||
| 477 : | @chmod($fname, $oldperms); | ||
| 478 : | } else { | ||
| 479 : | if (mosGetParam($_POST,'disable_write',0)) | ||
| 480 : | @chmod($fname, $oldperms & 0777555); | ||
| 481 : | } // if | ||
| 482 : | |||
| 483 : | $msg = 'The Configuration Details have been updated'; | ||
| 484 : | |||
| 485 : | // apply file and directory permissions if requested by user | ||
| 486 : | $applyFilePerms = mosGetParam($_POST,'applyFilePerms',0) && $row->config_fileperms!=''; | ||
| 487 : | $applyDirPerms = mosGetParam($_POST,'applyDirPerms',0) && $row->config_dirperms!=''; | ||
| 488 : | if ($applyFilePerms || $applyDirPerms) { | ||
| 489 : | $mosrootfiles = array( | ||
| 490 : | 'administrator', | ||
| 491 : | 'cache', | ||
| 492 : | 'components', | ||
| 493 : | 'editor', | ||
| 494 : | 'help', | ||
| 495 : | 'images', | ||
| 496 : | 'includes', | ||
| 497 : | 'installation', | ||
| 498 : | 'language', | ||
| 499 : | 'mambots', | ||
| 500 : | 'media', | ||
| 501 : | 'modules', | ||
| 502 : | 'templates', | ||
| 503 : | 'CHANGELOG', | ||
| 504 : | 'configuration.php-dist', | ||
| 505 : | 'configuration.php', | ||
| 506 : | 'globals.php', | ||
| 507 : | 'htaccess.txt', | ||
| 508 : | 'index.php', | ||
| 509 : | 'index2.php', | ||
| 510 : | 'INSTALL', | ||
| 511 : | 'LICENSE', | ||
| 512 : | 'mainbody.php', | ||
| 513 : | 'offline.php', | ||
| 514 : | 'pathway.php', | ||
| 515 : | 'robots.txt' | ||
| 516 : | ); | ||
| 517 : | $filemode = NULL; | ||
| 518 : | if ($applyFilePerms) $filemode = octdec($row->config_fileperms); | ||
| 519 : | $dirmode = NULL; | ||
| 520 : | if ($applyDirPerms) $dirmode = octdec($row->config_dirperms); | ||
| 521 : | foreach ($mosrootfiles as $file) | ||
| 522 : | mosChmodRecursive($mosConfig_absolute_path.'/'.$file, $filemode, $dirmode); | ||
| 523 : | } // if | ||
| 524 : | |||
| 525 : | switch ( $task ) { | ||
| 526 : | case 'apply': | ||
| 527 : | mosRedirect( 'index2.php?option=com_config&hidemainmenu=1', $msg ); | ||
| 528 : | break; | ||
| 529 : | |||
| 530 : | case 'save': | ||
| 531 : | default: | ||
| 532 : | mosRedirect( 'index2.php', $msg ); | ||
| 533 : | break; | ||
| 534 : | } | ||
| 535 : | } else { | ||
| 536 : | if ($enable_write) @chmod($fname, $oldperms); | ||
| 537 : | mosRedirect( 'index2.php', 'An Error Has Occurred! Unable to open config file to write!' ); | ||
| 538 : | } | ||
| 539 : | } | ||
| 540 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

