function cleanup() { $err = false; $bugp = $this->get_config('bugpath'); $path = $this->get_config('path'); // allow numeric client ID only if ($err = preg_match("/^[^0-9]+\$/", $this->get_config('client_id'))) { printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_CID_ERROR, S9YPOT_ERR_END); } // webbug path must be absolute, no trailing slash if (!empty($bugp) && ($err = !preg_match("/^http(.*)[^\\/]\$/", $bugp))) { printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_BUGURL_ERROR, S9YPOT_ERR_END); } // path must be absolute, no trailing slash if (!empty($path) && ($err = !preg_match("/^[\\/].*[^\\/]\$/", $path))) { printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_PATH_ERROR, S9YPOT_ERR_END); } // check for an existing POT installation $location = sprintf("%s/%s", $this->get_config('path'), $this->get_config('fname')); if (!empty($path) && ($err = !file_exists($location))) { printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_FNAME_ERROR, S9YPOT_ERR_END); } // s9y plugin error messaging is quite sub-optimal, print explanation what happened // reset all config values so nothing gets logged using a wrong client ID (logging will fail due to wrong path) if ($err || empty($bugp) && empty($path)) { $this->set_config('client_id', S9YPOT_DEFAULT_CID); $this->set_config('path', S9YPOT_DEFAULT_PATH); $this->set_config('fname', S9YPOT_DEFAULT_FNAME); $this->set_config('bugpath', S9YPOT_BUGDEFAULT_FNAME); printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_ERR_RESET, S9YPOT_ERR_END); } serendipity_plugin_api::remove_plugin_value($this->instance, array('path', 'fname', 'client_id', 'bugpath')); }
/** * serendipity_plugin::cleanup method * * @return boolean */ function cleanup() { global $serendipity; // check possible config mismatch setting if (serendipity_db_bool($this->get_config('showapp')) === true && serendipity_db_bool($this->get_config('automoderate')) === true) { $this->set_config('automoderate', false); echo '<div class="msg_error"><span class="icon-attention-circled"></span> ' . PLUGIN_GUESTBOOK_CONFIG_ERROR . '</div>'; return false; } // Cleanup. Remove all empty configs on SAVECONF-Submit. serendipity_plugin_api::remove_plugin_value($this->instance, array('sessionlock', 'timelock', 'version', 'targetmail', 'pageurl', 'dynamic_fields', 'dynamic_fields_desc', 'formpopup', 'getdynfield', 'showdynfield')); return true; }
function cleanup() { // Cleanup. Remove all empty configs on SAVECONF-Submit. serendipity_plugin_api::remove_plugin_value($this->instance, array('title', 'description')); return true; }