当前位置: 首页>>代码示例>>PHP>>正文


PHP html2bb_video函数代码示例

本文整理汇总了PHP中html2bb_video函数的典型用法代码示例。如果您正苦于以下问题:PHP html2bb_video函数的具体用法?PHP html2bb_video怎么用?PHP html2bb_video使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了html2bb_video函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_statuses_update

function api_statuses_update(&$a, $type)
{
    if (api_user() === false) {
        logger('api_statuses_update: no user');
        return false;
    }
    logger('api_statuses_update: REQUEST ' . print_r($_REQUEST, true));
    logger('api_statuses_update: FILES ' . print_r($_FILES, true));
    // set this so that the item_post() function is quiet and doesn't redirect or emit json
    $_REQUEST['api_source'] = true;
    $user_info = api_get_user($a);
    // convert $_POST array items to the form we use for web posts.
    // logger('api_post: ' . print_r($_POST,true));
    if (requestdata('htmlstatus')) {
        require_once 'library/HTMLPurifier.auto.php';
        require_once 'include/html2bbcode.php';
        $txt = requestdata('htmlstatus');
        if (strpos($txt, '<') !== false || strpos($txt, '>') !== false) {
            $txt = html2bb_video($txt);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('Cache.DefinitionImpl', null);
            $purifier = new HTMLPurifier($config);
            $txt = $purifier->purify($txt);
        }
        $_REQUEST['body'] = html2bbcode($txt);
    } else {
        $_REQUEST['body'] = requestdata('status');
    }
    $parent = requestdata('in_reply_to_status_id');
    if (ctype_digit($parent)) {
        $_REQUEST['parent'] = $parent;
    } else {
        $_REQUEST['parent_mid'] = $parent;
    }
    if ($_REQUEST['namespace'] && $parent) {
        $x = q("select iid from item_id where service = '%s' and sid = '%s' limit 1", dbesc($_REQUEST['namespace']), dbesc($parent));
        if ($x) {
            $_REQUEST['parent'] = $x[0]['iid'];
        }
    }
    if (requestdata('lat') && requestdata('long')) {
        $_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
    }
    $_REQUEST['profile_uid'] = api_user();
    if ($parent) {
        $_REQUEST['type'] = 'net-comment';
    } else {
        $_REQUEST['type'] = 'wall';
        if (x($_FILES, 'media')) {
            $_FILES['userfile'] = $_FILES['media'];
            // upload the image if we have one
            $_REQUEST['silent'] = '1';
            //tell wall_upload function to return img info instead of echo
            require_once 'mod/wall_attach.php';
            $media = wall_attach_post($a);
            if (strlen($media) > 0) {
                $_REQUEST['body'] .= "\n\n" . $media;
            }
        }
    }
    // call out normal post function
    require_once 'mod/item.php';
    item_post($a);
    // this should output the last post (the one we just posted).
    return api_status_show($a, $type);
}
开发者ID:msooon,项目名称:hubzilla,代码行数:66,代码来源:api.php

示例2: api_statuses_update

function api_statuses_update(&$a, $type)
{
    if (api_user() === false) {
        logger('api_statuses_update: no user');
        return false;
    }
    $user_info = api_get_user($a);
    // convert $_POST array items to the form we use for web posts.
    // logger('api_post: ' . print_r($_POST,true));
    if (requestdata('htmlstatus')) {
        $txt = requestdata('htmlstatus');
        if (strpos($txt, '<') !== false || strpos($txt, '>') !== false) {
            require_once 'library/HTMLPurifier.auto.php';
            $txt = html2bb_video($txt);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('Cache.DefinitionImpl', null);
            $purifier = new HTMLPurifier($config);
            $txt = $purifier->purify($txt);
            $_REQUEST['body'] = html2bbcode($txt);
        }
    } else {
        $_REQUEST['body'] = requestdata('status');
    }
    $_REQUEST['title'] = requestdata('title');
    $parent = requestdata('in_reply_to_status_id');
    // Twidere sends "-1" if it is no reply ...
    if ($parent == -1) {
        $parent = "";
    }
    if (ctype_digit($parent)) {
        $_REQUEST['parent'] = $parent;
    } else {
        $_REQUEST['parent_uri'] = $parent;
    }
    if (requestdata('lat') && requestdata('long')) {
        $_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
    }
    $_REQUEST['profile_uid'] = api_user();
    if ($parent) {
        $_REQUEST['type'] = 'net-comment';
    } else {
        // Check for throttling (maximum posts per day, week and month)
        $throttle_day = get_config('system', 'throttle_limit_day');
        if ($throttle_day > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60);
            $r = q("SELECT COUNT(*) AS `posts_day` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_day = $r[0]["posts_day"];
            } else {
                $posts_day = 0;
            }
            if ($posts_day > $throttle_day) {
                logger('Daily posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day)));
            }
        }
        $throttle_week = get_config('system', 'throttle_limit_week');
        if ($throttle_week > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60 * 7);
            $r = q("SELECT COUNT(*) AS `posts_week` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_week = $r[0]["posts_week"];
            } else {
                $posts_week = 0;
            }
            if ($posts_week > $throttle_week) {
                logger('Weekly posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week)));
            }
        }
        $throttle_month = get_config('system', 'throttle_limit_month');
        if ($throttle_month > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60 * 30);
            $r = q("SELECT COUNT(*) AS `posts_month` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_month = $r[0]["posts_month"];
            } else {
                $posts_month = 0;
            }
            if ($posts_month > $throttle_month) {
                logger('Monthly posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month)));
            }
        }
        $_REQUEST['type'] = 'wall';
    }
    if (x($_FILES, 'media')) {
        // upload the image if we have one
        $_REQUEST['hush'] = 'yeah';
        //tell wall_upload function to return img info instead of echo
        $media = wall_upload_post($a);
        if (strlen($media) > 0) {
            $_REQUEST['body'] .= "\n\n" . $media;
        }
    }
    // To-Do: Multiple IDs
    if (requestdata('media_ids')) {
        $r = q("SELECT `resource-id`, `scale`, `nickname`, `type` FROM `photo` INNER JOIN `user` ON `user`.`uid` = `photo`.`uid` WHERE `resource-id` IN (SELECT `resource-id` FROM `photo` WHERE `id` = %d) AND `scale` > 0 AND `photo`.`uid` = %d ORDER BY `photo`.`width` DESC LIMIT 1", intval(requestdata('media_ids')), api_user());
        if ($r) {
            $phototypes = Photo::supportedTypes();
//.........这里部分代码省略.........
开发者ID:ZerGabriel,项目名称:friendica,代码行数:101,代码来源:api.php

示例3: get_atom_elements


//.........这里部分代码省略.........
            }
        }
    }
    $apps = $item->get_item_tags(NAMESPACE_STATUSNET, 'notice_info');
    if ($apps && $apps[0]['attribs']['']['source']) {
        $res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source']));
    }
    /*
     * If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
     */
    $have_real_body = false;
    $rawenv = $item->get_item_tags(NAMESPACE_DFRN, 'env');
    if ($rawenv) {
        $have_real_body = true;
        $res['body'] = $rawenv[0]['data'];
        $res['body'] = str_replace(array(' ', "\t", "\r", "\n"), array('', '', '', ''), $res['body']);
        // make sure nobody is trying to sneak some html tags by us
        $res['body'] = notags(base64url_decode($res['body']));
        // We could probably turn these old Friendica bbcode bookmarks into bookmark tags but we'd have to
        // create a term table item for them. For now just make sure they stay as links.
        $res['body'] = preg_replace('/\\[bookmark(.*?)\\](.*?)\\[\\/bookmark\\]/', '[url$1]$2[/url]', $res['body']);
    }
    $res['body'] = limit_body_size($res['body']);
    // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
    // the content type. Our own network only emits text normally, though it might have been converted to
    // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
    // have to assume it is all html and needs to be purified.
    // It doesn't matter all that much security wise - because before this content is used anywhere, we are
    // going to escape any tags we find regardless, but this lets us import a limited subset of html from
    // the wild, by sanitising it and converting supported tags to bbcode before we rip out any remaining
    // html.
    if (strpos($res['body'], '<') !== false && strpos($res['body'], '>') !== false) {
        $res['body'] = reltoabs($res['body'], $base_url);
        $res['body'] = html2bb_video($res['body']);
        $res['body'] = oembed_html2bbcode($res['body']);
        $res['body'] = purify_html($res['body']);
        $res['body'] = @html2bbcode($res['body']);
    } elseif (!$have_real_body) {
        // it's not one of our messages and it has no tags
        // so it's probably just text. We'll escape it just to be safe.
        $res['body'] = escape_tags($res['body']);
    }
    if ($res['plink'] && $res['title']) {
        $res['body'] = '#^[url=' . $res['plink'] . ']' . $res['title'] . '[/url]' . "\n\n" . $res['body'];
        $terms = array();
        $terms[] = array('otype' => TERM_OBJ_POST, 'type' => TERM_BOOKMARK, 'url' => $res['plink'], 'term' => $res['title']);
    } elseif ($res['plink']) {
        $res['body'] = '#^[url]' . $res['plink'] . '[/url]' . "\n\n" . $res['body'];
        $terms = array();
        $terms[] = array('otype' => TERM_OBJ_POST, 'type' => TERM_BOOKMARK, 'url' => $res['plink'], 'term' => $res['plink']);
    }
    $private = $item->get_item_tags(NAMESPACE_DFRN, 'private');
    if ($private && intval($private[0]['data']) > 0) {
        $res['item_private'] = intval($private[0]['data']) ? 1 : 0;
    } else {
        $res['item_private'] = 0;
    }
    $rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
    if ($rawlocation) {
        $res['location'] = unxmlify($rawlocation[0]['data']);
    }
    $rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published');
    if ($rawcreated) {
        $res['created'] = unxmlify($rawcreated[0]['data']);
    }
    $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated');
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:67,代码来源:items.php

示例4: get_atom_elements


//.........这里部分代码省略.........
        $res['dsprsig'] = unxmlify($dsig[0]['data']);
    }
    $dguid = $item->get_item_tags(NAMESPACE_DFRN, 'diaspora_guid');
    if ($dguid) {
        $res['guid'] = unxmlify($dguid[0]['data']);
    }
    $bm = $item->get_item_tags(NAMESPACE_DFRN, 'bookmark');
    if ($bm) {
        $res['bookmark'] = unxmlify($bm[0]['data']) === 'true' ? 1 : 0;
    }
    /**
     * If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
     */
    $have_real_body = false;
    $rawenv = $item->get_item_tags(NAMESPACE_DFRN, 'env');
    if ($rawenv) {
        $have_real_body = true;
        $res['body'] = $rawenv[0]['data'];
        $res['body'] = str_replace(array(' ', "\t", "\r", "\n"), array('', '', '', ''), $res['body']);
        // make sure nobody is trying to sneak some html tags by us
        $res['body'] = notags(base64url_decode($res['body']));
    }
    $res['body'] = limit_body_size($res['body']);
    // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
    // the content type. Our own network only emits text normally, though it might have been converted to
    // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
    // have to assume it is all html and needs to be purified.
    // It doesn't matter all that much security wise - because before this content is used anywhere, we are
    // going to escape any tags we find regardless, but this lets us import a limited subset of html from
    // the wild, by sanitising it and converting supported tags to bbcode before we rip out any remaining
    // html.
    if (strpos($res['body'], '<') !== false && strpos($res['body'], '>') !== false) {
        $res['body'] = reltoabs($res['body'], $base_url);
        $res['body'] = html2bb_video($res['body']);
        $res['body'] = oembed_html2bbcode($res['body']);
        $config = HTMLPurifier_Config::createDefault();
        $config->set('Cache.DefinitionImpl', null);
        // we shouldn't need a whitelist, because the bbcode converter
        // will strip out any unsupported tags.
        $purifier = new HTMLPurifier($config);
        $res['body'] = $purifier->purify($res['body']);
        $res['body'] = @html2bbcode($res['body']);
    } elseif (!$have_real_body) {
        // it's not one of our messages and it has no tags
        // so it's probably just text. We'll escape it just to be safe.
        $res['body'] = escape_tags($res['body']);
    }
    // this tag is obsolete but we keep it for really old sites
    $allow = $item->get_item_tags(NAMESPACE_DFRN, 'comment-allow');
    if ($allow && $allow[0]['data'] == 1) {
        $res['last-child'] = 1;
    } else {
        $res['last-child'] = 0;
    }
    $private = $item->get_item_tags(NAMESPACE_DFRN, 'private');
    if ($private && intval($private[0]['data']) > 0) {
        $res['private'] = intval($private[0]['data']);
    } else {
        $res['private'] = 0;
    }
    $extid = $item->get_item_tags(NAMESPACE_DFRN, 'extid');
    if ($extid && $extid[0]['data']) {
        $res['extid'] = $extid[0]['data'];
    }
    $rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
    if ($rawlocation) {
开发者ID:EmilienB,项目名称:friendica,代码行数:67,代码来源:items.php

示例5: api_statuses_update

function api_statuses_update(&$a, $type)
{
    if (local_user() === false) {
        return false;
    }
    $user_info = api_get_user($a);
    // convert $_POST array items to the form we use for web posts.
    // logger('api_post: ' . print_r($_POST,true));
    if (requestdata('htmlstatus')) {
        require_once 'library/HTMLPurifier.auto.php';
        require_once 'include/html2bbcode.php';
        $txt = requestdata('htmlstatus');
        if (strpos($txt, '<') !== false || strpos($txt, '>') !== false) {
            $txt = html2bb_video($txt);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('Cache.DefinitionImpl', null);
            $purifier = new HTMLPurifier($config);
            $txt = $purifier->purify($txt);
            $_POST['body'] = html2bbcode($txt);
        }
    } else {
        $_POST['body'] = urldecode(requestdata('status'));
    }
    $parent = requestdata('in_reply_to_status_id');
    if (ctype_digit($parent)) {
        $_POST['parent'] = $parent;
    } else {
        $_POST['parent_uri'] = $parent;
    }
    if (requestdata('lat') && requestdata('long')) {
        $_POST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
    }
    $_POST['profile_uid'] = local_user();
    if (requestdata('parent')) {
        $_POST['type'] = 'net-comment';
    } else {
        $_POST['type'] = 'wall';
    }
    // set this so that the item_post() function is quiet and doesn't redirect or emit json
    $_POST['api_source'] = true;
    // call out normal post function
    require_once 'mod/item.php';
    item_post($a);
    // this should output the last post (the one we just posted).
    return api_status_show($a, $type);
}
开发者ID:nphyx,项目名称:friendica,代码行数:46,代码来源:api.php

示例6: api_statuses_update

function api_statuses_update(&$a, $type)
{
    if (api_user() === false) {
        logger('api_statuses_update: no user');
        return false;
    }
    $user_info = api_get_user($a);
    // convert $_POST array items to the form we use for web posts.
    // logger('api_post: ' . print_r($_POST,true));
    if (requestdata('htmlstatus')) {
        require_once 'library/HTMLPurifier.auto.php';
        require_once 'include/html2bbcode.php';
        $txt = requestdata('htmlstatus');
        if (strpos($txt, '<') !== false || strpos($txt, '>') !== false) {
            $txt = html2bb_video($txt);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('Cache.DefinitionImpl', null);
            $purifier = new HTMLPurifier($config);
            $txt = $purifier->purify($txt);
            $_REQUEST['body'] = html2bbcode($txt);
        }
    } else {
        $_REQUEST['body'] = requestdata('status');
    }
    $_REQUEST['title'] = requestdata('title');
    $parent = requestdata('in_reply_to_status_id');
    if (ctype_digit($parent)) {
        $_REQUEST['parent'] = $parent;
    } else {
        $_REQUEST['parent_uri'] = $parent;
    }
    if (requestdata('lat') && requestdata('long')) {
        $_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
    }
    $_REQUEST['profile_uid'] = api_user();
    if ($parent) {
        $_REQUEST['type'] = 'net-comment';
    } else {
        //			logger("api_statuses_update: upload ".print_r($_FILES, true)." ".print_r($_POST, true)." ".print_r($_GET, true), LOGGER_DEBUG);
        //die("blubb");
        $_REQUEST['type'] = 'wall';
        if (x($_FILES, 'media')) {
            // upload the image if we have one
            $_REQUEST['hush'] = 'yeah';
            //tell wall_upload function to return img info instead of echo
            require_once 'mod/wall_upload.php';
            $media = wall_upload_post($a);
            if (strlen($media) > 0) {
                $_REQUEST['body'] .= "\n\n" . $media;
            }
        }
    }
    // set this so that the item_post() function is quiet and doesn't redirect or emit json
    $_REQUEST['api_source'] = true;
    // call out normal post function
    require_once 'mod/item.php';
    item_post($a);
    // this should output the last post (the one we just posted).
    return api_status_show($a, $type);
}
开发者ID:jzacman,项目名称:friendica,代码行数:60,代码来源:api.php

示例7: get_atom_elements


//.........这里部分代码省略.........
    if ($dguid) {
        $res['guid'] = unxmlify($dguid[0]['data']);
    }
    $bm = $item->get_item_tags(NAMESPACE_DFRN, 'bookmark');
    if ($bm) {
        $res['bookmark'] = unxmlify($bm[0]['data']) === 'true' ? 1 : 0;
    }
    /**
     * If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
     */
    $have_real_body = false;
    $rawenv = $item->get_item_tags(NAMESPACE_DFRN, 'env');
    if ($rawenv) {
        $have_real_body = true;
        $res['body'] = $rawenv[0]['data'];
        $res['body'] = str_replace(array(' ', "\t", "\r", "\n"), array('', '', '', ''), $res['body']);
        // make sure nobody is trying to sneak some html tags by us
        $res['body'] = notags(base64url_decode($res['body']));
    }
    $maxlen = get_max_import_size();
    if ($maxlen && strlen($res['body']) > $maxlen) {
        $res['body'] = substr($res['body'], 0, $maxlen);
    }
    // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
    // the content type. Our own network only emits text normally, though it might have been converted to
    // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
    // have to assume it is all html and needs to be purified.
    // It doesn't matter all that much security wise - because before this content is used anywhere, we are
    // going to escape any tags we find regardless, but this lets us import a limited subset of html from
    // the wild, by sanitising it and converting supported tags to bbcode before we rip out any remaining
    // html.
    if (strpos($res['body'], '<') !== false && strpos($res['body'], '>') !== false) {
        $res['body'] = reltoabs($res['body'], $base_url);
        $res['body'] = html2bb_video($res['body']);
        $res['body'] = oembed_html2bbcode($res['body']);
        $config = HTMLPurifier_Config::createDefault();
        $config->set('Cache.DefinitionImpl', null);
        // we shouldn't need a whitelist, because the bbcode converter
        // will strip out any unsupported tags.
        $purifier = new HTMLPurifier($config);
        $res['body'] = $purifier->purify($res['body']);
        $res['body'] = @html2bbcode($res['body']);
    } elseif (!$have_real_body) {
        // it's not one of our messages and it has no tags
        // so it's probably just text. We'll escape it just to be safe.
        $res['body'] = escape_tags($res['body']);
    }
    // this tag is obsolete but we keep it for really old sites
    $allow = $item->get_item_tags(NAMESPACE_DFRN, 'comment-allow');
    if ($allow && $allow[0]['data'] == 1) {
        $res['last-child'] = 1;
    } else {
        $res['last-child'] = 0;
    }
    $private = $item->get_item_tags(NAMESPACE_DFRN, 'private');
    if ($private && $private[0]['data'] == 1) {
        $res['private'] = 1;
    } else {
        $res['private'] = 0;
    }
    $extid = $item->get_item_tags(NAMESPACE_DFRN, 'extid');
    if ($extid && $extid[0]['data']) {
        $res['extid'] = $extid[0]['data'];
    }
    $rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
    if ($rawlocation) {
开发者ID:robhell,项目名称:friendica,代码行数:67,代码来源:items.php

示例8: api_statuses_update

function api_statuses_update(&$a, $type)
{
    if (api_user() === false) {
        logger('api_statuses_update: no user');
        return false;
    }
    $user_info = api_get_user($a);
    // convert $_POST array items to the form we use for web posts.
    // logger('api_post: ' . print_r($_POST,true));
    if (requestdata('htmlstatus')) {
        require_once 'library/HTMLPurifier.auto.php';
        require_once 'include/html2bbcode.php';
        $txt = requestdata('htmlstatus');
        if (strpos($txt, '<') !== false || strpos($txt, '>') !== false) {
            $txt = html2bb_video($txt);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('Cache.DefinitionImpl', null);
            $purifier = new HTMLPurifier($config);
            $txt = $purifier->purify($txt);
            $_REQUEST['body'] = html2bbcode($txt);
        }
    } else {
        $_REQUEST['body'] = requestdata('status');
    }
    $_REQUEST['title'] = requestdata('title');
    $parent = requestdata('in_reply_to_status_id');
    if (ctype_digit($parent)) {
        $_REQUEST['parent'] = $parent;
    } else {
        $_REQUEST['parent_uri'] = $parent;
    }
    if (requestdata('lat') && requestdata('long')) {
        $_REQUEST['coord'] = sprintf("%s %s", requestdata('lat'), requestdata('long'));
    }
    $_REQUEST['profile_uid'] = api_user();
    if ($parent) {
        $_REQUEST['type'] = 'net-comment';
    } else {
        // Check for throttling (maximum posts per day, week and month)
        $throttle_day = get_config('system', 'throttle_limit_day');
        if ($throttle_day > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60);
            $r = q("SELECT COUNT(*) AS `posts_day` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_day = $r[0]["posts_day"];
            } else {
                $posts_day = 0;
            }
            if ($posts_day > $throttle_day) {
                logger('Daily posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Daily posting limit of %d posts reached. The post was rejected."), $throttle_day)));
            }
        }
        $throttle_week = get_config('system', 'throttle_limit_week');
        if ($throttle_week > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60 * 7);
            $r = q("SELECT COUNT(*) AS `posts_week` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_week = $r[0]["posts_week"];
            } else {
                $posts_week = 0;
            }
            if ($posts_week > $throttle_week) {
                logger('Weekly posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Weekly posting limit of %d posts reached. The post was rejected."), $throttle_week)));
            }
        }
        $throttle_month = get_config('system', 'throttle_limit_month');
        if ($throttle_month > 0) {
            $datefrom = date("Y-m-d H:i:s", time() - 24 * 60 * 60 * 30);
            $r = q("SELECT COUNT(*) AS `posts_month` FROM `item` WHERE `uid`=%d AND `wall`\n\t\t\t\t\tAND `created` > '%s' AND `id` = `parent`", intval(api_user()), dbesc($datefrom));
            if ($r) {
                $posts_month = $r[0]["posts_month"];
            } else {
                $posts_month = 0;
            }
            if ($posts_month > $throttle_month) {
                logger('Monthly posting limit reached for user ' . api_user(), LOGGER_DEBUG);
                die(api_error($a, $type, sprintf(t("Monthly posting limit of %d posts reached. The post was rejected."), $throttle_month)));
            }
        }
        $_REQUEST['type'] = 'wall';
    }
    if (x($_FILES, 'media')) {
        // upload the image if we have one
        $_REQUEST['hush'] = 'yeah';
        //tell wall_upload function to return img info instead of echo
        require_once 'mod/wall_upload.php';
        $media = wall_upload_post($a);
        if (strlen($media) > 0) {
            $_REQUEST['body'] .= "\n\n" . $media;
        }
    }
    // set this so that the item_post() function is quiet and doesn't redirect or emit json
    $_REQUEST['api_source'] = true;
    if (!x($_REQUEST, "source")) {
        $_REQUEST["source"] = api_source();
    }
    // call out normal post function
    require_once 'mod/item.php';
//.........这里部分代码省略.........
开发者ID:strk,项目名称:friendica,代码行数:101,代码来源:api.php


注:本文中的html2bb_video函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。