本文整理汇总了PHP中vB::getCleaner方法的典型用法代码示例。如果您正苦于以下问题:PHP vB::getCleaner方法的具体用法?PHP vB::getCleaner怎么用?PHP vB::getCleaner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB
的用法示例。
在下文中一共展示了vB::getCleaner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_upload_avatar
function do_upload_avatar()
{
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('upload' => vB_Cleaner::TYPE_FILE));
if (empty($cleaned['upload'])) {
return json_error(ERR_NO_PERMISSION);
}
$upload_result = vB_Api::instance('profile')->upload($cleaned['upload']);
if (!empty($upload_result['errors'])) {
return json_error(ERR_NO_PERMISSION);
}
return true;
}
示例2: message
public function message($message, $userid)
{
$cleaner = vB::getCleaner();
$message = $cleaner->clean($message, vB_Cleaner::TYPE_STR);
$userid = $cleaner->clean($userid, vB_Cleaner::TYPE_STR);
$parentid = vB_Api::instanceInternal('node')->fetchVMChannel();
$data = array('title' => '(Untitled)', 'parentid' => $parentid, 'channelid' => '', 'nodeid' => '', 'setfor' => $userid, 'rawtext' => $message);
$result = vB_Api::instanceInternal('content_text')->add($data, array('wysiwyg' => false));
if (!empty($result['errors'])) {
return array('response' => array('postpreview' => array('invalidid')));
}
return array('response' => array('errormessage' => array('visitormessagethanks')));
}
示例3: facebook
/**
* Login with fabecook logged user
*
* @param [string] $signed_request [fb info]
* @return [array] [response -> errormessage and session params]
*/
public function facebook($signed_request)
{
$cleaner = vB::getCleaner();
$signed_request = $cleaner->clean($signed_request, vB_Cleaner::TYPE_STR);
$user_api = vB_Api::instance('user');
$loginInfo = $user_api->loginExternal('facebook', array('signedrequest' => $signed_request));
if (empty($loginInfo) || isset($loginInfo['errors'])) {
//the api doesn't allow us to be that specific about our errors here.
//and the app gets very cranky if the login returns an unexpected error code
return array('response' => array('errormessage' => array('badlogin_facebook')));
}
$result = array('session' => array('dbsessionhash' => $loginInfo['login']['sessionhash'], 'userid' => $loginInfo['login']['userid']), 'response' => array('errormessage' => array('redirect_login')));
return $result;
}
示例4: editpost
public function editpost($postid)
{
$cleaner = vB::getCleaner();
$postid = $cleaner->clean($postid, vB_Cleaner::TYPE_UINT);
$post = vB_Api::instance('node')->getFullContentforNodes(array($postid));
if (empty($post)) {
return array("response" => array("errormessage" => array("invalidid")));
}
$post = $post[0];
$prefixes = vB_Library::instance('vb4_functions')->getPrefixes($postid);
$options = vB::getDatastore()->getValue('options');
$out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()));
return $out;
}
示例5: getVbfromfacebook
/**
* Returns list of vbUser info about the list of facebook user ids
* @param [string] $facebookidList [Comma separated list of Facebook user ids]
* @return [array] $usersArray [Array of the userInfo for the required userids]
*/
public function getVbfromfacebook($facebookidList)
{
$cleaner = vB::getCleaner();
$facebookidList = $cleaner->clean($facebookidList, vB_Cleaner::TYPE_STR);
$usersArray = array();
$listIds = explode(',', $facebookidList);
$users = vB::getDbAssertor()->getRows('user', array('fbuserid' => $listIds));
if (!empty($users) || !isset($users['errors'])) {
foreach ($users as $user) {
$usersArray[] = array('userid' => $user['userid'], 'username' => $user['username'], 'fbuserid' => $user['fbuserid']);
}
}
return $usersArray;
}
示例6: docopythread
public function docopythread($threadid, $destforumid)
{
$cleaner = vB::getCleaner();
$threadid = $cleaner->clean($threadid, vB_Cleaner::TYPE_UINT);
$destforumid = $cleaner->clean($destforumid, vB_Cleaner::TYPE_UINT);
if (empty($threadid) || empty($destforumid)) {
return array('response' => array('errormessage' => 'invalidid'));
}
$result = vB_Api::instance('node')->cloneNodes(array($threadid), $destforumid);
if ($result === null || isset($result['errors'])) {
return vB_Library::instance('vb4_functions')->getErrorResponse($result);
} else {
return array('response' => array('errormessage' => array('redirect_movethread')));
}
}
示例7: do_get_announcement
function do_get_announcement()
{
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('forumid' => vB_Cleaner::TYPE_UINT));
if (!isset($cleaned['forumid']) || $cleaned['forumid'] < 1) {
return json_error(ERR_NO_PERMISSION);
}
$result = vB_Api::instance('announcement')->fetch($cleaned['forumid']);
if ($result === null || isset($result['errors'])) {
return json_error(ERR_NO_PERMISSION);
}
$posts = array();
foreach ($result as $ann) {
$posts[] = fr_parse_post($ann);
}
return array('posts' => $posts, 'total_posts' => count($posts));
}
示例8: do_subscribe_thread
function do_subscribe_thread()
{
$userinfo = vB_Api::instance('user')->fetchUserInfo();
if ($userinfo['userid'] < 1) {
return json_error(ERR_NO_PERMISSION);
}
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('threadid' => vB_Cleaner::TYPE_UINT));
if (empty($cleaned['threadid'])) {
return json_error(ERR_INVALID_SUB);
}
$result = vB_Api::instance('follow')->add($cleaned['threadid'], vB_Api_Follow::FOLLOWTYPE_CONTENT);
if (empty($result) || !empty($result['errors'])) {
return json_error(ERR_INVALID_SUB);
}
return true;
}
示例9: do_post_edit
function do_post_edit()
{
$userinfo = vB_Api::instance('user')->fetchUserInfo();
if ($userinfo['userid'] < 1) {
return json_error(ERR_NO_PERMISSION);
}
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('postid' => vB_Cleaner::TYPE_UINT, 'message' => vB_Cleaner::TYPE_STR, 'poststarttime' => vB_Cleaner::TYPE_UINT, 'hvinput' => fr_get_hvtoken()));
if (empty($cleaned['postid']) || empty($cleaned['message'])) {
return json_error(ERR_NO_PERMISSION);
}
fr_do_attachment($cleaned['postid'], $cleaned['poststarttime']);
$result = vB_Api::instance('content_text')->update($cleaned['postid'], array('rawtext' => fr_process_message($cleaned['message'])));
if (empty($result) || !empty($result['errors'])) {
return json_error(ERR_INVALID_THREAD);
}
return true;
}
示例10: sendemail
public function sendemail($postid, $reason)
{
$cleaner = vB::getCleaner();
$postid = $cleaner->clean($postid, vB_Cleaner::TYPE_UINT);
$reason = $cleaner->clean($reason, vB_Cleaner::TYPE_STR);
if (empty($postid)) {
return array('response' => array('errormessage' => array('invalidid')));
}
if (empty($reason)) {
return array('response' => array('errormessage' => array('invalidid')));
}
$userinfo = vB_Api::instance('user')->fetchUserinfo();
$data = array('reportnodeid' => $postid, 'rawtext' => $reason, 'created' => vB::getRequest()->getTimeNow(), 'userid' => $userinfo['userid'], 'authorname' => $userinfo['username']);
$result = vB_Api::instance('content_report')->add($data, array('wysiwyg' => false));
if ($result === null || isset($result['errors'])) {
return vB_Library::instance('vb4_functions')->getErrorResponse($result);
}
return array('response' => array('errormessage' => array('redirect_reportthanks')));
}
示例11: newthread
public function newthread($forumid)
{
$cleaner = vB::getCleaner();
$forumid = $cleaner->clean($forumid, vB_Cleaner::TYPE_UINT);
$forum = vB_Api::instance('node')->getFullContentforNodes(array($forumid));
if (empty($forum)) {
return array("response" => array("errormessage" => array("invalidid")));
}
$forum = $forum[0];
$foruminfo = vB_Library::instance('vb4_functions')->parseForumInfo($forum);
$prefixes = vB_Library::instance('vb4_functions')->getPrefixes($forumid);
$options = vB::getDatastore()->getValue('options');
$postattachment = $forum['content']['createpermissions']['vbforum_attach'];
$postattachment = empty($postattachment) ? 0 : intval($postattachment);
$usercontext = vB::getUserContext($this->currentUserId);
$maxtags = $usercontext->getChannelLimits($forumid, 'maxstartertags');
$out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars'], 'maxtags' => $maxtags), 'response' => array('forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'foruminfo' => $foruminfo, 'poststarttime' => vB::getRequest()->getTimeNow(), 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()));
return $out;
}
示例12: newreply
public function newreply($threadid, $disablesmilies = false)
{
$cleaner = vB::getCleaner();
$threadid = $cleaner->clean($threadid, vB_Cleaner::TYPE_UINT);
$thread = vB_Api::instance('node')->getFullContentforNodes(array($threadid));
if (empty($thread)) {
return array("response" => array("errormessage" => array("invalidid")));
}
$thread = $thread[0];
$prefixes = vB_Library::instance('vb4_functions')->getPrefixes($threadid);
$options = vB::getDatastore()->getValue('options');
$postattachment = $thread['content']['createpermissions']['vbforum_attach'];
$postattachment = empty($postattachment) ? 0 : intval($postattachment);
/*
additional options' checked checkboxes array...
*/
$checked = array('parseurl' => 1, 'signature' => "", "subscribe" => $thread['content']['subscribed']);
// SIGNATURE
$userContext = vB::getUserContext();
$currentUserId = $userContext->fetchUserId();
$signature = vB_Api::instanceInternal('user')->fetchSignature($currentUserId);
if (!empty($signature)) {
$checked['signature'] = 1;
}
// DISABLESMILIES
// getDataForParse converts channel.options into bbcodeoptions, and this is used by the
// frontend nodetext / bbcode parsers
$textDataArray = vB_Api::instanceInternal('content_text')->getDataForParse(array($threadid));
$channelAllowsSmilies = $textDataArray[$threadid]['bbcodeoptions']['allowsmilies'];
if ($channelAllowsSmilies) {
if (!empty($disablesmilies)) {
$checked['disablesmilies'] = 1;
} else {
$checked['disablesmilies'] = "";
}
$show['smiliebox'] = 1;
} else {
$show['smiliebox'] = 0;
}
$out = array('show' => array('tag_option' => 1, 'smiliebox' => $show['smiliebox']), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('title' => '', 'forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()), 'checked' => $checked);
return $out;
}
示例13: do_get_forum_data
function do_get_forum_data()
{
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('forumids' => vB_Cleaner::TYPE_STR));
if (!isset($cleaned['forumids']) || strlen($cleaned['forumids']) == 0) {
return array('forums' => array());
}
$forumids = explode(',', $cleaned['forumids']);
$forum_data = array();
foreach ($forumids as $forumid) {
$forum = fr_get_and_parse_forum($forumid);
if ($forum != null) {
$forum_data[] = $forum;
}
}
if (!empty($forum_data)) {
return array('forums' => $forum_data);
} else {
return null;
}
}
示例14: do_delete_attachment
function do_delete_attachment()
{
$userinfo = vB_Api::instance('user')->fetchUserInfo();
if ($userinfo['userid'] < 1) {
return json_error(ERR_NO_PERMISSION);
}
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('attachmentid' => vB_Cleaner::TYPE_UINT));
if (empty($cleaned['attachmentid'])) {
return json_error(ERR_NO_PERMISSION);
}
$fr_attach = vB_dB_Assertor::instance()->assertQuery('ForumRunner:getAttachmentMarkerById', array('id' => $cleaned['attachmentid']));
if (empty($fr_attach)) {
return json_error(ERR_NO_PERMISSION);
}
$result = vB_Api::instance('content_attach')->deleteAttachment($fr_attach['attachmentid']);
if (empty($result) || !empty($result['errors'])) {
return json_error(ERR_NO_PERMISSION);
}
vB_dB_Assertor::instance()->assertQuery('ForumRunner:deleteAttachmentMarker', array('id' => $cleaned['attachmentid']));
return true;
}
示例15: __construct
public function __construct(&$routeInfo, &$matches, &$queryString = '')
{
$cleaner = vB::getCleaner();
if (isset($matches['params']) and !empty($matches['params'])) {
$paramString = strpos($matches['params'], '/') === 0 ? substr($matches['params'], 1) : $matches['params'];
list($this->userid) = explode('/', $paramString);
} else {
if (isset($matches['userid'])) {
$this->userid = $matches['userid'];
}
}
$this->userid = $cleaner->clean($this->userid, vB_Cleaner::TYPE_INT);
$routeInfo['arguments']['subtemplate'] = $this->subtemplate;
$userid = vB::getCurrentSession()->get('userid');
$pmquota = vB::getUserContext($userid)->getLimit('pmquota');
$vboptions = vB::getDatastore($userid)->getValue('options');
$canUsePmSystem = ($vboptions['enablepms'] and $pmquota);
if (!$canUsePmSystem) {
throw new vB_Exception_NodePermission('privatemessage');
}
}