本文整理匯總了PHP中FORMAT::outside_url_exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP FORMAT::outside_url_exists方法的具體用法?PHP FORMAT::outside_url_exists怎麽用?PHP FORMAT::outside_url_exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FORMAT
的用法示例。
在下文中一共展示了FORMAT::outside_url_exists方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save_comment_action
public function save_comment_action()
{
if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('指定文章不存在')));
}
if ($article_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已經鎖定的文章不能回複')));
}
$message = trim($_POST['message'], "\r\n\t");
if (!$message) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入回複內容')));
}
if (strlen($message) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回複內容字數不得少於 %s 字節', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($message)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (human_valid('answer_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請填寫正確的驗證碼')));
}
// !注: 來路檢測後麵不能再放報錯提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
}
if ($this->publish_approval_valid()) {
$this->model('publish')->publish_approval('article_comment', array('article_id' => intval($_POST['article_id']), 'message' => $message, 'at_uid' => intval($_POST['at_uid'])), $this->user_id);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/article_id-' . intval($_POST['article_id']) . '__is_mobile-' . $_POST['_is_mobile'])), 1, null));
} else {
$comment_id = $this->model('publish')->publish_article_comment($_POST['article_id'], $message, $this->user_id, $_POST['at_uid']);
$url = get_js_url('/article/' . intval($_POST['article_id']) . '?item_id=' . $comment_id);
H::ajax_json_output(AWS_APP::RSM(array('url' => $url), 1, null));
}
}
示例2: modify_article_action
public function modify_article_action()
{
if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章不存在')));
}
if ($article_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章已鎖定, 不能編輯')));
}
if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_article']) {
if ($article_info['uid'] != $this->user_id) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你沒有權限編輯這個文章')));
}
}
if (!$_POST['title']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請輸入文章標題')));
}
if (get_setting('category_enable') == 'N') {
$_POST['category_id'] = 1;
}
if (!$_POST['category_id']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('請選擇文章分類')));
}
if (get_setting('question_title_limit') > 0 and cjk_strlen($_POST['title']) > get_setting('question_title_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('文章標題字數不得大於') . ' ' . get_setting('question_title_limit') . ' ' . AWS_APP::lang()->_t('字節')));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($_POST['message'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (human_valid('question_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請填寫正確的驗證碼')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($_POST['message'], $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('隻允許插入當前頁麵上傳的附件')));
}
// !注: 來路檢測後麵不能再放報錯提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('頁麵停留時間過長,或內容已提交,請刷新頁麵')));
}
$this->model('draft')->delete_draft(1, 'article', $this->user_id);
if ($_POST['do_delete'] and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('對不起, 你沒有刪除文章的權限')));
}
if ($_POST['do_delete']) {
if ($this->user_id != $article_info['uid']) {
$this->model('account')->send_delete_message($article_info['uid'], $article_info['title'], $article_info['message']);
}
$this->model('article')->remove_article($article_info['id']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/home/explore/')), 1, null));
}
$this->model('article')->update_article($article_info['id'], $_POST['title'], $_POST['message'], $_POST['topics'], $_POST['category_id'], $this->user_info['permission']['create_topic']);
if ($_POST['attach_access_key']) {
$this->model('publish')->update_attach('article', $article_info['id'], $_POST['attach_access_key']);
}
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/article/' . $article_info['id'])), 1, null));
}
示例3: update_answer_action
public function update_answer_action()
{
if (!($answer_info = $this->model('answer')->get_answer_by_id($_GET['answer_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('答案不存在')));
}
if ($_POST['do_delete']) {
if ($answer_info['uid'] != $this->user_id and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你沒有權限進行此操作')));
}
$this->model('answer')->remove_answer_by_id($_GET['answer_id']);
// 通知回複的作者
if ($this->user_id != $answer_info['uid']) {
$this->model('notify')->send($this->user_id, $answer_info['uid'], notify_class::TYPE_REMOVE_ANSWER, notify_class::CATEGORY_QUESTION, $answer_info['question_id'], array('from_uid' => $this->user_id, 'question_id' => $answer_info['question_id']));
}
$this->model('question')->save_last_answer($answer_info['question_id']);
H::ajax_json_output(AWS_APP::RSM(null, 1, null));
}
$answer_content = trim($_POST['answer_content'], "\r\n\t");
if (!$answer_content) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入回複內容')));
}
if (strlen($answer_content) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回複內容字數不得少於 %s 字節', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($answer_content)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($answer_content, $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('隻允許插入當前頁麵上傳的附件')));
}
if ($answer_info['uid'] != $this->user_id and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你沒有權限編輯這個回複')));
}
if ($answer_info['uid'] == $this->user_id and time() - $answer_info['add_time'] > get_setting('answer_edit_time') * 60 and get_setting('answer_edit_time') and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已經超過允許編輯的時限')));
}
$this->model('answer')->update_answer($_GET['answer_id'], $answer_info['question_id'], $answer_content, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('target_id' => $_GET['target_id'], 'display_id' => $_GET['display_id']), 1, null));
}
示例4: save_comment_action
public function save_comment_action()
{
if (!($article_info = $this->model('article')->get_article_info_by_id($_POST['article_id']))) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('指定文章不存在')));
}
if ($article_info['lock'] and !($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('已經鎖定的文章不能回複')));
}
$message = trim($_POST['message'], "\r\n\t");
if (!$message) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('請輸入回複內容')));
}
if (strlen($message) < get_setting('answer_length_lower')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('回複內容字數不得少於 %s 字節', get_setting('answer_length_lower'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($message)) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用戶組不允許發布站外鏈接')));
}
if ($this->publish_approval_valid($message)) {
$this->model('publish')->publish_approval('article_comment', array('article_id' => intval($_POST['article_id']), 'message' => $message, 'at_uid' => intval($_POST['at_uid'])), $this->user_id);
H::ajax_json_output(AWS_APP::RSM(null, '0', AWS_APP::lang()->_t('發布成功, 請等待管理員審核...')));
} else {
$comment_id = $this->model('publish')->publish_article_comment($_POST['article_id'], $message, $this->user_id, $_POST['at_uid']);
H::ajax_json_output(AWS_APP::RSM(array('comment_id' => $comment_id), 1, null));
}
}