本文整理汇总了PHP中getstr函数的典型用法代码示例。如果您正苦于以下问题:PHP getstr函数的具体用法?PHP getstr怎么用?PHP getstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getstr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wx_sendMsg
public function wx_sendMsg($data)
{
if (!getglobal('setting/CorpID') || !getglobal('setting/CorpSecret')) {
return false;
}
$user = C::t('user')->fetch($data['uid']);
if (!$user['wechat_userid'] || $user['wechat_status'] != 1) {
C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
return false;
}
$agentid = 0;
if ($data['from_idtype'] == 'app' && $data['from_id'] && ($wxapp = C::t('wx_app')->fetch($data['from_id']))) {
if ($wxapp['agentid'] && $wxapp['status'] < 1) {
$agentid = $wxapp['agentid'];
}
}
$wx = new qyWechat(array('appid' => getglobal('setting/CorpID'), 'appsecret' => getglobal('setting/CorpSecret')));
$msg = array("touser" => "dzz-" . $data['uid'], "safe" => 0, "agentid" => $agentid, "msgtype" => "news", "news" => array("articles" => array(array("title" => $data['title'], "description" => getstr($data['wx_note'], 0, 0, 0, 0, -1), "url" => $wx->getOauthRedirect(getglobal('siteurl') . 'index.php?mod=system&op=wxredirect&url=' . dzzencode($data['redirecturl']))))));
if ($ret = $wx->sendMessage($msg)) {
C::t('notification')->update($data['id'], array('wx_new' => 0));
return true;
} else {
C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
$message = 'wx_notification:errCode:' . $wx->errCode . ';errMsg:' . $wx->errMsg;
runlog('wxlog', $message);
return false;
}
}
示例2: wz_record
function wz_record($get)
{
global $_SGLOBAL, $_SC;
reset($get);
foreach ($get as $k => $v) {
if ($k == 'wxid') {
$wxid = getstr($get[$k]);
}
if ($k == 'token') {
$token = getstr($get[$k]);
}
if ($k == 'mid') {
$mid = intval($get[$k]) ? intval($get[$k]) : 0;
}
if ($k == 'wxid' || $k == 'token' || $k == 'mid') {
unset($get[$k]);
continue;
} else {
$get[$k] = getstr($get[$k]);
}
$get[$k] = getstr($get[$k]);
}
$query = json_encode($get);
$arr = array('token_id' => $_SGLOBAL['supe_token_id'], 'query' => $query, 'ip' => getonlineip(), 'user_agent' => $_SERVER["HTTP_USER_AGENT"], 'wxid' => $wxid, 'token' => $token, 'mid' => $mid, 'addtime' => $_SGLOBAL['timestamp']);
$record_id = inserttable(tname('wz_record'), $arr, 1);
return $record_id;
}
示例3: checkhtml
public function checkhtml($html)
{
preg_match_all("/\\<([^\\<]+)\\>/is", $html, $ms);
$searchs[] = '<';
$replaces[] = '<';
$searchs[] = '>';
$replaces[] = '>';
if ($ms[1]) {
$allowtags = 'img|a|font|div|table|tbody|caption|tr|td|th|br|p|b|strong|i|u|em|span|ol|ul|li|blockquote|pre';
$ms[1] = array_unique($ms[1]);
foreach ($ms[1] as $value) {
$searchs[] = "<" . $value . ">";
$value = str_replace('&', '_uch_tmp_str_', $value);
$value = dhtmlspecialchars($value);
$value = str_replace('_uch_tmp_str_', '&', $value);
$value = str_replace(array('\\', '/*'), array('.', '/.'), $value);
$skipkeys = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload', 'javascript:;', 'javascript', 'script', 'eval', 'behaviour', 'expression');
$skipstr = implode('|', $skipkeys);
$value = preg_replace(array("/({$skipstr})/i"), '.', $value);
if (!preg_match("/^[\\/|\\s]?({$allowtags})(\\s+|\$)/is", $value)) {
$value = '';
}
$replaces[] = empty($value) ? '' : "<" . str_replace('"', '"', $value) . ">";
}
}
$html = str_replace($searchs, $replaces, $html);
return getstr($html, 0, 0, 0, 0, 1);
}
示例4: getstr
function getstr($items, $str, $parent)
{
foreach ($items as $k => $it) {
if (is_array($it)) {
if (stripos($it['name'], $str) !== false) {
return array($parent . '-' . ($k + 1), $it['name']);
} else {
$val = getstr($it['items'], $str, $parent . '-' . ($k + 1));
if (count($val) > 0) {
return $val;
}
}
}
}
return array();
}
示例5: getLatestData
/**
* 设置回复图文
* @param array $newsData
* 数组结构:
* array(
* "0"=>array(
* 'Title'=>'msg title',
* 'Description'=>'summary text',
* 'PicUrl'=>'http://www.domain.com/1.jpg',
* 'Url'=>'http://www.domain.com/1.html'
* ),
* "1"=>....
* )
*/
function getLatestData($wx, $uid, $limit = 10)
{
$param = array('news');
$sql = "status<2";
$orderby = "ORDER BY dateline DESC";
//阅读范围查询语句
$sql .= " and (";
$sql_gid = array("orgids=''");
$orgarr = getDepartmentByUid($uid);
//获取当前用户所在的部门数组
foreach ($orgarr as $value) {
foreach ($value as $value1) {
$sql_gid[] = "FIND_IN_SET(%d,orgids)";
$param[] = $value1['orgid'];
}
}
$sql .= "(" . implode(' OR ', $sql_gid) . ") and ( uids='' OR FIND_IN_SET(%d,uids)))";
$param[] = $uid;
$data = array();
$limit = intval($limit);
if (!$limit) {
$limit = 10;
}
foreach (DB::fetch_all("select * from %t where {$sql} {$orderby} limit {$limit} ", $param) as $value) {
$temp = array();
$temp['Title'] = $value['subject'];
$url = getglobal('siteurl') . 'index.php?mod=news&op=view&newid=' . $value['newid'];
if ($value['type'] == 0) {
//文本模式
$temp['Description'] = getstr($value['content'], 300, 0, 0, 0, -1);
$temp['Url'] = getOauthRedirect($url);
} elseif ($value['type'] == 1) {
//图片模式
$temp['Description'] = '';
$temp['Url'] = getOauthRedirect($url);
if ($pic = DB::fetch_first("select aid from %t where newid=%d limit 1", array('news_pic', $value['newid']))) {
$temp['PicUrl'] = getglobal('siteurl') . 'index.php?mod=io&op=thumbnail&original=1&path=' . dzzencode('attach::' . $pic['aid']);
}
} else {
//链接模式
$temp['Url'] = $value['url'];
$temp['Description'] = '';
}
$data[] = $temp;
}
return $data;
}
示例6: get_keyword
protected function get_keyword($keyword)
{
global $wx;
if (!$keyword) {
return false;
}
$msg = getstr(trim($keyword));
$msg = $this->SBC_DBC($msg, 1);
$result = $this->keyword_autoback($msg);
if ($result) {
return $result;
}
if ($wx->message['msgid']) {
$member_num = $this->ck_member_wx($msg);
}
return $this->msg_autoback();
}
示例7: Header
function Header()
{
parent::Header();
$this->setStyle('small');
$this->x = $this->left;
$this->y = $this->top - $this->getLineHeight() - 0.5;
$user = getvar('UserName');
$time = date('d/m/Y');
$edit = getstr('EditBy');
$date = getstr('Updated');
$input = "Nhaäp bôûi [{$edit}] ngaøy {$date}";
$print = "In bôûi [{$user}] ngaøy {$time}";
$print = $edit ? "{$input}. {$print}" : $print;
$html = "\n\t<table width={$this->width}><tr>\n\t\t<td nowrap>Coâng ty TNHH Quoác Daân - Chi nhaùnh TPHCM</td>\n\t\t<td align=right nowrap>{$print}</td>\n\t</tr></table>\n\t";
$this->htmltable($html, 0);
$this->hr();
$this->y = $this->top;
}
示例8: mod_by_newid
public function mod_by_newid($newids, $pass, $modreason)
{
//审核处理
$pass = $pass ? 1 : 2;
$newids = (array) $newids;
$ret = DB::query("update %t SET status=%d , modreason=%s,moduid=%d,modtime=%d where newid IN(%n)", array($this->_table, $pass, $modreason, getglobal('uid'), TIMESTAMP, $newids));
//发送通知用户审核情况
if ($ret) {
$ruids = array();
foreach (DB::fetch_all("select authorid from %t where newid IN(%n)", array($this->_table, $newids)) as $value) {
$ruids[$value['authorid']] = $value['authorid'];
}
if ($ruids) {
//通知发布者审核情况
$appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=news', 1);
foreach ($ruids as $uid) {
if ($uid != getglobal('uid')) {
//发送通知
$notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=news&status=' . $pass, 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'dataline' => dgmdate(TIMESTAMP), 'modreason' => getstr($modreason, 45));
$action = 'news_moderator_' . $pass;
$type = 'news_moderator_' . $uid;
dzz_notification::notification_add($uid, $type, $action, $notevars, 0, 'dzz/news');
}
}
}
if ($pass == 1) {
$appid = C::t('app_market')->fetch_appid_by_mod('{dzzscript}?mod=news', 0);
foreach ($newids as $newid) {
$arr = parent::fetch($newid);
$uids = getUidsByOrgid($arr['orgids'], $arr['uids']);
foreach ($uids as $uid) {
if ($uid != getglobal('uid')) {
//发送通知
$notevars = array('from_id' => $appid, 'from_idtype' => 'app', 'url' => DZZSCRIPT . '?mod=news&op=view&newid=' . $newid, 'author' => getglobal('username'), 'authorid' => getglobal('uid'), 'subject' => $arr['subject'], 'dataline' => dgmdate(TIMESTAMP));
$action = 'news_publish';
$type = 'news_publish_' . $uid;
dzz_notification::notification_add($uid, $type, $action, $notevars, 0, 'dzz/news');
}
}
}
}
}
return $ret;
}
示例9: pick_seo_replace
function pick_seo_replace($info, $bbs = 1)
{
if (!$info) {
return;
}
include_once libfile('function/home');
$set = pick_common_get();
$key_arr = array('push_title_header', 'push_title_footer', 'push_content_header', 'push_content_body', 'push_content_footer', 'push_reply_header', 'push_reply_body', 'push_reply_footer');
foreach ($key_arr as $v) {
${$v} = format_wrap($set[$v]);
}
$info_key = array('title', 'content', 'reply');
$hide = $bbs == 1 ? 0 : 1;
foreach ($info_key as $v) {
if (!$info[$v]) {
continue;
}
if ($v != 'title') {
//添加随机隐藏内容
$rand_arr_key = 'push_' . $v . '_body';
if (${$rand_arr_key}) {
$rand_arr = implode('*_*', ${$rand_arr_key});
$info[$v] = preg_replace("/\r\n|\n|\r/e", "pick_jammer('', '{$rand_arr}', {$bbs})", $info[$v]);
$info[$v] = preg_replace("/<\\/p>|<\\/P>/e", "pick_jammer('</p>', '{$rand_arr}', {$bbs})", $info[$v]);
}
}
$header_arr = 'push_' . $v . '_header';
$header_arr = ${$header_arr};
$header = $header_arr[array_rand($header_arr)];
$footer_arr = 'push_' . $v . '_footer';
$footer_arr = ${$footer_arr};
$footer = $footer_arr[array_rand($footer_arr)];
$info[$v] = $header . $info[$v];
$info[$v] .= $footer;
if ($v == 'title') {
$info[$v] = getstr(trim($info[$v]), 80, 1, 1);
}
}
return $info;
}
示例10: kefu_reg
protected function kefu_reg($msg)
{
global $_SGLOBAL, $wx, $_SC;
$op_wxid = $wx->weixin['op_wxid'];
$op_uid = $wx->weixin['op_uid'];
$create_time = $wx->message['time'];
$wxid = $wx->message['from'];
list($mobile, $weixin_code) = explode('@', $msg, 2);
$mobile = getstr($mobile);
$weixin_code = getstr($weixin_code);
$kefu = $_SGLOBAL['db']->fetch_array($_SGLOBAL['db']->query('select * from ' . tname('open_member_user') . ' where op_uid="' . $op_uid . '" and state=1 and mobile="' . $mobile . '" and weixin_code="' . $weixin_code . '"'));
if (!$kefu) {
$uid = 0;
} elseif ($kefu['weixin_state'] == 1) {
$uid = -1;
} else {
$uid = $kefu['uid'];
}
if ($uid > 0) {
$query = $_SGLOBAL['db']->query('select uid,fakeid,province,nickname from ' . tname('weixin_member') . ' where op_wxid=' . $op_wxid . ' and wxid="' . $wxid . '"');
$member = $_SGLOBAL['db']->fetch_array($query);
if (!$member) {
$ro = new WX_Remote_Opera();
$query = $_SGLOBAL['db']->query("select * from " . tname('open_member_weixin') . " where id='" . $op_wxid . "'");
if ($op_wx = $_SGLOBAL['db']->fetch_array($query)) {
$ro->init($op_wx['username'], $op_wx['password']);
}
$msglist = $ro->getmsglist();
foreach ($msglist as $k => $v) {
if ($v['date_time'] == $create_time) {
updatetable(tname('open_member_user'), array('weixin_state' => 1, 'weixin_fakeid' => $v['fakeid']), array('uid' => $uid, 'op_uid' => $op_uid));
break;
}
}
} else {
updatetable(tname('open_member_user'), array('weixin_state' => 1, 'weixin_fakeid' => $member['fakeid']), array('uid' => $uid, 'op_uid' => $op_uid));
}
}
return $uid;
}
示例11: callback_by_comment
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');
}
}
}
}
示例12: getstr
}
//实名认证
ckrealname('thread');
//视频认证
ckvideophoto('thread');
//新用户见习
cknewuser();
//提交
if(submitcheck('textsubmit')) {
//自由输入
$_POST['tagname'] = $tagname = getstr($_POST['tagname'], 40, 1, 1, 1);
$_POST['fieldid'] = $fieldid = intval($_POST['fieldid']);
$profield = $_SGLOBAL['profield'][$fieldid];
if(empty($profield) || $profield['formtype'] != 'text') {
showmessage('mtag_fieldid_does_not_exist');
}
if(strlen($tagname) < 2) {
showmessage('mtag_tagname_error');
}
if(!empty($_POST['joinmode'])) {
//二次确认
$mtag = mtag_join('tagname', stripslashes($tagname), $fieldid);
if(empty($mtag)) {
showmessage('mtag_join_error');
示例13: IHomeServiceCreateComplainReply
function IHomeServiceCreateComplainReply($params = NULL)
{
global $_SGLOBAL;
$cpid = 0;
# complain 表中的 id
$relay_times = 0;
if ($params['uid']) {
if ($params['uid'] <= 0) {
$errorMsg = array("errorNo" => "4002", "content" => "the format of parameter is not correct.the parameter uid must be a positive integer.");
return json_encode($errorMsg);
} else {
$query = $_SGLOBAL['db']->query("select name,username from " . tname('space') . " where uid = " . $params['uid']);
if ($row = $_SGLOBAL['db']->fetch_array($query)) {
if ($row['name']) {
$params['uname'] = $row['name'];
} else {
$params['uname'] = $row['username'];
}
} else {
$errorMsg = array("errorNo" => "500", "content" => "the uid is not exist");
return json_encode($errorMsg);
}
}
} else {
$errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter.the parameter uid is not exist or is not a positive integer.");
return json_encode($errorMsg);
}
$complain = array();
if ($params['complainId']) {
if ($params['complainId'] <= 0) {
$errorMsg = array("errorNo" => "4002", "content" => "the format of parameter is not correct.the parameter complainId must be a positive integer.");
return json_encode($errorMsg);
} else {
$query = $_SGLOBAL['db']->query("select * from " . tname('complain') . " where doid = " . $params['complainId']);
if ($complain = $_SGLOBAL['db']->fetch_array($query)) {
if (isblacklist($complain['uid'])) {
$errorMsg = array("errorNo" => "500", "content" => "the user of complain is in blacklist.");
return json_encode($errorMsg);
}
} else {
$errorMsg = array("errorNo" => "500", "content" => "the complain id is not exist");
return json_encode($errorMsg);
}
}
} else {
$errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter.the parameter complainId is not exist or is not a positive integer.");
return json_encode($errorMsg);
}
if (!$params['message']) {
$errorMsg = array("errorNo" => "4001", "content" => "lack the neccessary parameter message.");
return json_encode($errorMsg);
}
$params['timestamp'] = time();
$doid = $params['complainId'];
$message = getstr($params['message'], 480, 1, 1, 1);
preg_match_all("/[@](.*)[(]([\\d]+)[)]\\s*/U", $params['message'], $matches, PREG_SET_ORDER);
preg_match_all("/回复[@](.*)[(]([\\d]+)[)]\\s*/U", $params['message'], $reply_matches, PREG_SET_ORDER);
if ($reply_matches) {
$exclude_relay = 1;
}
# 如果带有回复字眼,则默认不为relay
$newid = 0;
$addtype = 0;
$query = $_SGLOBAL['db']->query("select * from " . tname('complain') . " where doid=" . $params['complainId'] . ' and atuid=' . $params['uid']);
if ($row = $_SGLOBAL['db']->fetch_array($query)) {
$complain = $row;
$addtype = 2;
$cpid = $complain['id'];
$relay_times = $complain['relay_times'];
}
$isrelay = 0;
if ($addtype && $matches && !$exclude_relay) {
$isrelay = 1;
}
if ($isrelay && $relay_times >= 3) {
$errorMsg = array("errorNo" => "500", "content" => "relay times reach the ceiling'.");
return json_encode($errorMsg);
}
$UserIds = array();
$relay_depid = 0;
foreach ($matches as $value) {
$TmpString = $value[0];
$TmpName = $value[1];
$UserId = $value[2];
$result = $_SGLOBAL['db']->query("select uid,username,name from " . tname('space') . " where uid=" . $UserId);
if ($rs = $_SGLOBAL['db']->fetch_array($result)) {
$realname = $rs['name'];
if (empty($realname)) {
$realname = $rs['username'];
}
$ValidValue = getAtName($TmpString, $TmpName, $realname);
$ValidValue = trim($ValidValue);
$at_friend = "space.php?uid=" . $UserId;
if ($ValidValue != false) {
$message = str_replace($ValidValue, "<a href={$at_friend}>@" . $realname . "</a> ", $message);
if (!in_array($UserId, $UserIds)) {
$UserIds[] = $UserId;
}
}
}
//.........这里部分代码省略.........
示例14: array
}
$blockdata['parameters']['music']['mp3list'] = $mp3list;
}
if (empty($blockdata['parameters']['music']['config'])) {
$blockdata['parameters']['music']['config'] = array('showmod' => 'default', 'autorun' => 'true', 'shuffle' => 'true', 'crontabcolor' => '#D2FF8C', 'buttoncolor' => '#1F43FF', 'fontcolor' => '#1F43FF');
}
$setarr['blockposition'] = daddslashes(serialize($blockdata));
DB::update('common_member_field_home', $setarr, "uid = {$space['uid']}");
showmessage('do_success', 'home.php?mod=spacecp&ac=index&op=getblock&blockname=' . $blockname, array('blockname' => $blockname));
}
if (submitcheck('diysubmit')) {
$blockdata = array();
checksecurity($_POST['spacecss']);
$spacecss = dstripslashes($_POST['spacecss']);
$spacecss = preg_replace("/(\\<|\\>)/is", '', $spacecss);
$currentlayout = getstr($_POST['currentlayout'], 5, 1, 1);
$style = empty($_POST['style']) ? '' : preg_replace("/[^0-9a-z]/i", '', $_POST['style']);
$layoutdata = dstripslashes(getgpc('layoutdata', 'P'));
require_once libfile('class/xml');
$layoutdata = xml2array($layoutdata);
if (empty($layoutdata)) {
showmessage('space_data_format_invalid');
}
$layoutdata = $layoutdata['diypage'];
if ($style && $style != 'uchomedefault') {
$cssfile = DISCUZ_ROOT . './static/space/' . $style . '/style.css';
if (!file_exists($cssfile)) {
showmessage('theme_does_not_exist');
}
}
space_merge($space, 'field_home');
示例15: smail
function smail($touid, $email, $subject, $message='', $mailtype='') {
global $_SGLOBAL, $_SCONFIG;
$cid = 0;
if($touid && $_SCONFIG['sendmailday']) {
//获得空间
$tospace = getspace($touid);
if(empty($tospace)) return false;
$sendmail = empty($tospace['sendmail'])?array():unserialize($tospace['sendmail']);
if($tospace['emailcheck'] && $tospace['email'] && $_SGLOBAL['timestamp'] - $tospace['lastlogin'] > $_SCONFIG['sendmailday']*86400 && (empty($sendmail) || !empty($sendmail[$mailtype]))) {
//获得下次发送时间
if(empty($tospace['lastsend'])) {
$tospace['lastsend'] = $_SGLOBAL['timestamp'];
}
if(!isset($sendmail['frequency'])) $sendmail['frequency'] = 604800;//1周
$sendtime = $tospace['lastsend'] + $sendmail['frequency'];
//检查是否存在当前用户队列
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('mailcron')." WHERE touid='$touid' LIMIT 1");
if($value = $_SGLOBAL['db']->fetch_array($query)) {
$cid = $value['cid'];
if($value['sendtime'] < $sendtime) $sendtime = $value['sendtime'];
updatetable('mailcron', array('email'=>addslashes($tospace['email']), 'sendtime'=>$sendtime), array('cid'=>$cid));
} else {
$cid = inserttable('mailcron', array('touid'=>$touid, 'email'=>addslashes($tospace['email']), 'sendtime'=>$sendtime), 1);
}
}
} elseif($email) {
//直接插入邮件
$email = getstr($email, 80, 1, 1);
//检查是否存在当前队列
$cid = 0;
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('mailcron')." WHERE email='$email' LIMIT 1");
if($value = $_SGLOBAL['db']->fetch_array($query)) {
$cid = $value['cid'];
} else {
$cid = inserttable('mailcron', array('email'=>$email), 1);
}
}
if($cid) {
//插入邮件内容队列
$setarr = array(
'cid' => $cid,
'subject' => addslashes(stripslashes($subject)),
'message' => addslashes(stripslashes($message)),
'dateline' => $_SGLOBAL['timestamp']
);
inserttable('mailqueue', $setarr);
}
}