/** * updates the site status * @param string $state */ function setSiteState($state) { global $_configMutex; $_configMutex->lock(); $zp_cfg = @file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE); $zp_cfg = updateConfigItem('site_upgrade_state', $state, $zp_cfg); storeConfig($zp_cfg); $_configMutex->unlock(); }
/** * updates the site status * @param string $state */ function setSiteState($state, $folder = NULL) { if (is_null($folder)) { $folder = SERVERPATH . '/'; } $_configMutex = new zpMutex('cF', NULL, $folder); $_configMutex->lock(); $zp_cfg = @file_get_contents($folder . DATA_FOLDER . '/' . CONFIGFILE); $zp_cfg = updateConfigItem('site_upgrade_state', $state, $zp_cfg); storeConfig($zp_cfg, $folder); $_configMutex->unlock(); }
$notify = '?post_error'; } } /* * * Security Options ** */ if (isset($_POST['savesecurityoptions'])) { $protocol = sanitize($_POST['server_protocol'], 3); if ($protocol != SERVER_PROTOCOL) { // force https if required to be sure it works, otherwise the "save" will be the last thing we do httpsRedirect(); } if (getOption('server_protocol') != $protocol) { setOption('server_protocol', $protocol); $_configMutex->lock(); $zp_cfg = @file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE); $zp_cfg = updateConfigItem('server_protocol', $protocol, $zp_cfg); storeConfig($zp_cfg); $_configMutex->unlock(); } $_zp_gallery->setUserLogonField(isset($_POST['login_user_field'])); if ($protocol == 'http') { zp_clearCookie("zenphoto_ssl"); } setOption('IP_tied_cookies', (int) isset($_POST['IP_tied_cookies'])); setOption('obfuscate_cache', (int) isset($_POST['obfuscate_cache'])); setOption('image_processor_flooding_protection', (int) isset($_POST['image_processor_flooding_protection'])); $_zp_gallery->save(); $returntab = "&tab=security"; } /* * * custom options ** */ if (!$themeswitch) { // was really a save.
function handleOptionSave($theme, $album) { $notify = false; if (getOption('rewriteTokens_restore')) { $updated = false; purgeOption('rewriteTokens_restore'); $template = file_get_contents(SERVERPATH . '/' . ZENFOLDER . '/zenphoto_cfg.txt'); $i = strpos($template, "\$conf['special_pages']"); $j = strpos($template, '//', $i); $newtext = substr($template, $i, $j - $i); eval($newtext); $this->conf_vars = $conf['special_pages']; foreach ($this->plugin_vars as $page => $element) { if (isset($element['option'])) { $this->plugin_vars[$page]['rewrite'] = $element['default']; setOption($element['option'], $element['default']); } } } else { foreach ($this->conf_vars as $page => $element) { $rewrite = sanitize($_POST['rewriteTokens_' . $page]); if (empty($rewrite)) { $notify = '&custom=' . gettext('Rewrite tokens may not be empty.'); } else { $this->conf_vars[$page]['rewrite'] = $rewrite; } foreach ($this->plugin_vars as $page => $element) { if (isset($element['option'])) { $rewrite = sanitize($_POST['rewriteTokens_' . $page]); if (empty($rewrite)) { $notify = '&custom=' . gettext('Rewrite tokens may not be empty.'); } else { $this->plugin_vars[$page]['rewrite'] = $rewrite; setOption($element['option'], $rewrite); } } } } } $newtext = "\$conf['special_pages'] = array("; foreach ($this->conf_vars as $page => $element) { if ($define = $element['define']) { $define = "'" . $define . "'"; $desc = sprintf(gettext('Link for <em>%s</em> rule.'), $page); } else { $define = 'false'; $desc = sprintf(gettext('Link for <em>%s</em> script page.'), $page); } if (array_key_exists('rule', $element)) { $rule = ",\t\t'rule'=>'{$element['rule']}'"; } else { $rule = ''; } $newtext .= $token = "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$page}'=>\t\t\tarray('define'=>{$define},\t\t\t\t\t\t'rewrite'=>'{$element['rewrite']}'{$rule}),"; } $newtext = substr($newtext, 0, -1) . "\n\t\t\t\t\t\t\t\t\t\t\t\t);\n"; $zp_cfg = $this->zp_cfg_a . $newtext . $this->zp_cfg_b; storeConfig($zp_cfg); return $notify; }