Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

UCenter 中短消息设置如何影响短消息发送过程

[复制链接]
beijing200808 发表于 2011-7-5 10:02:42 | 显示全部楼层 |阅读模式
本帖最后由 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函数中,通过
  1. $this->set_setting('privatepmthreadlimit', intval($privatepmthreadlimit));
复制代码
将设置值更新到数据库中
  1. function set_setting($k, $v, $encode = FALSE) {
  2.        $v = is_array($v) || $encode ? addslashes(serialize($v)) : $v;
  3.        $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."settings SET k='$k', v='$v'");
  4. }
复制代码
可见,这些设置提交后,只会保存到ucenter的设置表settings中,还不会影响论坛的操作。

二、当论坛更新缓存时,程序会按照顺序执行各个函数,
  1. 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函数中取出设置的参数值,
  1. $settings = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd");
复制代码
在updatedata函数中写入到uc_client/data/cache/settings.php文件中。
  1. function updatedata($cachefile = '') {
  2.        if($cachefile) {
  3.               foreach((array)$this->map[$cachefile] as $modules) {
  4.                      $s = "<?php\r\n";
  5.                      foreach((array)$modules as $m) {
  6.                             $method = "_get_$m";
  7.                             $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
  8.                      }
  9.                      $s .= "\r\n?>";
  10.                      @file_put_contents(UC_DATADIR."./cache/$cachefile.php", $s);
  11.               }
  12.        } else {
  13.               foreach((array)$this->map as $file => $modules) {
  14.                      $s = "<?php\r\n";
  15.                      foreach($modules as $m) {
  16.                             $method = "_get_$m";
  17.                             $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n";
  18.                      }
  19.                      $s .= "\r\n?>";
  20.                      @file_put_contents(UC_DATADIR."./cache/$file.php", $s);
  21.               }
  22.        }
  23. }
复制代码
三、当会员发送短消息的时候,在uc_client\control\pm.php文件的 onsendpm 函数中,所使用的$this->settings['pmsendregdays'] 等,就是uc_client/data/cache/settings.php文件中的值。
  1. if($this->settings['pmsendregdays']) {
  2.        if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) {
  3.               return PMSENDREGDAYS;
  4.        }
  5. }
  6. if($this->settings['chatpmmemberlimit']) {
  7.        if($type == 1 && ($countmsgto > ($this->settings['chatpmmemberlimit'] - 1))) {
  8.               return CHATPMMEMBERLIMIT_ERROR;
  9.        }
  10. }
  11. if($this->settings['pmfloodctrl']) {
  12.        if(!$_ENV['pm']->ispminterval($this->user['uid'], $this->settings['pmfloodctrl'])) {
  13.               return PMFLOODCTRL_ERROR;
  14.        }
  15. }
  16. if($this->settings['privatepmthreadlimit']) {
  17.        if(!$_ENV['pm']->isprivatepmthreadlimit($this->user['uid'], $this->settings['privatepmthreadlimit'])) {
  18.               return PRIVATEPMTHREADLIMIT_ERROR;
  19.        }
  20. }
  21. if($this->settings['chatpmthreadlimit']) {
  22.        if(!$_ENV['pm']->ischatpmthreadlimit($this->user['uid'], $this->settings['chatpmthreadlimit'])) {
  23.               return CHATPMTHREADLIMIT_ERROR;
  24.        }
  25. }
复制代码
这就是ucenter中进行短消息设置时,影响前台短消息发送的过程。
有种常见的问题是,其他操作都没有问题,就是uc_client\data\cache目录权限不对,造成设置的缓存不能更新,导致会员发送短消息时出现各种问题。
64243354 发表于 2011-7-5 10:58:44 | 显示全部楼层
來抢SF之后再看
回复

使用道具 举报

pcyi 发表于 2011-7-5 11:54:22 | 显示全部楼层
不懂也看看 学着点
回复

使用道具 举报

ARCHY` 发表于 2011-7-7 00:14:13 | 显示全部楼层
支持下
回复

使用道具 举报

ejiaxingorg 发表于 2011-11-9 10:58:17 | 显示全部楼层
{:soso_e175:}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-16 19:10 , Processed in 0.109302 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表