/** * @return boolean * @desc Save the newly entered configuration data into the files zoom_config.php and safemode.php * @access public */ function saveConfig() { global $database, $acl, $mosConfig_absolute_path; $s01 = $this->stripslashesSafe($this->escapeString($_REQUEST['s01'])); $s02 = $this->stripslashesSafe($this->escapeString($_REQUEST['s02'])); $s03 = $this->stripslashesSafe($this->escapeString($_REQUEST['s03'])); $s04 = $this->stripslashesSafe($this->escapeString($_REQUEST['s04'])); $s05 = $this->stripslashesSafe($this->escapeString($_REQUEST['s05'])); $s06 = $this->stripslashesSafe($this->escapeString($_REQUEST['s06'])); $s07 = $this->stripslashesSafe($this->escapeString($_REQUEST['s07'])); $s08 = $this->stripslashesSafe($this->escapeString($_REQUEST['s08'])); $s09 = $this->stripslashesSafe($this->escapeString($_REQUEST['s09'])); $s10 = $this->stripslashesSafe($this->escapeString($_REQUEST['s10'])); $s11 = $this->stripslashesSafe($this->escapeString($_REQUEST['s11'])); $s12 = $this->stripslashesSafe($this->escapeString($_REQUEST['s12'])); $s13 = $this->stripslashesSafe($this->escapeString($_REQUEST['s13'])); $s14 = $this->stripslashesSafe($this->escapeString($_REQUEST['s14'])); //s15 has been deprecated: 'allow user upload' $s16 = $this->stripslashesSafe($this->escapeString($_REQUEST['s16'])); $s17 = $this->stripslashesSafe($this->escapeString($_REQUEST['s17'])); // s18 is the CSS textarea...thus skipped. $s19 = $this->stripslashesSafe($this->escapeString($_REQUEST['s19'])); $s20 = $this->stripslashesSafe($this->escapeString($_REQUEST['s20'])); $s21 = isset($_REQUEST['s21']) ? 1 : 0; $s22 = $this->stripslashesSafe($this->escapeString($_REQUEST['s22'])); $s23 = $this->stripslashesSafe($this->escapeString($_REQUEST['s23'])); $s24 = $this->stripslashesSafe($this->escapeString($_REQUEST['s24'])); $s25 = $this->stripslashesSafe($this->escapeString($_REQUEST['s25'])); $s26 = $this->stripslashesSafe($this->escapeString($_REQUEST['s26'])); // s27 has been deprecated 'access level' $s28 = $this->stripslashesSafe($this->escapeString($_REQUEST['s28'])); // s27 has been deprecated 'zoomModule' // s30, s31, s32 have been deprecated => old user privs system. $s33 = $this->stripslashesSafe($this->escapeString($_REQUEST['s33'])); $s34 = $this->stripslashesSafe($this->escapeString($_REQUEST['s34'])); $s35 = $this->stripslashesSafe($this->escapeString($_REQUEST['s35'])); $s36 = $this->stripslashesSafe($this->escapeString($_REQUEST['s36'])); $s37 = $this->stripslashesSafe($this->escapeString($_REQUEST['s37'])); $s38 = $this->stripslashesSafe($this->escapeString($_REQUEST['s38'])); $s39 = $this->stripslashesSafe($this->escapeString($_REQUEST['s39'])); $s40 = $this->stripslashesSafe($this->escapeString($_REQUEST['s40'])); $s41 = $this->stripslashesSafe($this->escapeString($_REQUEST['s41'])); $s42 = $this->stripslashesSafe($this->escapeString($_REQUEST['s42'])); $s43 = $this->stripslashesSafe($this->escapeString($_REQUEST['s43'])); $s44 = $this->stripslashesSafe($this->escapeString($_REQUEST['s44'])); $s45 = $this->stripslashesSafe($this->escapeString($_REQUEST['s45'])); if (strlen($this->_CONFIG['safemodeversion']) > 0) { $s46 = $this->stripslashesSafe($this->escapeString($_REQUEST['s46'])); } else { $s46 = 0; } // variables s47 till s49 are in use by the ftp feature and handled separately. $s50 = $this->stripslashesSafe($this->escapeString($_REQUEST['s50'])); $s51 = $this->stripslashesSafe($this->escapeString($_REQUEST['s51'])); // variable s52 is in use by the ftp feature and handled seperately. $s53 = $this->stripslashesSafe($this->escapeString($_REQUEST['s53'])); $s54 = $this->stripslashesSafe($this->escapeString($_REQUEST['s54'])); $s55 = $this->stripslashesSafe($this->escapeString($_REQUEST['s55'])); $s56 = $this->stripslashesSafe($this->escapeString($_REQUEST['s56'])); $s57 = $this->stripslashesSafe($this->escapeString($_REQUEST['s57'])); $s58 = $this->stripslashesSafe($this->escapeString($_REQUEST['s58'])); // mp3 configuration variable... $s59 = $this->stripslashesSafe($this->escapeString($_REQUEST['s59'])); // variable s60 is in use by the second CSS area, thus skipped... $s60 = $this->stripslashesSafe($this->escapeString($_REQUEST['s61'])); $s61 = $this->stripslashesSafe($this->escapeString($_REQUEST['s62'])); $s62 = $this->stripslashesSafe($this->escapeString($_REQUEST['s63'])); // s63 and s64 are deprecated because of Ajax rating implementation $s65 = $this->stripslashesSafe($this->escapeString($_REQUEST['s65'])); // watermarking vars (s66, s67 and 68) $s66 = $this->stripslashesSafe($this->escapeString($_REQUEST['s66'])); $s67 = $this->stripslashesSafe($this->escapeString($_REQUEST['s67'])); $s68 = $this->stripslashesSafe($this->escapeString($_REQUEST['s68'])); // variables s69 till s71 were in use by the zOOm Module. Deprecated. // variable s72 = toptenOn (for Top Ten link on main page) $s72 = $this->stripslashesSafe($this->escapeString($_REQUEST['s72'])); // variable s73 = lastsubmOn (for Last Submition link on main page) $s73 = $this->stripslashesSafe($this->escapeString($_REQUEST['s73'])); // variable s74 = close (for close button in view.php) $s74 = $this->stripslashesSafe($this->escapeString($_REQUEST['s74'])); // variable s73 = mainscreen (for mainscreen link) $s75 = $this->stripslashesSafe($this->escapeString($_REQUEST['s75'])); // variable s76 = navbuttons (for buttons at the top on view.php) $s76 = $this->stripslashesSafe($this->escapeString($_REQUEST['s76'])); // variable s77 = property $s77 = $this->stripslashesSafe($this->escapeString($_REQUEST['s77'])); $s78 = $this->stripslashesSafe($this->escapeString($_REQUEST['s78'])); $s79 = $this->stripslashesSafe($this->escapeString($_REQUEST['s79'])); $s80 = $this->stripslashesSafe($this->escapeString($_REQUEST['s80'])); $s81 = $this->stripslashesSafe($this->escapeString($_REQUEST['s81'])); $s82 = intval($this->getParam($_REQUEST, 's82', 0)); $s83 = intval($this->getParam($_REQUEST, 's83', 0)); $s84 = intval($this->getParam($_REQUEST, 's84', 0)); $s85 = intval($this->getParam($_REQUEST, 's85', 1)); $s86 = intval($this->getParam($_REQUEST, 's86', 0)); $s87 = intval($this->getParam($_REQUEST, 's87', 0)); if (!isset($s29) || empty($s29)) { $s29 = 0; } // the representation and meaning of each s-variable explains itself // in the following statement: $cfg_content = "<?php\n"; $cfg_content .= "defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );\n"; $cfg_content .= "\$zoomConfig['conversiontype'] = \"{$s01}\";\n"; $cfg_content .= "\$zoomConfig['zoom_title'] = \"{$s28}\";\n"; $cfg_content .= "\$zoomConfig['imagepath'] = \"{$s02}\";\n"; $cfg_content .= "\$zoomConfig['IM_path'] = \"{$s03}\";\n"; $cfg_content .= "\$zoomConfig['NETPBM_path'] = \"{$s04}\";\n"; $cfg_content .= "\$zoomConfig['FFMPEG_path'] = \"{$s36}\";\n"; $cfg_content .= "\$zoomConfig['PDF_path'] = \"{$s45}\";\n"; $cfg_content .= "\$zoomConfig['override_FFMPEG'] = \"{$s82}\";\n"; $cfg_content .= "\$zoomConfig['override_PDF'] = \"{$s83}\";\n"; $cfg_content .= "\$zoomConfig['JPEGquality'] = \"{$s05}\";\n"; $cfg_content .= "\$zoomConfig['maxsize'] = \"{$s26}\";\n"; $cfg_content .= "\$zoomConfig['maxsizekb'] = \"{$s84}\";\n"; $cfg_content .= "\$zoomConfig['size'] = \"{$s06}\";\n"; $cfg_content .= "\$zoomConfig['columnsno'] = \"{$s07}\";\n"; $cfg_content .= "\$zoomConfig['PageSize'] = \"{$s08}\";\n"; $cfg_content .= "\$zoomConfig['orderMethod'] = \"{$s24}\";\n"; $cfg_content .= "\$zoomConfig['catOrderMethod'] = \"{$s51}\";\n"; $cfg_content .= "\$zoomConfig['viewtype'] = \"{$s85}\";\n"; $cfg_content .= "\$zoomConfig['hotlinkProtection'] = \"{$s86}\";\n"; $cfg_content .= "\$zoomConfig['commentsOn'] = \"{$s09}\";\n"; $cfg_content .= "\$zoomConfig['cmtLength'] = \"{$s44}\";\n"; $cfg_content .= "\$zoomConfig['anonymous_comments'] = \"{$s80}\";\n"; $cfg_content .= "\$zoomConfig['galleryPrefix'] = \"{$s50}\";\n"; $cfg_content .= "\$zoomConfig['showoccspace'] = \"{$s79}\";\n"; $cfg_content .= "\$zoomConfig['dragdrop'] = \"{$s81}\";\n"; $cfg_content .= "\$zoomConfig['ratingOn'] = \"{$s17}\";\n"; $cfg_content .= "\$zoomConfig['toptenOn'] = \"{$s72}\";\n"; $cfg_content .= "\$zoomConfig['lastsubmOn'] = \"{$s73}\";\n"; $cfg_content .= "\$zoomConfig['close'] = \"{$s74}\";\n"; $cfg_content .= "\$zoomConfig['mainscreen'] = \"{$s75}\";\n"; $cfg_content .= "\$zoomConfig['navbuttons'] = \"{$s76}\";\n"; $cfg_content .= "\$zoomConfig['properties'] = \"{$s77}\";\n"; $cfg_content .= "\$zoomConfig['mediafound'] = \"{$s78}\";\n"; $cfg_content .= "\$zoomConfig['zoomOn'] = \"{$s19}\";\n"; $cfg_content .= "\$zoomConfig['popUpImages'] = \"{$s10}\";\n"; $cfg_content .= "\$zoomConfig['catImg'] = \"{$s11}\";\n"; $cfg_content .= "\$zoomConfig['slideshow'] = \"{$s12}\";\n"; $cfg_content .= "\$zoomConfig['displaylogo'] = \"{$s13}\";\n"; $cfg_content .= "\$zoomConfig['descrInGal'] = \"{$s86}\";\n"; $cfg_content .= "\$zoomConfig['readEXIF'] = \"{$s14}\";\n"; $cfg_content .= "\$zoomConfig['readID3'] = \"{$s58}\";\n"; $cfg_content .= "\$zoomConfig['tempDescr'] = \"{$s16}\";\n"; $cfg_content .= "\$zoomConfig['tempName'] = \"{$s20}\";\n"; $cfg_content .= "\$zoomConfig['autonumber'] = \"{$s21}\";\n"; $cfg_content .= "\$zoomConfig['showHits'] = \"{$s22}\";\n"; $cfg_content .= "\$zoomConfig['showName'] = \"{$s38}\";\n"; $cfg_content .= "\$zoomConfig['showDescr'] = \"{$s39}\";\n"; $cfg_content .= "\$zoomConfig['showKeywords'] = \"{$s40}\";\n"; $cfg_content .= "\$zoomConfig['showDate'] = \"{$s41}\";\n"; $cfg_content .= "\$zoomConfig['showUsername'] = \"{$s59}\";\n"; $cfg_content .= "\$zoomConfig['showFilename'] = \"{$s42}\";\n"; $cfg_content .= "\$zoomConfig['showSearch'] = \"{$s37}\";\n"; $cfg_content .= "\$zoomConfig['showMetaBox'] = \"{$s43}\";\n"; $cfg_content .= "\$zoomConfig['animate_box'] = \"{$s65}\";\n"; $cfg_content .= "\$zoomConfig['properties_state'] = \"{$s60}\";\n"; $cfg_content .= "\$zoomConfig['meta_state'] = \"{$s61}\";\n"; $cfg_content .= "\$zoomConfig['comments_state'] = \"{$s62}\";\n"; $cfg_content .= "\$zoomConfig['catcolsno'] = \"{$s23}\";\n"; $cfg_content .= "\$zoomConfig['utype'] = \"{$s27}\";\n"; $cfg_content .= "\$zoomConfig['lightbox'] = \"{$s25}\";\n"; $cfg_content .= "\$zoomConfig['ecards'] = \"{$s34}\";\n"; $cfg_content .= "\$zoomConfig['ecards_lifetime'] = \"{$s35}\";\n"; $cfg_content .= "\$zoomConfig['wm_apply'] = \"{$s66}\";\n"; $cfg_content .= "\$zoomConfig['wm_file'] = \"{$s67}\";\n"; $cfg_content .= "\$zoomConfig['wm_position'] = \"{$s68}\";\n"; $cfg_content .= "\$zoomConfig['safemodeON'] = \"{$s46}\";\n"; if ($this->_CONFIG['secret'] == "zoom") { $this->_CONFIG['secret'] = $this->makePassword(16); } $cfg_content .= "\$zoomConfig['secret'] = \"{$this->_CONFIG['secret']}\";\n"; $cfg_content .= "\$zoomConfig['version'] = \"{$this->_CONFIG['version']}\";\n"; $cfg_content .= "\$zoomConfig['safemodeversion'] = \"{$this->_CONFIG['safemodeversion']}\";\n"; $cfg_content .= "?>"; $cfg_file = $mosConfig_absolute_path . '/components/com_zoom/etc/zoom_config.php'; @$this->platform->chmod($cfg_file, '0766'); $permission = is_writable($cfg_file); if (!$permission) { echo "Error: zOOm Configuration file " . $cfg_file . " is not writable!"; exit; } $this->writefile($cfg_file, $cfg_content); // now save the usermenu-item link, if the s33 was checked or delete it otherwise... if ($s33 == 1 && !$this->issetUserMenu()) { // all ok, insert menu-option... $database->setQuery("INSERT INTO #__menu (`id`,`menutype`,`name`,`link`,`type`,`published`,`parent`,`componentid`,`sublevel`,`ordering`,`checked_out`,`checked_out_time`,`pollid`,`browserNav`,`access`,`utaccess`,`params`) VALUES ('','usermenu','Upload Media','index.php?option=com_zoom&page=admin','url','1','0','0','0','0','0','0000-00-00 00:00:00','0','0','1','2','')"); $database->query(); } elseif ($s33 == 0 && ($theId = $this->issetUserMenu())) { $database->setQuery("DELETE FROM #__menu WHERE id = " . $theId); $database->query(); } // save the privileges config into the mos_zoom_priv table... $gtree = $acl->get_group_children_tree(null, 'USERS', false); foreach ($gtree as $group) { if ($group->value != 29 && $group->value != 30) { $privileges = new privileges($database, $group->value); foreach ($privileges->getPrivileges() as $privilege => $value) { $privileges->setPrivilege($privilege, $_REQUEST[$privilege . '_' . $group->value]); } if (!$privileges->savePrivileges()) { return false; } } } return true; }