C::t('user_verify_info')->delete_by_uid($_G['uid'], $vid); $setverify = array('uid' => $_G['uid'], 'username' => $_G['username'], 'verifytype' => $vid, 'field' => serialize($verifyarr), 'dateline' => $_G['timestamp'], 'orgid' => intval($verifyarr['department'])); C::t('user_verify_info')->insert($setverify); if (!C::t('user_verify')->count_by_uid($_G['uid'])) { C::t('user_verify')->insert(array('uid' => $_G['uid'])); } if ($_G['setting']['verify'][$vid]['available']) { //发送通知管理员有资料需要审核 $appid = C::t('app_market')->fetch_appid_by_mod('{adminscript}?mod=member', 1); foreach (C::t('user')->fetch_all_by_adminid(1) as $value) { if ($value['uid'] != $_G['uid']) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => 'admin.php?mod=member&op=verify&vid=' . $vid, 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'title' => $vid ? $_G['setting']['verify'][$vid]['title'] : '资料审核'); $action = 'profile_moderate'; $type = 'profile_moderate_' . $vid; dzz_notification::notification_add($value['uid'], $type, $action, $notevars); } } } } if (isset($_POST['privacy'])) { foreach ($_POST['privacy'] as $key => $value) { if (isset($_G['cache']['profilesetting'][$key])) { $space['privacy']['profile'][$key] = intval($value); } } C::t('user_field')->update($space['uid'], array('privacy' => serialize($space['privacy']))); } countprofileprogress(); $message = $vid ? lang('message', 'profile_verify_verifying', array('verify' => $verifyconfig['title'])) : ''; profile_showsuccess($message);
public function callback_by_comment($comment, $action = 'add', $ats = array()) { $fid = $comment['id']; $class = C::t('#corpus#corpus_class')->fetch($fid); $replyaction = ''; $rpost = array(); if ($comment['rcid'] > 0) { $rpost = C::t('comment')->fetch($comment['rcid']); $replyaction = '_reply'; } elseif ($comment['pcid'] > 0) { $rpost = C::t('comment')->fetch($comment['pcid']); $replyaction = '_reply'; } //产生事件 $event = array('uid' => $comment['authorid'], 'username' => $comment['author'], 'body_template' => 'corpus_commit_doc_' . $action . $replyaction, 'body_data' => serialize(array('author' => $rpost['author'], 'cid' => $class['cid'], 'fid' => $fid, 'fname' => $class['fname'], 'comment' => $comment['message'])), 'dateline' => TIMESTAMP, 'bz' => 'corpus_' . $class['cid']); C::t('#corpus#corpus_event')->insert($event); $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=corpus', 1); if ($action == 'add' && $ats) { //如果评论中@用户时,给用户发送通知 foreach ($ats as $uid) { //发送通知 if ($uid != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $class['cid'] . '&fid=' . $class['fid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'fname' => getstr($class['fname'], 30), 'comment' => $comment['message']); dzz_notification::notification_add($uid, 'corpus_comment_at_' . $class[$cid], 'corpus_comment_at', $notevars, 0, 'dzz/corpus'); } } } if ($action == 'add') { if ($comment['pcid'] == 0) { //发送通知,通知文档的作者; if ($class['uid'] != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $class['cid'] . '&fid=' . $class['fid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'fname' => getstr($class['fname'], 30), 'comment' => $comment['message']); dzz_notification::notification_add($class['uid'], 'corpus_comment_mydoc_' . $class[$cid], 'corpus_comment_mydoc', $notevars, 0, 'dzz/corpus'); } } else { //通知原评论人 if ($rpost['uid'] != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $class['cid'] . '&fid=' . $class['fid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'fname' => getstr($class['fname'], 30), 'comment' => $comment['message']); dzz_notification::notification_add($rpost['authorid'], 'corpus_comment_reply_' . $class[$cid], 'corpus_comment_reply', $notevars, 0, 'dzz/corpus'); } } } }
<?php if (!defined('IN_DZZ')) { exit('Access Denied'); } header('Content-Type: text/javascript'); $pernum = 10; dsetcookie('sendwx', '1', 5); $lockfile = DZZ_ROOT . './data/sendwx.lock'; @($filemtime = filemtime($lockfile)); if ($_G['timestamp'] - $filemtime < 5) { exit; } touch($lockfile); @set_time_limit(0); foreach (DB::fetch_all("select * from %t where wx_new>0 and wx_note!='' order by dateline DESC,wx_new ASC limit %d", array('notification', $pernum)) as $value) { dzz_notification::wx_sendMsg($value); }
$rpost = DB::fetch_first("select * from %t where `first`>0 and tid=%d", array('feed_post', $tid)); } if ($rpost['authorid'] != $_G['uid']) { $replyarr = array('uid' => $_G['uid'], 'pid' => $post['pid'], 'tid' => $tid, 'rpid' => $rpost['pid'], 'ruid' => $rpost['authorid'], 'dateline' => $_G['timestamp']); DB::insert('feed_reply', $replyarr, 1, 1); //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=feed&feedType=replyme', 'author' => $_G['username'], 'authorid' => $_G['authorid'], 'message' => stripsAT($message), 'dataline' => dgmdate(TIMESTAMP)); dzz_notification::notification_add($rpost['authorid'], 'feed_reply', 'feed_reply', $notevars, 0); } //处理@ if ($at_users) { C::t('feed_at')->insert_by_pid($post['pid'], $post['tid'], $at_users); //发送通知 foreach ($at_users as $value) { $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=feed', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'message' => stripsAT($message), 'dataline' => dgmdate(TIMESTAMP)); dzz_notification::notification_add($value, 'feed_at', 'feed_at', $notevars, 0); } } //处理附件 if ($_GET['attach']) { foreach ($_GET['attach']['title'] as $key => $value) { $setarr = array('pid' => $post['pid'], 'tid' => $post['tid'], 'dateline' => TIMESTAMP, 'aid' => intval($_GET['attach']['aid'][$key]), 'title' => trim($value), 'type' => trim($_GET['attach']['type'][$key]), 'img' => trim($_GET['attach']['img'][$key]), 'url' => trim($_GET['attach']['url'][$key]), 'ext' => trim($_GET['attach']['ext'][$key])); if (C::t('feed_attach')->insert($setarr)) { if ($setarr['aid'] > 0) { C::t('attachment')->addcopy_by_aid($setarr['aid']); } if ($setarr['type'] == 'link') { $imgarr = $setarr['img'] ? explode('icon', $setarr['img']) : array(); if (isset($imgarr[1]) && ($did = DB::result_first("select did from %t where pic=%s", array('icon', 'icon' . $imgarr[1])))) { C::t('icon')->update_copys_by_did($did); }
} } exit('success'); } elseif ($_GET['do'] == 'sendModNotice') { if (!$_G['cache']['news:setting']) { loadcache('news:setting'); } $setting = $_G['cache']['news:setting']; //通知管理员审核 $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=news', 1); foreach ($setting['moderators'] as $muid) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=news&status=2', 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP)); $action = 'news_moderate'; $type = 'news_moderate'; dzz_notification::notification_add($muid, $type, $action, $notevars, 0, 'dzz/news'); } exit(json_encode(array('msg' => '提醒信息发送成功'))); } elseif ($_GET['do'] == 'news_delete') { include_once libfile('function/news'); $newid = !empty($_GET['newid']) ? intval($_GET['newid']) : 0; $data = C::t('news')->fetch($newid); $perm = getPermByUid($_G['uid']); if ($perm < 2 && $data['authorid'] != $_G['uid']) { exit(json_encode(array('error' => '没有权限'))); } if (C::t('news')->delete_by_newid($newid)) { exit(json_encode(array('msg' => 'success'))); } else { exit(json_encode(array('error' => '删除失败'))); }
if (!$autosave) { //自动保存不产生事件 $event = array('uid' => getglobal('uid'), 'username' => getglobal('username'), 'body_template' => $new ? 'corpus_reversion_doc' : 'corpus_edit_doc', 'body_data' => serialize(array('cid' => $cid, 'fid' => $fid, 'fname' => $class['fname'])), 'dateline' => TIMESTAMP, 'bz' => 'corpus_' . $cid); C::t('corpus_event')->insert($event); //通知文档原作者 if ($class['uid'] != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $class['cid'] . '&fid=' . $class['fid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'fname' => getstr($class['fname'], 30)); if ($new) { $action = 'corpus_doc_reversion'; $type = 'corpus_doc_reversion_' . $class[$cid]; } else { $action = 'corpus_doc_edit'; $type = 'corpus_doc_edit_' . $class[$cid]; } dzz_notification::notification_add($class['uid'], $type, $action, $notevars, 0, 'dzz/corpus'); } } $return = array('id' => $fid, 'autosave' => $autosave); showmessage('do_success', dreferer(), array('data' => rawurlencode(json_encode($return))), array('showmsg' => true)); } } else { $navtitle = ''; $str = ''; $cid = intval($_GET['cid']); $fid = intval($_GET['fid']); $class = C::t('corpus_class')->fetch($fid); $did = $class['did']; if ($document = C::t('document')->fetch_by_did($did)) { $dzzpath = getDzzPath($document); $str = trim(IO::getFileContent($dzzpath));
public function update_by_newid($arr) { $data = parent::fetch($arr['newid']); if ($return = parent::update($arr['newid'], $arr)) { if ($data['attachs']) { $attachs = explode(',', $data['attachs']); C::t('attachment')->addcopy_by_aid($attachs, -1); } if (isset($arr['attachs'])) { $attachs = explode(',', $arr['attachs']); C::t('attachment')->addcopy_by_aid($attachs, 1); } //新添加的范围重新发送通知 $orgids = $uids = array(); if ($arr['orgids'] != $data['orgids']) { $norgids = $arr['orgids'] ? explode(',', $arr['orgids']) : array(); $oorgids = $data['orgids'] ? explode(',', $data['orgids']) : array(); $orgids = array_diff($norgids, $oorigids); } if ($arr['uids'] != $data['uids']) { $nuids = $arr['uids'] ? explode(',', $arr['uids']) : array(); $ouids = $data['uids'] ? explode(',', $data['uids']) : array(); $uids = array_diff($nuids, $ouids); } $new_uids = getUidsByOrgid($orgids, $uids); $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=news', 0); foreach ($new_uids as $uid) { if ($uid != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=news&op=view&newid=' . $data['newid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'subject' => $data['subject'], 'dataline' => dgmdate(TIMESTAMP)); $action = 'news_publish'; $type = 'news_publish_' . $uid; dzz_notification::notification_add($uid, $type, $action, $notevars, 0, 'dzz/news'); } } } return $return; }
public function delete_by_fid($fid, $force = false) { $class = parent::fetch($fid); if ($force) { return self::delete_permanent_by_pfid($fid); } elseif ($class['deletetime'] > 0) { return self::delete_permanent_by_pfid($fid); } else { if ($class['pfid'] < 1 && !DB::result_first("select COUNT(*) from %t where cid=%d and fid!=%d", array($this->_table, $class['cid'], $class['fid']))) { return false; } $ret = parent::update($fid, array('deletetime' => TIMESTAMP, 'deleteuid' => getglobal('uid'))); //产生事件 $event = array('uid' => getglobal('uid'), 'username' => getglobal('username'), 'body_template' => 'corpus_delete_' . ($class['type'] == 'file' ? 'doc' : 'dir'), 'body_data' => serialize(array('cid' => $class['cid'], 'fid' => $fid, 'fname' => $class['fname'])), 'dateline' => TIMESTAMP, 'bz' => 'corpus_' . $class['cid']); C::t('corpus_event')->insert($event); //通知文档原作者 $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=corpus', 1); if ($class['uid'] != getglobal('uid')) { //发送通知 $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $class['cid'] . '&fid=' . $class['fid'], 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'fname' => getstr($class['fname'], 30)); $action = 'corpus_doc_delete'; $type = 'corpus_doc_delete_' . $class['cid']; dzz_notification::notification_add($class['uid'], $type, $action, $notevars, 0, 'dzz/corpus'); } return $ret; } }
public function change_perm_by_uid($cid, $uid, $perm) { //管理员必须留一人 $data = DB::fetch_first("select * from %t where cid=%d and uid=%d", array($this->_table, $cid, $uid)); if ($data['perm'] > 2 && $perm < 3 && DB::result_first("select COUNT(*) from %t where cid=%d and perm>2", array($this->_table, $cid)) < 2) { return array('error' => '至少需要一名管理员'); } parent::update($data['id'], array('perm' => $perm, 'dateline' => TIMESTAMP)); if ($data['perm'] != $perm) { //权限改变 $permtitle = array('1' => '关注成员', '2' => '协作成员', '3' => '管理员'); if ($uid != getglobal('uid')) { //发送通知 $appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=corpus', 1); $corpus = C::t('corpus')->fetch($cid); $notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=corpus&op=list&cid=' . $corpus['cid'] . '&do=user', 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'corpusname' => getstr($corpus['name'], 30), 'permtitle' => $permtitle[$perm]); $action = 'corpus_user_change'; $type = 'corpus_user_change_' . $cid; dzz_notification::notification_add($uid, $type, $action, $notevars, 0, 'dzz/corpus'); } } return true; }