|
From: Paul S. O. <ps...@us...> - 2002-02-08 01:33:39
|
Update of /cvsroot/phpbb/phpBB2/includes
In directory usw-pr-cvs1:/tmp/cvs-serv21249/includes
Modified Files:
bbcode.php functions.php
Log Message:
Various updates, mods, changes to several functions, moved smilies stuff to bbcode.php ... nathan may kill me ... good bye all in advance
Index: bbcode.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/bbcode.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** bbcode.php 28 Jan 2002 12:27:14 -0000 1.28
--- bbcode.php 8 Feb 2002 01:33:36 -0000 1.29
***************
*** 714,716 ****
}
! ?>
--- 714,768 ----
}
! //
! // Smilies code ... would this be better tagged on to the end of bbcode.php?
! // Probably so and I'll move it before B2
! //
! function smilies_pass($message)
! {
! global $db, $board_config;
! static $smilies;
!
! if( empty($smilies) )
! {
! $sql = "SELECT code, smile_url
! FROM " . SMILIES_TABLE;
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
! }
!
! if( !$db->sql_numrows($result) )
! {
! return $message;
! }
!
! $smilies = $db->sql_fetchrowset($result);
! }
!
! usort($smilies, 'smiley_sort');
! for($i = 0; $i < count($smilies); $i++)
! {
! $orig[] = "/(?<=.\\W|\\W.|^\\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\\W|\\W.|\\W$)/";
! $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '" border="0">';
! }
!
! if( $i > 0 )
! {
! $message = preg_replace($orig, $repl, ' ' . $message . ' ');
! $message = substr($message, 1, -1);
! }
!
! return $message;
! }
!
! function smiley_sort($a, $b)
! {
! if ( strlen($a['code']) == strlen($b['code']) )
! {
! return 0;
! }
!
! return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1;
! }
!
! ?>
\ No newline at end of file
Index: functions.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/functions.php,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -r1.111 -r1.112
*** functions.php 4 Feb 2002 18:31:22 -0000 1.111
--- functions.php 8 Feb 2002 01:33:36 -0000 1.112
***************
*** 28,36 ****
switch($mode)
{
- case 'postcount':
- $sql = "SELECT COUNT(post_id) AS total
- FROM " . POSTS_TABLE;
- break;
-
case 'usercount':
$sql = "SELECT COUNT(user_id) AS total
--- 28,31 ----
***************
*** 47,75 ****
break;
case 'topiccount':
! $sql = "SELECT SUM(forum_topics) AS total
FROM " . FORUMS_TABLE;
break;
}
! if(!$result = $db->sql_query($sql))
{
return 'ERROR';
}
! else
{
! $row = $db->sql_fetchrow($result);
! if($mode == 'newestuser')
! {
! return($row);
! }
! else
! {
! return($row['total']);
! }
}
}
! function get_userdata_from_id($userid)
{
global $db;
--- 42,79 ----
break;
+ case 'postcount':
case 'topiccount':
! $sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total
FROM " . FORUMS_TABLE;
break;
}
! if ( !($result = $db->sql_query($sql)) )
{
return 'ERROR';
}
!
! $row = $db->sql_fetchrow($result);
!
! switch ( $mode )
{
! case 'usercount':
! return $row['total'];
! break;
! case 'newestuser':
! return $row;
! break;
! case 'postcount':
! return $row['post_total'];
! break;
! case 'topiccount':
! return $row['topic_total'];
! break;
}
+
+ return 'ERROR';
}
! function get_userdata_from_id($user_id)
{
global $db;
***************
*** 77,99 ****
$sql = "SELECT *
FROM " . USERS_TABLE . "
! WHERE user_id = $userid";
! if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain userdata for id", "", __LINE__, __FILE__, $sql);
}
! if( !$db->sql_numrows($result) )
! {
! return false;
! }
!
! $row = $db->sql_fetchrow($result);
!
! return($row);
!
}
! function get_userdata($username) {
!
global $db;
--- 81,95 ----
$sql = "SELECT *
FROM " . USERS_TABLE . "
! WHERE user_id = $user_id";
! if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain userdata for id", "", __LINE__, __FILE__, $sql);
}
! return ( $row = $db->sql_fetchrow($result) ) ? $row : false;
}
! function get_userdata($username)
! {
global $db;
***************
*** 102,118 ****
WHERE username = '" . str_replace("\'", "''", $username) . "'
AND user_id <> " . ANONYMOUS;
! if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Tried obtaining data for a non-existent user", "", __LINE__, __FILE__, $sql);
}
! if( !$db->sql_numrows($result) )
! {
! return false;
! }
!
! $row = $db->sql_fetchrow($result);
!
! return($row);
}
--- 98,107 ----
WHERE username = '" . str_replace("\'", "''", $username) . "'
AND user_id <> " . ANONYMOUS;
! if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Tried obtaining data for a non-existent user", "", __LINE__, __FILE__, $sql);
}
! return ( $row = $db->sql_fetchrow($result) ) ? $row : false;
}
***************
*** 166,170 ****
//
$nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array (
! 'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=". $forum_rows[$j]['forum_id']),
'title' => $forum_rows[$j]['forum_name']
);
--- 155,159 ----
//
$nav_links['chapter forum'][$forum_rows[$j]['forum_id']] = array (
! 'url' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id']),
'title' => $forum_rows[$j]['forum_name']
);
***************
*** 285,304 ****
if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
{
! $theme = setup_style($userdata['user_style']);
! if( !$theme )
{
! $theme = setup_style($board_config['default_style']);
}
}
- else
- {
- $theme = setup_style($board_config['default_style']);
- }
- }
- else
- {
- $theme = setup_style($board_config['default_style']);
}
return;
}
--- 274,286 ----
if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
{
! if( ($theme = setup_style($userdata['user_style'])) )
{
! return;
}
}
}
+ $theme = setup_style($board_config['default_style']);
+
return;
}
***************
*** 367,371 ****
$act_key_md = md5($act_key);
! return($act_key_md);
}
--- 349,353 ----
$act_key_md = md5($act_key);
! return $act_key_md;
}
***************
*** 400,404 ****
$total_pages = ceil($num_items/$per_page);
! if( $total_pages == 1 )
{
return "";
--- 382,386 ----
$total_pages = ceil($num_items/$per_page);
! if ( $total_pages == 1 )
{
return "";
***************
*** 408,421 ****
$page_string = "";
!
! if( $total_pages > 8 )
{
!
! $init_page_max = ( $total_pages > 2 ) ? 2 : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++)
{
! $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>";
! if( $i < $init_page_max )
{
$page_string .= ", ";
--- 390,401 ----
$page_string = "";
! if ( $total_pages > 10 )
{
! $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++)
{
! $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
! if ( $i < $init_page_max )
{
$page_string .= ", ";
***************
*** 423,454 ****
}
! if( $total_pages > 2 )
{
! if( $on_page > 1 && $on_page < $total_pages )
{
! $page_string .= ( $on_page > 4 ) ? " ... " : ", ";
! $init_page_min = ( $on_page > 3 ) ? $on_page : 4;
! $init_page_max = ( $on_page < $total_pages - 3 ) ? $on_page : $total_pages - 3;
for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
{
! $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>";
! if( $i < $init_page_max + 1 )
{
! $page_string .= ", ";
}
}
! $page_string .= ( $on_page < $total_pages - 3 ) ? " ... " : ", ";
}
else
{
! $page_string .= " ... ";
}
! for($i = $total_pages - 1; $i < $total_pages + 1; $i++)
{
! $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>";
if( $i < $total_pages )
{
--- 403,434 ----
}
! if ( $total_pages > 3 )
{
! if ( $on_page > 1 && $on_page < $total_pages )
{
! $page_string .= ( $on_page > 5 ) ? ' ... ' : ', ';
! $init_page_min = ( $on_page > 4 ) ? $on_page : 5;
! $init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;
for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
{
! $page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
! if ( $i < $init_page_max + 1 )
{
! $page_string .= ', ';
}
}
! $page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', ';
}
else
{
! $page_string .= ' ... ';
}
! for($i = $total_pages - 2; $i < $total_pages + 1; $i++)
{
! $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if( $i < $total_pages )
{
***************
*** 462,491 ****
for($i = 1; $i < $total_pages + 1; $i++)
{
! $page_string .= ($i == $on_page) ? "<b>$i</b>" : "<a href=\"" . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page )) . "\">$i</a>";
! if( $i < $total_pages )
{
! $page_string .= ", ";
}
}
}
! if( $add_prevnext_text )
{
! if($on_page > 1)
{
! $page_string = " <a href=\"" . append_sid($base_url . "&start=" . (($on_page - 2) * $per_page)) . "\">" . $lang['Previous'] . "</a> " . $page_string;
}
! if($on_page < $total_pages)
{
! $page_string .= " <a href=\"" . append_sid($base_url . "&start=" . ($on_page * $per_page)) . "\">" . $lang['Next'] . "</a>";
}
}
! $page_string = $lang['Goto_page'] . " " . $page_string;
return $page_string;
-
}
--- 442,470 ----
for($i = 1; $i < $total_pages + 1; $i++)
{
! $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
! if ( $i < $total_pages )
{
! $page_string .= ', ';
}
}
}
! if ( $add_prevnext_text )
{
! if ( $on_page > 1 )
{
! $page_string = ' <a href="' . append_sid($base_url . "&start=" . ( ( $on_page - 2 ) * $per_page ) ) . '">' . $lang['Previous'] . '</a> ' . $page_string;
}
! if ( $on_page < $total_pages )
{
! $page_string .= ' <a href=' . append_sid($base_url . "&start=" . ( $on_page * $per_page ) ) . '">' . $lang['Next'] . '</a>';
}
}
! $page_string = $lang['Goto_page'] . ' ' . $page_string;
return $page_string;
}
***************
*** 500,528 ****
global $db, $lang, $userdata;
! $sql = "SELECT u.username, g.group_name
! FROM " . USERS_TABLE . " u, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
! WHERE ug.user_id = u.user_id
! AND g.group_id = ug.group_id
! AND ( LOWER(u.username) = '" . strtolower(str_replace("\'", "''", $username)) . "'
! OR LOWER(g.group_name) = '" . strtolower(str_replace("\'", "''", $username)) . "' )";
if ( $result = $db->sql_query($sql) )
{
if ( $row = $db->sql_fetchrow($result) )
{
! if($userdata['session_logged_in'])
! {
! if($row['username'] != $userdata['username'])
! {
! return array('error' => $lang['Username_taken']);
! }
! else
! {
! return array('error' => '');
! }
! }
! else
! {
! return array('error' => $lang['Username_taken']);
! }
}
}
--- 479,503 ----
global $db, $lang, $userdata;
! $username = str_replace("\'", "''", $username);
!
! $sql = "SELECT username
! FROM " . USERS_TABLE . "
! WHERE LOWER(username) = '" . strtolower($username) . "'";
if ( $result = $db->sql_query($sql) )
{
if ( $row = $db->sql_fetchrow($result) )
{
! return ( $userdata['session_logged_in'] ) ? ( ( $row['username'] != $userdata['username'] ) ? array('error' => $lang['Username_taken']) : array('error' => '') ) : array('error' => $lang['Username_taken']);
! }
! }
!
! $sql = "SELECT group_name
! FROM " . GROUPS_TABLE . "
! WHERE LOWER(group_name) = '" . strtolower($username) . "'";
! if ( $result = $db->sql_query($sql) )
! {
! if ( $row = $db->sql_fetchrow($result) )
! {
! return array('error' => $lang['Username_taken']);
}
}
***************
*** 530,534 ****
$sql = "SELECT disallow_username
FROM " . DISALLOW_TABLE . "
! WHERE '" . str_replace("\'", "''", $username) . "' LIKE disallow_username";
if ( $result = $db->sql_query($sql) )
{
--- 505,509 ----
$sql = "SELECT disallow_username
FROM " . DISALLOW_TABLE . "
! WHERE disallow_username LIKE '$username'";
if ( $result = $db->sql_query($sql) )
{
***************
*** 578,587 ****
message_die(GENERAL_ERROR, "Could not get forum IDs", "Error", __LINE__, __FILE__, $sql);
}
- $rowset = $db->sql_fetchrowset($result);
! for($i = 0; $i < count($rowset); $i++)
{
! sync("forum", $row[$i]['forum_id']);
! }
break;
--- 553,561 ----
message_die(GENERAL_ERROR, "Could not get forum IDs", "Error", __LINE__, __FILE__, $sql);
}
! while( $row = $db->sql_fetchrow($result) )
{
! sync("forum", $row['forum_id']);
! }
break;
***************
*** 593,601 ****
message_die(GENERAL_ERROR, "Could not get topic ID's", "Error", __LINE__, __FILE__, $sql);
}
- $rowset = $db->sql_fetchrowset($result);
! for($i = 0; $i < count($rowset); $i++)
{
! sync("topic", $row[$i]['topic_id']);
}
break;
--- 567,574 ----
message_die(GENERAL_ERROR, "Could not get topic ID's", "Error", __LINE__, __FILE__, $sql);
}
! while( $row = $db->sql_fetchrow($result) )
{
! sync("topic", $row['topic_id']);
}
break;
***************
*** 666,670 ****
case 'topic':
! $sql = "SELECT MAX(post_id) AS last_post
FROM " . POSTS_TABLE . "
WHERE topic_id = $id";
--- 639,643 ----
case 'topic':
! $sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $id";
***************
*** 676,718 ****
if( $row = $db->sql_fetchrow($result) )
{
! $last_post = ($row['last_post']) ? $row['last_post'] : 0;
! }
! else
! {
! $last_post = 0;
! }
!
! $sql = "SELECT COUNT(post_id) AS total
! FROM " . POSTS_TABLE . "
! WHERE topic_id = $id";
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Could not get post count", "Error", __LINE__, __FILE__, $sql);
! }
!
! if( $row = $db->sql_fetchrow($result) )
! {
! $total_posts = ($row['total']) ? $row['total'] - 1 : 0;
! }
! else
! {
! $total_posts = 0;
}
- $sql = "UPDATE " . TOPICS_TABLE . "
- SET topic_replies = $total_posts, topic_last_post_id = $last_post
- WHERE topic_id = $id";
- if( !$result = $db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, "Could not update topic $id", "Error", __LINE__, __FILE__, $sql);
- }
break;
}
!
! return(TRUE);
!
}
-
//
// Pick a language, any language ...
--- 649,667 ----
if( $row = $db->sql_fetchrow($result) )
{
! $sql = "UPDATE " . TOPICS_TABLE . "
! SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . "
! WHERE topic_id = $id";
! if( !($result = $db->sql_query($sql)) )
! {
! message_die(GENERAL_ERROR, "Could not update topic $id", "Error", __LINE__, __FILE__, $sql);
! }
}
break;
}
!
! return true;
}
//
// Pick a language, any language ...
***************
*** 724,751 ****
$dir = opendir($dirname);
! $lang_select = "<select name=\"$select_name\">";
! while($file = readdir($dir))
{
if( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
{
$filename = str_replace("lang_", "", $file);
-
$displayname = preg_replace("/(.*)_(.*)/", "\\1 [ \\2 ]", $filename);
!
! $selected = ( strtolower($default) == strtolower($filename) ) ? " selected=\"selected\"" : "";
! $lang_select .= "<option value=\"$filename\"$selected>" . ucwords($displayname) . "</option>";
}
}
- $lang_select .= "</select>";
closedir($dir);
return $lang_select;
}
-
//
! // Pick a template/theme combo, personally recommend
! // PSO - Blue but then I would ...
//
function style_select($default_style, $select_name = "style", $dirname = "templates")
--- 673,705 ----
$dir = opendir($dirname);
! $lang = array();
! while ( $file = readdir($dir) )
{
if( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
{
$filename = str_replace("lang_", "", $file);
$displayname = preg_replace("/(.*)_(.*)/", "\\1 [ \\2 ]", $filename);
! $lang[$displayname] = $filename;
}
}
closedir($dir);
+ @asort($lang);
+ @reset($lang);
+
+ $lang_select = '<select name="' . $select_name . '">';
+ while ( list($displayname, $filename) = @each($lang) )
+ {
+ $selected = ( strtolower($default) == strtolower($filename) ) ? ' selected="selected"' : '';
+ $lang_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
+ }
+ $lang_select .= '</select>';
+
return $lang_select;
}
//
! // Pick a template/theme combo,
//
function style_select($default_style, $select_name = "style", $dirname = "templates")
***************
*** 763,779 ****
$template_style = $db->sql_fetchrowset($result);
! $style_select = "<select name=\"$select_name\">";
for($i = 0; $i < count($template_style); $i++)
{
! $selected = ( $template_style[$i]['themes_id'] == $default_style ) ? " selected=\"selected\"" : "";
! $style_select .= "<option value=\"" . $template_style[$i]['themes_id'] . "\"$selected>" . $template_style[$i]['style_name'] . "</option>";
}
$style_select .= "</select>";
! return($style_select);
}
-
//
// Pick a timezone
--- 717,732 ----
$template_style = $db->sql_fetchrowset($result);
! $style_select = '<select name="' . $select_name . '">';
for($i = 0; $i < count($template_style); $i++)
{
! $selected = ( $template_style[$i]['themes_id'] == $default_style ) ? ' selected="selected"' : '';
! $style_select .= '<option value="' . $template_style[$i]['themes_id'] . '"' . $selected . '>' . $template_style[$i]['style_name'] . '</option>';
}
$style_select .= "</select>";
! return $style_select;
}
//
// Pick a timezone
***************
*** 787,855 ****
$default == $sys_timezone;
}
! $tz_select = "<select name=\"$select_name\">";
! while( list($offset, $zone) = each($lang['tz']) )
{
! $selected = ( $offset == $default ) ? " selected=\"selected\"" : "";
! $tz_select .= "\t<option value=\"$offset\"$selected>$zone</option>";
}
! $tz_select .= "</select>";
! return($tz_select);
}
-
- //
- // Smilies code ... would this be better tagged on to the end of bbcode.php?
- // Probably so and I'll move it before B2
- //
- function smilies_pass($message)
- {
- global $db, $board_config;
- static $smilies;
-
- if( empty($smilies) )
- {
- $sql = "SELECT code, smile_url
- FROM " . SMILIES_TABLE;
- if( !$result = $db->sql_query($sql) )
- {
- message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
- }
-
- if( !$db->sql_numrows($result) )
- {
- return $message;
- }
-
- $smilies = $db->sql_fetchrowset($result);
- }
-
- usort($smilies, 'smiley_sort');
- for($i = 0; $i < count($smilies); $i++)
- {
- $orig[] = "/(?<=.\\W|\\W.|^\\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\\W|\\W.|\\W$)/";
- $repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '" border="0">';
- }
-
- if( $i > 0 )
- {
- $message = preg_replace($orig, $repl, ' ' . $message . ' ');
- $message = substr($message, 1, -1);
- }
-
- return $message;
- }
- function smiley_sort($a, $b)
- {
- if ( strlen($a['code']) == strlen($b['code']) )
- {
- return 0;
- }
-
- return ( strlen($a['code']) > strlen($b['code']) ) ? -1 : 1;
- }
-
-
//
// Obtain list of naughty words and build preg style replacement arrays for use by the
--- 740,755 ----
$default == $sys_timezone;
}
! $tz_select = '<select name="' . $select_name . '">';
! while( list($offset, $zone) = @each($lang['tz']) )
{
! $selected = ( $offset == $default ) ? ' selected="selected"' : '';
! $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
}
! $tz_select .= '</select>';
! return $tz_select;
}
//
// Obtain list of naughty words and build preg style replacement arrays for use by the
***************
*** 872,890 ****
else
{
! $word_list = $db->sql_fetchrowset($words_result);
!
! $orig_word = array();
! $replacement_word = array();
!
! for($i = 0; $i < count($word_list); $i++)
{
! $word = str_replace("\*", "\w*?", phpbb_preg_quote($word_list[$i]['word'], "#"));
!
! $orig_word[] = "#\b(" . $word . ")\b#i";
! $replacement_word[] = $word_list[$i]['replacement'];
}
}
! return(TRUE);
}
--- 772,787 ----
else
{
! if ( $row = $db->sql_fetchrow($result) )
{
! do
! {
! $orig_word[] = "#\b(" . str_replace("\*", "\w*?", $row['word']) . ")\b#is";
! $replacement_word[] = $row['replacement'];
! }
! while ( $row = $db->sql_fetchrow($result) );
}
}
! return true;
}
***************
*** 897,901 ****
global $starttime;
! $author_list = "";
if( !empty($search_match) )
{
--- 794,798 ----
global $starttime;
! $author_list = '';
if( !empty($search_match) )
{
***************
*** 906,926 ****
WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
ORDER BY username";
! if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
}
! if( $numrows = $db->sql_numrows($result) )
{
! $searchset = $db->sql_fetchrowset($result);
!
! for($i = 0; $i < $numrows; $i++)
{
! $author_list .= "<option value=\"" . $searchset[$i]['username'] . "\">" .$searchset[$i]['username'] . "</option>";
}
}
else
{
! $author_list = "<option>" . $lang['No_match']. "</option>";
}
--- 803,822 ----
WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
ORDER BY username";
! if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
}
! if( $row = $db->sql_fetchrow($result) )
{
! do
{
! $author_list .= '<option value="' . $row['username'] . '">' .$row['username'] . '</option>';
}
+ while ( $row = $db->sql_fetchrow($result) );
}
else
{
! $author_list = '<option>' . $lang['No_match']. '</option>';
}
***************
*** 1193,1195 ****
}
! ?>
--- 1089,1091 ----
}
! ?>
\ No newline at end of file
|