From 92b35855fb28c6d23cece04daddc3b5e33fba434 Mon Sep 17 00:00:00 2001 From: Jacksiro Date: Wed, 8 Apr 2020 14:12:26 +0300 Subject: [PATCH] fixed some minor bugs --- blog-db.php | 2 +- blog-format.php | 12 +++++++----- blog-layer.php | 1 - blog-post.php | 5 ++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/blog-db.php b/blog-db.php index 96b5ec1..f1ab0a1 100644 --- a/blog-db.php +++ b/blog-db.php @@ -216,7 +216,7 @@ function bp_db_post_create($type, $userid, $cookieid, $ip, $title, $content, $pe { qa_db_query_sub( 'INSERT INTO ^blog_posts (catid, type, userid, cookieid, createip, title, content, permalink, format, tags, notify, name, created) ' . - 'VALUES (#, $, #, $, #, UNHEX($), $, $, $, $, $, $, NOW())', + 'VALUES (#, $, #, UNHEX($), $, $, $, $, $, $, $, $, NOW())', $catid, $type, $userid, $cookieid, bin2hex(@inet_pton($ip)), $title, $content, $permalink, $format, $tagstring, $notify, $name ); return qa_db_last_insert_id(); diff --git a/blog-format.php b/blog-format.php index 5a65582..30bad28 100644 --- a/blog-format.php +++ b/blog-format.php @@ -386,8 +386,6 @@ function bp_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt if ($isarticle) { if (isset($post['title'])) { - $fields['url'] = bp_p_request( $post['permalink'] ); - if (isset($options['blockwordspreg'])) $post['title'] = qa_block_words_replace($post['title'], $options['blockwordspreg']); @@ -397,11 +395,15 @@ function bp_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt } /*if (isset($post['score'])) // useful for setting match thresholds $fields['title'].=' ('.$post['score'].')';*/ - } + } else $fields['title'] = 'Untitled Article'; + + $fields['url'] = bp_p_request( $post['permalink'] ); if (isset($post['summary'])) { - $fields['content'] = substr(strip_tags($post['summary']), 0, strlen(qa_opt('bp_content_max')) ? qa_opt('bp_content_max') : 50) . ' ...'; - + $limit = strlen(qa_opt('bp_content_max')) ? qa_opt('bp_content_max') : 100; + if (strlen($post['summary']) > $limit) + $fields['content'] = substr(strip_tags($post['summary']), 0, $limit). ' ...'; + else $fields['content'] = substr(strip_tags($post['summary']), 0, $limit); } $fields['q_tags'] = array(); diff --git a/blog-layer.php b/blog-layer.php index e796c57..82bec64 100644 --- a/blog-layer.php +++ b/blog-layer.php @@ -90,7 +90,6 @@ function bp_user_articles($handle, $userhtml) if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) // check the user exists return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; - // Get information on user articles $pagesize = qa_opt('page_size_qs'); $count = (int)@$userpoints['qposts']; diff --git a/blog-post.php b/blog-post.php index e345456..1746308 100644 --- a/blog-post.php +++ b/blog-post.php @@ -197,8 +197,7 @@ public function qa_blog_write( $userid, $blog_cats ) // Check for permission error $permiterror = qa_user_maximum_permit_error('bp_permit_post_p', QA_LIMIT_QUESTIONS); - //$permiterror = bp_user_maximum_permit_error('bp_permit_post_p', QA_LIMIT_BLOG_POSTS); - //function qa_default_option($name) + $qa_content = qa_content_prepare(false, array_keys(bp_cat_path($blog_cats, @$in['catid']))); if ($permiterror) { @@ -300,7 +299,7 @@ public function qa_blog_write( $userid, $blog_cats ) $permalink = gmdate( 'Y/m/d', time() ) . '/' . $slug; $postid = bp_post_create($userid, qa_get_logged_in_handle(), $cookieid, - $in['title'], $in['content'], $permalink, $in['format'], $in['text'], isset($in['tags']) ? qa_tags_to_tagstring($in['tags']) : '', + $title, $in['content'], $permalink, $in['format'], $in['text'], isset($in['tags']) ? qa_tags_to_tagstring($in['tags']) : '', $in['notify'], $in['email'], $in['catid'], $in['extra'], $in['queued'], $in['name']); qa_redirect(bp_p_request( $permalink )); }