本文整理汇总了PHP中settings::getMark方法的典型用法代码示例。如果您正苦于以下问题:PHP settings::getMark方法的具体用法?PHP settings::getMark怎么用?PHP settings::getMark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings::getMark方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reply
public function reply()
{
include_once ROOT_DIR . 'lib/class/settings.class.php';
$setting = new settings();
$result_setttings = $setting->getMark('mblog_comment');
if (!empty($result_setttings) && $result_setttings['state']) {
$this->errorOutput('评论回复已关闭');
}
$userinfo = $this->mUser->verify_credentials();
if (!$userinfo['id']) {
$this->errorOutput(USENAME_NOLOGIN);
}
$status_id = intval($this->input['status_id']);
$cid = intval($this->input['cid']);
$text = urldecode($this->input['text']);
(!$status_id || !$text) && $this->errorOutput(OBJECT_NULL);
//点滴id为空就返回错误
$time = time();
$query_info = $this->db->query_first('SELECT member_id FROM ' . DB_PREFIX . 'status_comments WHERE id = ' . $cid);
!$query_info && $this->errorOutput(OBJECT_NULL);
$sql = 'INSERT INTO ' . DB_PREFIX . 'status_comments ( status_id , member_id , content , comment_time , reply_comment_id , reply_member_id )
VALUES(' . $status_id . ', ' . $userinfo['id'] . ', "' . $text . '" , "' . $time . '" , ' . $cid . ',' . $query_info['member_id'] . ')';
$this->db->query($sql);
$insert_id = $this->db->insert_id();
$query_info = $this->db->query_first('SELECT member_id FROM ' . DB_PREFIX . 'status_comments WHERE status_id = ' . $status_id . ' AND id = ' . $cid);
//将该条点滴的评论次数加1
$this->db->query('UPDATE ' . DB_PREFIX . 'status_extra SET comment_count = comment_count + 1 WHERE status_id = ' . $status_id);
$members = $this->mUser->getUserById($userinfo['id']);
$members = $members[0];
$status = $this->mStatus->show($status_id);
$return_array = array('id' => $insert_id, 'text' => $text, 'create_at' => $time, 'reply_member_id' => $query_info['member_id'], 'reply_comment_id' => $cid, 'status' => $status[0], 'user' => $members);
if ($userinfo['id'] != $query_info['member_id'] && $userinfo['id'] != $status[0]['user']['id']) {
$notify_userid = $query_info['member_id'] . ',' . $status[0]['user']['id'];
//加通知
include_once ROOT_PATH . 'lib/class/notify.class.php';
$notify = new notify();
$content = array('title' => '新回复', 'page_link' => SNS_MBLOG . 'all_comment.php');
$content = serialize($content);
$notyfy_arr = $notify->notify_send($notify_userid, $content, 2);
//发新评论通知
}
$this->addItem($return_array);
$this->output();
}
示例2: deal_upload
/**
* 上传处理
*/
public function deal_upload()
{
include_once ROOT_DIR . 'lib/class/settings.class.php';
$setting = new settings();
$result_setttings = $setting->getMark('video');
if (!empty($result_setttings) && $result_setttings['state']) {
echo '视频发布已关闭';
}
$video_path = $_FILES['videofile']['tmp_name'];
//视频的在本地的目录
$file_name = basename($_FILES['videofile']['name']);
//视频的文件
$file_size = $_FILES['videofile']['size'];
//视频的大小
$video_name = trim($this->input['video_name']);
//视频名称
$video_brief = trim($this->input['video_brief']);
//视频简介
$video_tags = trim($this->input['video_tags']);
//视频标签
$video_sort = $this->input['video_sort'];
//视频分类
$video_copyright = $this->input['video_copyright'];
//视频版权
include_once ROOT_PATH . 'lib/class/curl.class.php';
$this->curl = new curl();
$this->curl->setSubmitType('post');
$this->curl->setReturnFormat('json');
$this->curl->initPostData();
$this->curl->addRequestData('a', 'deal_upload');
$this->curl->addRequestData('video_path', $video_path);
$this->curl->addFile($_FILES);
$this->curl->addRequestData('file_name', $file_name);
$this->curl->addRequestData('file_size', $file_size);
$this->curl->addRequestData('video_name', $video_name);
$this->curl->addRequestData('video_brief', $video_brief);
$this->curl->addRequestData('video_tags', $video_tags);
$this->curl->addRequestData('video_sort', $video_sort);
$this->curl->addRequestData('video_copyright', $video_copyright);
$r = $this->curl->request('video/upload_video.php');
echo $r;
}
示例3: comment
public function comment()
{
include_once ROOT_DIR . 'lib/class/settings.class.php';
$setting = new settings();
$result_setttings = $setting->getMark('mblog_comment');
if (!empty($result_setttings) && $result_setttings['state']) {
$this->errorOutput('评论已关闭');
}
$userinfo = $this->mUser->verify_credentials();
if (!$userinfo['id']) {
$this->errorOutput(USENAME_NOLOGIN);
}
$id = $this->input['id'];
$content = urldecode($this->input['content']);
include_once ROOT_DIR . 'lib/class/banword.class.php';
$banword = new banword();
$status = 0;
$banwords = $banword->banword(urlencode($content));
if ($banwords && $banwords != 'null') {
$status = 1;
$banwords = implode(',', $banwords);
} else {
$banwords = '';
}
//此ID没有用处
$cid = intval($this->input['cid']);
$time = time();
!$cid ? $and = '' : ($and = ' , reply_comment_id = ' . $cid);
$sql = 'INSERT INTO ' . DB_PREFIX . 'status_comments SET status_id = ' . $id . ', flag = ' . $status . ',member_id = ' . $userinfo['id'] . ',content = "' . $content . '",comment_time = "' . $time . '",ip = "' . hg_getip() . '"';
$sql .= $and;
$this->setXmlNode('comments', 'comment');
/**
* 获取该条点滴的用户ID
*/
$this->curl->setSubmitType('post');
$this->curl->setReturnFormat('json');
$this->curl->addRequestData('status_id', $id);
$user_id = $this->curl->request('statuses/getUserIdByStatusId.php');
/**
* 获取该用户的权限
*/
$this->curl->setSubmitType('post');
$this->curl->setReturnFormat('json');
$this->curl->addRequestData('id', $user_id);
$tmp = $this->curl->request('users/get_authority.php');
$authority = $tmp[0];
//评论权限
$comment_authority = intval($authority[18]);
/**
* 获取与该用户的关系
*/
$this->curl->setSubmitType('post');
$this->curl->setReturnFormat('json');
$this->curl->addRequestData('source_id', $userinfo['id']);
$this->curl->addRequestData('target_id', $user_id);
$relation = $this->curl->request('friendships/show.php');
//任何人可评论
if ($comment_authority == 0) {
$this->db->query($sql);
}
//关注的人可评论
if ($comment_authority == 1) {
//关注
if ($relation == 3 || $relation == 1) {
$this->db->query($sql);
} else {
$this->errorOutput(NO_AUTHORITY);
}
}
//任何人不可评论
if ($comment_authority == 2) {
$this->errorOutput(NO_AUTHORITY);
}
// $this->db->query($sql);
$insert_id = $this->db->insert_id();
$members = $this->mUser->getUserById($userinfo['id']);
//评论者的信息数组
$members = $members[0];
//将点滴的评论次数加1
$sql_str = 'UPDATE ' . DB_PREFIX . 'status_extra SET comment_count = comment_count + 1 WHERE status_id = ' . $id;
$this->db->query($sql_str);
$status_info = $this->mStatus->show($id);
$return_array = array('id' => $insert_id, 'text' => $content, 'create_at' => $time, 'user' => $members, 'status' => $status_info[0]);
$this->addItem($return_array);
$this->output();
}
示例4: update
/**
* 发布一条点滴信息
*/
public function update()
{
include_once ROOT_DIR . 'lib/class/settings.class.php';
$setting = new settings();
$result_setttings = $setting->getMark('mblog');
if (!empty($result_setttings) && $result_setttings['state']) {
$this->errorOutput('微博发布已关闭');
}
$userinfo['id'] = $this->input['user_id'] ? $this->input['user_id'] : ($this->user['user_id'] ? $this->user['user_id'] : 0);
if (empty($userinfo['id'])) {
$this->errorOutput(USENAME_NOLOGIN);
}
$text = urldecode($this->input['text']);
$source = urldecode($this->input['source']);
if (intval($source) == 1) {
$source = 'iphone客户端';
} elseif (intval($source) == 2) {
$source = 'Android客户端';
}
if ($this->input['id']) {
$id = $this->input['id'];
$sql = "SELECT * \r\n\t\t\t\tFROM " . DB_PREFIX . "status s\r\n\t\t\t\tLEFT JOIN " . DB_PREFIX . "status_extra e ON e.status_id = s.id WHERE id = " . $id;
$query = $this->db->query($sql);
$statusinfo = $this->db->fetch_array($query);
$last_userid = $statusinfo['member_id'];
$reply_status_id = $statusinfo['reply_status_id'];
$reply_user_id = $statusinfo['reply_user_id'];
if (!$statusinfo) {
$this->errorOutput(OBJECT_NULL);
//对象为空
}
$sql = "SELECT transmit_count,reply_count,reply_status_id,reply_user_id\r\n\t\t\t\t\tFROM " . DB_PREFIX . "status s \r\n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "status_extra e \r\n\t\t\t\t\tON e.status_id = s.id \r\n\t\t\t\t\tWHERE status_id = " . $id;
$first = $this->db->query_first($sql);
$textF = explode("//", $text);
if (empty($textF[0])) {
//更新扩展表中的转发次数
$info = array('member_id' => $userinfo['id'], 'text' => $text, 'create_at' => TIMENOW, 'ip' => hg_getip(), 'location' => '地址', 'status' => $status, 'source' => $source);
$statusinfo = $this->insert($info, 1);
if (!$statusinfo) {
return false;
} else {
$transmit_count = $first['transmit_count'] + 1;
$sql = "UPDATE " . DB_PREFIX . "status_extra \r\n\t\t\t\t\tSET \r\n\t\t\t\t\t\ttransmit_count = " . $transmit_count . " \r\n\t\t\t\t\tWHERE status_id = " . $id;
$this->db->query($sql);
$this->verify($statusinfo['text'], $statusinfo['id']);
if ($reply_status_id) {
$sql = "UPDATE " . DB_PREFIX . "status \r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\treply_status_id = " . $reply_status_id . ",\r\n\t\t\t\t\t\t\treply_user_id = " . $reply_user_id . " \r\n\t\t\t\t\t\tWHERE id = " . $statusinfo['id'];
$this->db->query($sql);
$statusinfo['reply_status_id'] = $reply_status_id;
$statusinfo['reply_user_id'] = $reply_user_id;
$sql = "UPDATE " . DB_PREFIX . "status_extra \r\n\t\t\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\t\t\ttransmit_count = transmit_count+1 \r\n\t\t\t\t\t\t\t\tWHERE status_id = " . $reply_status_id;
$this->db->query($sql);
} else {
$sql = "UPDATE " . DB_PREFIX . "status \r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\treply_status_id = " . $id . ",\r\n\t\t\t\t\t\t\treply_user_id = " . $last_userid . " \r\n\t\t\t\t\t\tWHERE id = " . $statusinfo['id'];
$this->db->query($sql);
$statusinfo['reply_status_id'] = $id;
$statusinfo['reply_user_id'] = $last_userid;
}
$statusinfo['transmit_count'] = $transmit_count;
$this->setXmlNode('status', 'info');
$this->addItem($statusinfo);
return $this->output();
}
} else {
//更新扩展表的回复次数
if (mb_strlen($text) <= WORDS_NUM) {
$info = $this->verifyUrlBanword($text, $userinfo['id'], $source);
$statusinfo = $this->insert($info);
if (!$statusinfo) {
$this->errorOutput(FAILED);
} else {
$reply_count = $first['reply_count'] + 1;
$sql = "UPDATE " . DB_PREFIX . "status_extra \r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\treply_count = " . $reply_count . " \r\n\t\t\t\t\t\tWHERE status_id = " . $id;
$this->db->query($sql);
$this->verify($statusinfo['text'], $statusinfo['id']);
if ($reply_status_id) {
$sql = "UPDATE " . DB_PREFIX . "status \r\n\t\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\t\treply_status_id = " . $reply_status_id . ",\r\n\t\t\t\t\t\t\t\treply_user_id = " . $reply_user_id . " \r\n\t\t\t\t\t\t\tWHERE id = " . $statusinfo['id'];
$this->db->query($sql);
$statusinfo['reply_status_id'] = $reply_status_id;
$statusinfo['reply_user_id'] = $reply_user_id;
$sql = "UPDATE " . DB_PREFIX . "status_extra \r\n\t\t\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\t\t\treply_count = reply_count + 1 \r\n\t\t\t\t\t\t\t\tWHERE status_id = " . $reply_status_id;
$this->db->query($sql);
} else {
$sql = "UPDATE " . DB_PREFIX . "status \r\n\t\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\t\treply_status_id = " . $id . ",\r\n\t\t\t\t\t\t\t\treply_user_id = " . $last_userid . " \r\n\t\t\t\t\t\t\tWHERE id = " . $statusinfo['id'];
$this->db->query($sql);
$statusinfo['reply_status_id'] = $id;
$statusinfo['reply_user_id'] = $last_userid;
}
$statusinfo['reply_count'] = $reply_count;
$this->setXmlNode('status', 'info');
$this->addItem($statusinfo);
return $this->output();
}
} else {
$this->errorOutput(FAILED);
}
}
//.........这里部分代码省略.........