aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorthe_systech <the_systech@users.sourceforge.net>2001-08-08 19:42:45 +0000
committerthe_systech <the_systech@users.sourceforge.net>2001-08-08 19:42:45 +0000
commit15f471cb5a6e3385d4f6cb9e72bcd26eb959b200 (patch)
tree7fb88608601c337c6d0484254d3c573e5fe610c1 /phpBB
parenteb081dcb0fbae5aa8989424937699129654ab7a1 (diff)
downloadforums-15f471cb5a6e3385d4f6cb9e72bcd26eb959b200.tar
forums-15f471cb5a6e3385d4f6cb9e72bcd26eb959b200.tar.gz
forums-15f471cb5a6e3385d4f6cb9e72bcd26eb959b200.tar.bz2
forums-15f471cb5a6e3385d4f6cb9e72bcd26eb959b200.tar.xz
forums-15f471cb5a6e3385d4f6cb9e72bcd26eb959b200.zip
Changes encorporate smily processing...
git-svn-id: file:///svn/phpbb/trunk@818 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/db/mssql_schema.sqlbin40176 -> 40252 bytes
-rw-r--r--phpBB/db/mysql_schema.sql3
-rw-r--r--phpBB/db/postgres_schema.sql1
-rw-r--r--phpBB/posting.php12
-rw-r--r--phpBB/viewtopic.php31
5 files changed, 33 insertions, 14 deletions
diff --git a/phpBB/db/mssql_schema.sql b/phpBB/db/mssql_schema.sql
index 9b218b0ab9..48f5239e15 100644
--- a/phpBB/db/mssql_schema.sql
+++ b/phpBB/db/mssql_schema.sql
Binary files differ
diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql
index d01d6c5d6a..3492960bad 100644
--- a/phpBB/db/mysql_schema.sql
+++ b/phpBB/db/mysql_schema.sql
@@ -203,7 +203,8 @@ CREATE TABLE phpbb_posts (
post_username varchar(30),
bbcode_uid char(10) NOT NULL,
post_edit_time int(11),
- post_edit_count smallint(4) DEFAULT '0' NOT NULL,
+ post_edit_count smallint(4) DEFAULT '0' NOT NULL,
+ enable_smiles smallint(4) DEFAULT '1' NOT NULL,
PRIMARY KEY (post_id),
KEY forum_id (forum_id),
KEY topic_id (topic_id),
diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql
index cf49def9b3..68a33d387e 100644
--- a/phpBB/db/postgres_schema.sql
+++ b/phpBB/db/postgres_schema.sql
@@ -210,6 +210,7 @@ CREATE TABLE phpbb_posts (
bbcode_uid varchar(10) DEFAULT '' NOT NULL,
post_edit_time int4,
post_edit_count int2 DEFAULT '0' NOT NULL,
+ enable_smiles int2 DEFAULT '1' NOT NULL,
CONSTRAINT phpbb_posts_pkey PRIMARY KEY (post_id)
);
CREATE INDEX forum_id_phpbb_posts_index ON phpbb_posts (forum_id);
diff --git a/phpBB/posting.php b/phpBB/posting.php
index f8d5e24209..e0ca2d55d9 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -445,7 +445,6 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
else if($mode == "newtopic")
{
$topic_notify = ($HTTP_POST_VARS['notify']) ? 1 : 0;
-
$sql = "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_notify, topic_status, topic_type)
VALUES ('$subject', " . $userdata['user_id'] . ", " . $topic_time . ", $forum_id, $topic_notify, " . TOPIC_UNLOCKED . ", $topic_type)";
@@ -461,8 +460,9 @@ if( ($mode == "newtopic" || $mode == "reply") && $topic_status == TOPIC_UNLOCKED
if($mode == "reply" || ( $mode == "newtopic" && $result ) )
{
- $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid)
- VALUES ($new_topic_id, $forum_id, " . $userdata['user_id'] . ", '$username', $topic_time, '$user_ip', '$bbcode_uid')";
+ $enable_smiles = ($smile_on) ? 1 : 0;
+ $sql = "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, bbcode_uid, enable_smiles)
+ VALUES ($new_topic_id, $forum_id, " . $userdata['user_id'] . ", '$username', $topic_time, '$user_ip', '$bbcode_uid', $enable_smiles)";
if($mode == "reply")
{
$result = $db->sql_query($sql, BEGIN_TRANSACTION);
@@ -831,9 +831,9 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
{
$edited_sql = "";
}
-
+ $enable_smiles = ($smile_on) ? 1 : 0;
$sql = "UPDATE " . POSTS_TABLE . "
- SET bbcode_uid = '$bbcode_uid'" . $edited_sql . "
+ SET bbcode_uid = '$bbcode_uid', enable_smiles=$enable_smiles" . $edited_sql . "
WHERE post_id = $post_id";
if($db->sql_query($sql, BEGIN_TRANSACTION))
@@ -1273,4 +1273,4 @@ $template->pparse("body");
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
-?> \ No newline at end of file
+?>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index a733077ae0..1c8e4b89f1 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -27,12 +27,16 @@ include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
-//
+// Begin function to parse Smilies :)
//
function smilies_pass($message)
{
global $db, $smilies_url;
static $smilies;
+ if(empty($smilies_url))
+ {
+ $smilies_url = "images/smilies";
+ }
if(empty($smilies))
{
@@ -46,12 +50,20 @@ function smilies_pass($message)
for($i = 0; $i < count($smilies); $i++)
{
- $message = preg_replace("'([\n\\ \\.])" . preg_quote($smilies[$i]['code']) . "'s", '\1<img src="' . $smilies_url . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '">', ' ' . $message);
+ $orig[] = "'([\s\.\>\
+])" . preg_quote($smilies[$i]['code']) . "([\s\.\
+])'si";
+ $repl[] = '\1<img src="'. $smilies_url . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '">\2';
+ }
+ if($i > 0)
+ {
+ $message = preg_replace($orig, $repl, ' ' . $message . ' ');
+ $message = substr($message, 1, -1);
}
return($message);
}
//
-//
+// End Smiley parsing function :)
//
@@ -264,7 +276,7 @@ $select_post_order .= "</select>";
//
// Go ahead and pull all data for this topic
//
-$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, p.post_time, p.post_id, p.post_username, p.bbcode_uid, p.post_edit_time, p.post_edit_count, pt.post_text, pt.post_subject
+$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, p.post_time, p.post_id, p.post_username, p.bbcode_uid, p.post_edit_time, p.post_edit_count, pt.post_text, pt.post_subject, p.enable_smiles
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
@@ -511,6 +523,11 @@ for($i = 0; $i < $total_posts; $i++)
$user_sig = htmlspecialchars($user_sig);
}
$message = htmlspecialchars($message);
+ //
+ // Added next line to fix doubled up conversions due to htmlspecialchars
+ // already being run on posts.
+ //
+ $message = str_replace('&amp;', '&', $message);
}
if($board_config['allow_bbcode'])
@@ -535,9 +552,9 @@ for($i = 0; $i < $total_posts; $i++)
$message = eregi_replace("\[addsig]$", "<br /><br />_________________<br />" . nl2br($user_sig), $message);
}
- if($board_config['allow_smilies'])
+ if($board_config['allow_smilies'] && $postrow[$i]['enable_smiles'] == 1)
{
-// $message = smilies_pass($message);
+ $message = smilies_pass($message);
}
//
@@ -635,4 +652,4 @@ $template->pparse("body");
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
-?> \ No newline at end of file
+?>