本帖最后由 beijing200808 于 2011-7-5 10:31 编辑
站长在 Discuz! X 的日常维护和使用中,往往会在ucenter中对短消息进行控制。那么,在ucenter中进行的设置,怎么影响论坛中的短消息操作呢?我们简单说一下
一、在ucenter中进行短消息的相关设置,每一项设置都会对应一个变量,
发短消息最少注册天数(pmsendregdays )
同一用户在24小时内允许发起两人会话的最大数(privatepmthreadlimit )
同一用户在24小时内允许发起群聊会话的最大数(chatpmthreadlimit )
参与同一群聊会话的最大用户数(chatpmmemberlimit )
发短消息灌水预防(pmfloodctrl )
启用短消息中心(pmcenter )
开启发送短消息验证码(sendpmseccode )
在uc_server\control\admin\setting.php文件的onls函数中,通过- $this->set_setting('privatepmthreadlimit', intval($privatepmthreadlimit));
复制代码 将设置值更新到数据库中- function set_setting($k, $v, $encode = FALSE) {
- $v = is_array($v) || $encode ? addslashes(serialize($v)) : $v;
- $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."settings SET k='$k', v='$v'");
- }
复制代码 可见,这些设置提交后,只会保存到ucenter的设置表settings中,还不会影响论坛的操作。
二、当论坛更新缓存时,程序会按照顺序执行各个函数,- updatecache(function_cache.php) -> build_cache_setting(cache_setting.php)-> uc_app_ls(client.php)-> init_cache(base.php)-> cache(base.php)-> updatedata(cache.php)-> _get_settings(cache.php)-> get_setting(base.php)
复制代码 在get_setting函数中取出设置的参数值,- $settings = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd");
复制代码 在updatedata函数中写入到uc_client/data/cache/settings.php文件中。- function updatedata($cachefile = '') {
- if($cachefile) {
- foreach((array)$this->map[$cachefile] as $modules) {
- $s = "<?php\r\n";
- foreach((array)$modules as $m) {
- $method = "_get_$m";
- $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
- }
- $s .= "\r\n?>";
- @file_put_contents(UC_DATADIR."./cache/$cachefile.php", $s);
- }
- } else {
- foreach((array)$this->map as $file => $modules) {
- $s = "<?php\r\n";
- foreach($modules as $m) {
- $method = "_get_$m";
- $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
- }
- $s .= "\r\n?>";
- @file_put_contents(UC_DATADIR."./cache/$file.php", $s);
- }
- }
- }
复制代码 三、当会员发送短消息的时候,在uc_client\control\pm.php文件的 onsendpm 函数中,所使用的$this->settings['pmsendregdays'] 等,就是uc_client/data/cache/settings.php文件中的值。- if($this->settings['pmsendregdays']) {
- if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) {
- return PMSENDREGDAYS;
- }
- }
- if($this->settings['chatpmmemberlimit']) {
- if($type == 1 && ($countmsgto > ($this->settings['chatpmmemberlimit'] - 1))) {
- return CHATPMMEMBERLIMIT_ERROR;
- }
- }
- if($this->settings['pmfloodctrl']) {
- if(!$_ENV['pm']->ispminterval($this->user['uid'], $this->settings['pmfloodctrl'])) {
- return PMFLOODCTRL_ERROR;
- }
- }
- if($this->settings['privatepmthreadlimit']) {
- if(!$_ENV['pm']->isprivatepmthreadlimit($this->user['uid'], $this->settings['privatepmthreadlimit'])) {
- return PRIVATEPMTHREADLIMIT_ERROR;
- }
- }
- if($this->settings['chatpmthreadlimit']) {
- if(!$_ENV['pm']->ischatpmthreadlimit($this->user['uid'], $this->settings['chatpmthreadlimit'])) {
- return CHATPMTHREADLIMIT_ERROR;
- }
- }
复制代码 这就是ucenter中进行短消息设置时,影响前台短消息发送的过程。
有种常见的问题是,其他操作都没有问题,就是uc_client\data\cache目录权限不对,造成设置的缓存不能更新,导致会员发送短消息时出现各种问题。
|