Удаление мода виртуальной клавиатуры из основного дистрибутива; фикс главной страницы админ-панели; фикс панели управления шаблонами в админ-панели; частичная замена else if на elseif, для возможности отхода от использования фигурных скобок в дальнейшем. Дальнейшая поддержка и распространение мода виртуальной клавиатуры осуществляется на форуме: http://torrentpier.me/resources/84/ git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@562 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08@gmail.com 2014-01-19 19:04:25 +00:00
commit 399ac5a1b0
26 changed files with 152 additions and 438 deletions

View file

@ -1,148 +0,0 @@
# Инструкция от dimka3210
# Данный мод позволяет использовать виртуальную клавиатуру.
# Сам мод был вырезан из-за неактивности, но будет поставляться вместе с движком.
# Получить поддержку по движку можно на форуме http://torrentpier.me
Скопировать файл kb.tpl в /templates/default/
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
config_mods.php
#
#-----[ ADD / Добавить ]-----------------------------------------
#
$bb_cfg['show_virtual_keyboard'] = true;
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
posting.php
#
#-----[ FIND / Найти ]-------------------------------------------
#
'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
);
#
#-----[ AFTER ADD / После добавить]------------------------------
#
$template->assign_vars(array(
'SHOW_VIRTUAL_KEYBOARD' => $bb_cfg['show_virtual_keyboard'],
'S_VISIBILITY_RULES' => 'position:absolute;visibility:hidden;',
'S_VISIBILITY_KEYB' => 'position:absolute;visibility:hidden;',
'S_VISIBILITY_OFF' => '')
);
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
privmsg.php
#
#-----[ FIND / Найти ]-------------------------------------------
#
'U_VIEW_FORUM' => append_sid("privmsg.php"))
);
#
#-----[ AFTER ADD / После добавить]------------------------------
#
$template->assign_vars(array(
'SHOW_VIRTUAL_KEYBOARD' => $bb_cfg['show_virtual_keyboard'],
'S_VISIBILITY_RULES' => 'position:absolute;visibility:hidden;',
'S_VISIBILITY_KEYB' => 'position:absolute;visibility:hidden;',
'S_VISIBILITY_OFF' => '')
);
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
lang_english/lang_main.php
#
#-----[ ADD / Добавить в конец]------------------------------
#
// MAIL.RU KEYBOARD
$lang['KB_TITLE'] = 'Russian keyboard';
$lang['KB_RUS_KEYLAYOUT'] = 'Layout: ';
$lang['KB_NONE'] = 'None';
$lang['KB_TRANSLIT'] = 'Translit';
$lang['KB_TRADITIONAL'] = 'Traditional';
$lang['KB_RULES'] = 'Using translit';
$lang['KB_SHOW'] = 'Show keyboard (Make sure you\'re using Cyrillic codepage!)';
$lang['KB_ABOUT'] = 'About';
$lang['KB_CLOSE'] = 'Close';
$lang['KB_TRANSLIT_MOZILLA'] = 'Select text you wish to translit and click \'Translit\'.';
$lang['KB_TRANSLIT_OPERA7'] = 'Click here to translit your message.';
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
lang_russian/lang_main.php
#
#-----[ ADD / Добавить в конец]------------------------------
#
// MAIL.RU KEYBOARD
$lang['KB_TITLE'] = 'Русская клавиатура';
$lang['KB_RUS_KEYLAYOUT'] = 'Раскладка: ';
$lang['KB_NONE'] = 'Отсутствует';
$lang['KB_TRANSLIT'] = 'Транслит';
$lang['KB_TRADITIONAL'] = 'Традиционная';
$lang['KB_RULES'] = 'Правила набора';
$lang['KB_SHOW'] = 'Показать клавиатуру';
$lang['KB_ABOUT'] = 'О клавиатуре';
$lang['KB_CLOSE'] = 'Закрыть';
$lang['KB_TRANSLIT_MOZILLA'] = 'Выберите текст, который вы хотите для перевода в транслит, и нажмите кнопку \'Транслит\'.';
$lang['KB_TRANSLIT_OPERA7'] = 'Нажмите здесь для перевода вашего сообщения в транслит.';
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
templates/default/posting.tpl
#
#-----[ FIND / Найти ]-------------------------------------------
#
<!-- IF IN_PM -->
<!-- ELSEIF LOGGED_IN -->
#
#-----[ BEFORE ADD / Перед добавить]------------------------------
#
<!-- IF SHOW_VIRTUAL_KEYBOARD --><!-- INCLUDE kb.tpl --><!-- ENDIF -->
#
#-----[ OPEN / Открыть ]-----------------------------------------
#
templates/default/posting_editor.tpl
#
#-----[ FIND / Найти ]-------------------------------------------
#
class="editor mrg_4" name="message" id="message" rows="18" cols="92"
#
#-----[ ADD / Добавить]------------------------------
#
<!-- IF SHOW_VIRTUAL_KEYBOARD -->
onkeypress = "if(use_kb) return decode(event);"
<!-- ENDIF -->
#
#-----[ SAVE/CLOSE ALL FILES / Сохранить/Закрыть все файлы]------------------------------------------
#

File diff suppressed because one or more lines are too long

View file

@ -41,12 +41,11 @@ if( isset($_POST['add_name']) )
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else if( isset($_POST['delete_name']) ) elseif (isset($_POST['delete_name']))
{ {
$disallowed_id = ( isset($_POST['disallowed_id']) ) ? intval( $_POST['disallowed_id'] ) : intval( $_GET['disallowed_id'] ); $disallowed_id = (isset($_POST['disallowed_id']) ) ? intval( $_POST['disallowed_id'] ) : intval( $_GET['disallowed_id']);
$sql = "DELETE FROM " . BB_DISALLOW . " $sql = "DELETE FROM " . BB_DISALLOW . " WHERE disallow_id = $disallowed_id";
WHERE disallow_id = $disallowed_id";
$result = DB()->sql_query($sql); $result = DB()->sql_query($sql);
if( !$result ) if( !$result )
{ {

View file

@ -22,11 +22,11 @@ else
// //
// These could be entered via a form button // These could be entered via a form button
// //
if(isset($_POST['add'])) if (isset($_POST['add']))
{ {
$mode = 'add'; $mode = 'add';
} }
else if(isset($_POST['save'])) elseif (isset($_POST['save']))
{ {
$mode = 'save'; $mode = 'save';
} }
@ -37,9 +37,9 @@ else
} }
if($mode != '') if ($mode != '')
{ {
if($mode == 'edit' || $mode == 'add') if ($mode == 'edit' || $mode == 'add')
{ {
// //
// They want to add a new rank, show the form. // They want to add a new rank, show the form.
@ -48,15 +48,14 @@ if($mode != '')
$s_hidden_fields = ''; $s_hidden_fields = '';
if($mode == 'edit') if ($mode == 'edit')
{ {
if(empty($rank_id)) if(empty($rank_id))
{ {
message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']); message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']);
} }
$sql = "SELECT * FROM " . BB_RANKS . " $sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
WHERE rank_id = $rank_id";
if(!$result = DB()->sql_query($sql)) if(!$result = DB()->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Couldn't obtain rank data", '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain rank data", '', __LINE__, __FILE__, $sql);
@ -64,7 +63,6 @@ if($mode != '')
$rank_info = DB()->sql_fetchrow($result); $rank_info = DB()->sql_fetchrow($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="'. $rank_id .'" />'; $s_hidden_fields .= '<input type="hidden" name="id" value="'. $rank_id .'" />';
} }
else else
{ {
@ -90,9 +88,8 @@ if($mode != '')
'S_RANK_ACTION' => "admin_ranks.php", 'S_RANK_ACTION' => "admin_ranks.php",
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
)); ));
} }
else if($mode == 'save') elseif ($mode == 'save')
{ {
// //
// Ok, they sent us our info, let's update it. // Ok, they sent us our info, let's update it.
@ -105,12 +102,12 @@ if($mode != '')
$min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1; $min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1;
$rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : ''; $rank_image = ((isset($_POST['rank_image']))) ? trim($_POST['rank_image']) : '';
if($rank_title == '') if ($rank_title == '')
{ {
message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']); message_die(GENERAL_MESSAGE, $lang['MUST_SELECT_RANK']);
} }
if($special_rank == 1) if ($special_rank == 1)
{ {
$max_posts = -1; $max_posts = -1;
$min_posts = -1; $min_posts = -1;
@ -119,7 +116,7 @@ if($mode != '')
// //
// The rank image has to be a jpg, gif or png // The rank image has to be a jpg, gif or png
// //
if($rank_image != '') if ($rank_image != '')
{ {
if (!preg_match('/(\.gif|\.png|\.jpg)$/is', $rank_image)) if (!preg_match('/(\.gif|\.png|\.jpg)$/is', $rank_image))
{ {
@ -131,17 +128,18 @@ if($mode != '')
{ {
if (!$special_rank) if (!$special_rank)
{ {
$sql = "UPDATE " . BB_USERS . " $sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
SET user_rank = 0 if (!$result = DB()->sql_query($sql))
WHERE user_rank = $rank_id";
if(!$result = DB()->sql_query($sql))
{ {
message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql);
} }
} }
$sql = "UPDATE " . BB_RANKS . " $sql = "UPDATE " . BB_RANKS . "
SET rank_title = '". DB()->escape($rank_title) ."', rank_special = $special_rank, rank_min = $min_posts, rank_image = '". DB()->escape($rank_image) . "', rank_style = '". DB()->escape($rank_style) ."' SET rank_title = '". DB()->escape($rank_title) ."',
rank_special = $special_rank,
rank_min = $min_posts,
rank_image = '". DB()->escape($rank_image) . "',
rank_style = '". DB()->escape($rank_style) ."'
WHERE rank_id = $rank_id"; WHERE rank_id = $rank_id";
$message = $lang['RANK_UPDATED']; $message = $lang['RANK_UPDATED'];
@ -154,25 +152,25 @@ if($mode != '')
$message = $lang['RANK_ADDED']; $message = $lang['RANK_ADDED'];
} }
if(!$result = DB()->sql_query($sql)) if (!$result = DB()->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Couldn't update/insert into ranks table", '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't update/insert into ranks table", '', __LINE__, __FILE__, $sql);
} }
$message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message .= '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
$datastore->update('ranks'); $datastore->update('ranks');
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else if($mode == 'delete') elseif ($mode == 'delete')
{ {
// //
// Ok, they want to delete their rank // Ok, they want to delete their rank
// //
if(isset($_POST['id']) || isset($_GET['id'])) if (isset($_POST['id']) || isset($_GET['id']))
{ {
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']); $rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']);
} }
@ -181,30 +179,26 @@ if($mode != '')
$rank_id = 0; $rank_id = 0;
} }
if($rank_id) if ($rank_id)
{ {
$sql = "DELETE FROM " . BB_RANKS . " WHERE rank_id = $rank_id"; $sql = "DELETE FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
if(!$result = DB()->sql_query($sql)) if (!$result = DB()->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Couldn't delete rank data", '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't delete rank data", '', __LINE__, __FILE__, $sql);
} }
$sql = "UPDATE " . BB_USERS . " $sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
SET user_rank = 0 if (!$result = DB()->sql_query($sql))
WHERE user_rank = $rank_id";
if(!$result = DB()->sql_query($sql))
{ {
message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, $lang['NO_UPDATE_RANKS'], '', __LINE__, __FILE__, $sql);
} }
$message = $lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'); $message = $lang['RANK_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
$datastore->update('ranks'); $datastore->update('ranks');
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else else
{ {
@ -235,14 +229,14 @@ else
'S_RANKS_ACTION' => "admin_ranks.php", 'S_RANKS_ACTION' => "admin_ranks.php",
)); ));
for($i = 0; $i < $rank_count; $i++) for ($i = 0; $i < $rank_count; $i++)
{ {
$rank = $rank_rows[$i]['rank_title']; $rank = $rank_rows[$i]['rank_title'];
$special_rank = $rank_rows[$i]['rank_special']; $special_rank = $rank_rows[$i]['rank_special'];
$rank_id = $rank_rows[$i]['rank_id']; $rank_id = $rank_rows[$i]['rank_id'];
$rank_min = $rank_rows[$i]['rank_min']; $rank_min = $rank_rows[$i]['rank_min'];
if($special_rank == 1) if ($special_rank == 1)
{ {
$rank_min = $rank_max = '-'; $rank_min = $rank_max = '-';
} }

View file

@ -31,7 +31,7 @@ if ($mode == 'templates')
'S_ACTION' => "admin_topic_templates.php?mode=delete", 'S_ACTION' => "admin_topic_templates.php?mode=delete",
)); ));
} }
else if ($mode == 'add' || $mode == 'edit') elseif ($mode == 'add' || $mode == 'edit')
{ {
$template->assign_vars(array( $template->assign_vars(array(
'TPL' => true, 'TPL' => true,
@ -111,7 +111,7 @@ elseif ($mode == 'delete')
print_confirmation(array( print_confirmation(array(
'QUESTION' => $lang['QUESTION'], 'QUESTION' => $lang['QUESTION'],
'ITEMS_LIST' => join('\n</li>\n<li>\n', $names), 'ITEMS_LIST' => join("\n</li>\n<li>\n", $names),
'FORM_ACTION' => "admin_topic_templates.php?mode=delete", 'FORM_ACTION' => "admin_topic_templates.php?mode=delete",
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields), 'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
)); ));

View file

@ -130,55 +130,55 @@ else
{ {
$mode = 'search_username'; $mode = 'search_username';
} }
else if(isset($_POST['search_email'])||isset($_GET['search_email'])) elseif(isset($_POST['search_email'])||isset($_GET['search_email']))
{ {
$mode = 'search_email'; $mode = 'search_email';
} }
else if(isset($_POST['search_ip'])||isset($_GET['search_ip'])) elseif(isset($_POST['search_ip'])||isset($_GET['search_ip']))
{ {
$mode = 'search_ip'; $mode = 'search_ip';
} }
else if(isset($_POST['search_joindate'])||isset($_GET['search_joindate'])) elseif(isset($_POST['search_joindate'])||isset($_GET['search_joindate']))
{ {
$mode = 'search_joindate'; $mode = 'search_joindate';
} }
else if(isset($_POST['search_group'])||isset($_GET['search_group'])) elseif(isset($_POST['search_group'])||isset($_GET['search_group']))
{ {
$mode = 'search_group'; $mode = 'search_group';
} }
else if(isset($_POST['search_rank'])||isset($_GET['search_rank'])) elseif(isset($_POST['search_rank'])||isset($_GET['search_rank']))
{ {
$mode = 'search_rank'; $mode = 'search_rank';
} }
else if(isset($_POST['search_postcount'])||isset($_GET['search_postcount'])) elseif(isset($_POST['search_postcount'])||isset($_GET['search_postcount']))
{ {
$mode = 'search_postcount'; $mode = 'search_postcount';
} }
else if(isset($_POST['search_userfield'])||isset($_GET['search_userfield'])) elseif(isset($_POST['search_userfield'])||isset($_GET['search_userfield']))
{ {
$mode = 'search_userfield'; $mode = 'search_userfield';
} }
else if(isset($_POST['search_lastvisited'])||isset($_GET['search_lastvisited'])) elseif(isset($_POST['search_lastvisited'])||isset($_GET['search_lastvisited']))
{ {
$mode = 'search_lastvisited'; $mode = 'search_lastvisited';
} }
else if(isset($_POST['search_language'])||isset($_GET['search_language'])) elseif(isset($_POST['search_language'])||isset($_GET['search_language']))
{ {
$mode = 'search_language'; $mode = 'search_language';
} }
else if(isset($_POST['search_timezone'])||isset($_GET['search_timezone'])) elseif(isset($_POST['search_timezone'])||isset($_GET['search_timezone']))
{ {
$mode = 'search_timezone'; $mode = 'search_timezone';
} }
else if(isset($_POST['search_style'])||isset($_GET['search_style'])) elseif(isset($_POST['search_style'])||isset($_GET['search_style']))
{ {
$mode = 'search_style'; $mode = 'search_style';
} }
else if(isset($_POST['search_moderators'])||isset($_GET['search_moderators'])) elseif(isset($_POST['search_moderators'])||isset($_GET['search_moderators']))
{ {
$mode = 'search_moderators'; $mode = 'search_moderators';
} }
else if(isset($_POST['search_misc'])||isset($_GET['search_misc'])) elseif(isset($_POST['search_misc'])||isset($_GET['search_misc']))
{ {
$mode = 'search_misc'; $mode = 'search_misc';
} }
@ -465,7 +465,7 @@ else
$users[] = $ip; $users[] = $ip;
} }
// We will also support wildcards, is this an xxx.xxx.* address? // We will also support wildcards, is this an xxx.xxx.* address?
else if( preg_match('/^([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){0,2}\.\*/', $ip_address) ) elseif( preg_match('/^([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){0,2}\.\*/', $ip_address) )
{ {
// Alright, now we do the ugly part, converting them to encoded ips // Alright, now we do the ugly part, converting them to encoded ips
// We need to deal with the three ways it can be done // We need to deal with the three ways it can be done
@ -497,7 +497,7 @@ else
} }
} }
// Lastly, let's see if they have a range in the last quad, like xxx.xxx.xxx.xxx - xxx.xxx.xxx.yyy // Lastly, let's see if they have a range in the last quad, like xxx.xxx.xxx.xxx - xxx.xxx.xxx.yyy
else if( preg_match('/^([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){3}(\s)*-(\s)*([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){3}$/', $ip_address) ) elseif( preg_match('/^([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){3}(\s)*-(\s)*([0-9]{1,2}|[0-2][0-9]{0,2})(\.([0-9]{1,2}|[0-2][0-9]{0,2})){3}$/', $ip_address) )
{ {
// We will split the two ranges // We will split the two ranges
$range = preg_split('/[-\s]+/', $ip_address); $range = preg_split('/[-\s]+/', $ip_address);
@ -538,13 +538,13 @@ else
$ip_start = substr($address, 0, 2); $ip_start = substr($address, 0, 2);
} }
// num.num.xxx.xxx // num.num.xxx.xxx
else if( preg_match('/[0-9a-f]{4}ffff/i', $address) ) elseif( preg_match('/[0-9a-f]{4}ffff/i', $address) )
{ {
$ip_start = substr($address, 0, 4); $ip_start = substr($address, 0, 4);
} }
// num.num.num.xxx // num.num.num.xxx
else if( preg_match('/[0-9a-f]{6}ff/i', $address) ) elseif( preg_match('/[0-9a-f]{6}ff/i', $address) )
{ {
$ip_start = substr($address, 0, 6); $ip_start = substr($address, 0, 6);
} }

View file

@ -56,7 +56,7 @@ if( isset($_GET['pane']) && $_GET['pane'] == 'left' )
} }
} }
} }
else if( isset($_GET['pane']) && $_GET['pane'] == 'right' ) elseif( isset($_GET['pane']) && $_GET['pane'] == 'right' )
{ {
$template->assign_vars(array( $template->assign_vars(array(
'TPL_ADMIN_MAIN' => true, 'TPL_ADMIN_MAIN' => true,
@ -122,26 +122,25 @@ else if( isset($_GET['pane']) && $_GET['pane'] == 'right' )
// //
$sql = "SELECT VERSION() AS mysql_version"; $sql = "SELECT VERSION() AS mysql_version";
if($result = DB()->sql_query($sql)) if ($result = DB()->sql_query($sql))
{ {
$row = DB()->sql_fetchrow($result); $row = DB()->sql_fetchrow($result);
$version = $row['mysql_version']; $version = $row['mysql_version'];
if( preg_match('/^(3\.23|4\.|5\.|10\.)/', $version) ) if (preg_match('/^(3\.23|4\.|5\.|10\.)/', $version))
{ {
$dblist = array(); $dblist = array();
foreach($bb_cfg['db'] as $name => $row) foreach ($bb_cfg['db'] as $name => $row)
{ {
$sql = "SHOW TABLE STATUS $sql = "SHOW TABLE STATUS FROM {$row[1]}";
FROM {$row[1]}"; if ($result = DB()->sql_query($sql))
if($result = DB()->sql_query($sql))
{ {
$tabledata_ary = DB()->sql_fetchrowset($result); $tabledata_ary = DB()->sql_fetchrowset($result);
$dbsize = 0; $dbsize = 0;
for($i = 0; $i < count($tabledata_ary); $i++) for ($i = 0; $i < count($tabledata_ary); $i++)
{ {
if( @$tabledata_ary[$i]['Type'] != 'MRG_MyISAM' ) if( @$tabledata_ary[$i]['Type'] != 'MRG_MYISAM' )
{ {
$dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length'];
} }
@ -289,19 +288,19 @@ else if( isset($_GET['pane']) && $_GET['pane'] == 'right' )
'U_SYNC_USER_POSTS' => "index.php?sync_user_posts=1", 'U_SYNC_USER_POSTS' => "index.php?sync_user_posts=1",
)); ));
} }
else if (isset($_REQUEST['update_user_level'])) elseif (isset($_REQUEST['update_user_level']))
{ {
require(INC_DIR .'functions_group.php'); require(INC_DIR .'functions_group.php');
update_user_level('all'); update_user_level('all');
bb_die($lang['USER_LEVELS_UPDATED']); bb_die($lang['USER_LEVELS_UPDATED']);
} }
else if (isset($_REQUEST['sync_topics'])) elseif (isset($_REQUEST['sync_topics']))
{ {
sync('topic', 'all'); sync('topic', 'all');
sync('forum', 'all'); sync('forum', 'all');
bb_die($lang['TOPICS_DATA_SYNCHRONIZED']); bb_die($lang['TOPICS_DATA_SYNCHRONIZED']);
} }
else if (isset($_REQUEST['sync_user_posts'])) elseif (isset($_REQUEST['sync_user_posts']))
{ {
sync('user_posts', 'all'); sync('user_posts', 'all');
bb_die($lang['USER POSTS COUNT SYNCHRONIZED']); bb_die($lang['USER POSTS COUNT SYNCHRONIZED']);

View file

@ -122,7 +122,7 @@ class ajax_common
{ {
$this->ajax_die('no action specified'); $this->ajax_die('no action specified');
} }
else if (!$action_params =& $this->valid_actions[$action]) elseif (!$action_params =& $this->valid_actions[$action])
{ {
$this->ajax_die('invalid action: '. $action); $this->ajax_die('invalid action: '. $action);
} }
@ -479,8 +479,8 @@ class ajax_common
$this->response['type'] = $type; $this->response['type'] = $type;
$this->response['post_id'] = $post_id; $this->response['post_id'] = $post_id;
if ($type == 0) $this->response['html'] = ''; if ($type == 0) $this->response['html'] = '';
else if ($type == 1) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>'; elseif ($type == 1) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>';
else if ($type == 2) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>'; elseif ($type == 2) $this->response['html'] = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W">'. profile_url($userdata) .'&nbsp;'. $lang['WROTE'] .':<br /><br />'. bbcode2html($text) .'</td></tr></table></div>';
} }
function view_post () function view_post ()

View file

@ -68,7 +68,7 @@ switch ($field)
{ {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age'])); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
} }
else if ((bb_date(TIMENOW, 'Y', 'false') - $b_year) < $bb_cfg['birthday_min_age']) elseif ((bb_date(TIMENOW, 'Y', 'false') - $b_year) < $bb_cfg['birthday_min_age'])
{ {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age'])); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
} }

View file

@ -18,6 +18,7 @@ switch ($mode)
'bb_cap_sid', 'bb_cap_sid',
); );
// foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val)
foreach ($gc_cache as $cache_name) foreach ($gc_cache as $cache_name)
{ {
CACHE($cache_name)->rm(); CACHE($cache_name)->rm();

View file

@ -71,7 +71,7 @@ switch($this->request['type'])
{ {
$this->ajax_die($lang['RULES_REPLY_CANNOT']); $this->ajax_die($lang['RULES_REPLY_CANNOT']);
} }
else if(!$is_auth['auth_reply']) elseif(!$is_auth['auth_reply'])
{ {
$this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type']))); $this->ajax_die(sprintf($lang['SORRY_AUTH_REPLY'], strip_tags($is_auth['auth_reply_type'])));
} }

View file

@ -16,7 +16,7 @@ switch($mode)
{ {
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_A_NAME'] .'</span>'; $html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_A_NAME'] .'</span>';
} }
else if($err = validate_username($username)) elseif($err = validate_username($username))
{ {
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>'; $html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
} }
@ -29,7 +29,7 @@ switch($mode)
{ {
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_E_MAIL'] .'</span>'; $html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $lang['CHOOSE_E_MAIL'] .'</span>';
} }
else if($err = validate_email($email)) elseif($err = validate_email($email))
{ {
$html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>'; $html = '<img src="./images/bad.gif"> <span class="leechmed bold">'. $err .'</span>';
} }

View file

@ -39,7 +39,7 @@ if ($post_data['auth_read'] == AUTH_REG)
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']); $this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
} }
} }
else if ($post_data['auth_read'] != AUTH_ALL) elseif ($post_data['auth_read'] != AUTH_ALL)
{ {
$is_auth = auth(AUTH_READ, $post_data['forum_id'], $user->data, $post_data); $is_auth = auth(AUTH_READ, $post_data['forum_id'], $user->data, $post_data);
if (!$is_auth['auth_read']) if (!$is_auth['auth_read'])

View file

@ -89,7 +89,7 @@ switch ($mode)
$type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['RELEASER'] .'</td>'; $type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['RELEASER'] .'</td>';
$releasing_count++; $releasing_count++;
} }
else if ($rowset[$i]['seeder']) elseif ($rowset[$i]['seeder'])
{ {
$s = $s + $rowset[$i]['size']; $s = $s + $rowset[$i]['size'];
$type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['SEEDER'] .'</td>'; $type = $type = '<td class="row1 tCenter dlComplete lh_150 pad_4 nowrap">'. $lang['SEEDER'] .'</td>';

View file

@ -112,7 +112,7 @@ if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip'])
{ {
$ip = $_GET['ip']; $ip = $_GET['ip'];
} }
else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches))
{ {
foreach ($matches[0] as $x_ip) foreach ($matches[0] as $x_ip)
{ {
@ -292,7 +292,7 @@ else
{ {
msg_die('Only '. $tr_cfg['limit_seed_count'] .' torrent(s) allowed for seeding'); msg_die('Only '. $tr_cfg['limit_seed_count'] .' torrent(s) allowed for seeding');
} }
else if (!$seeder && $tr_cfg['limit_leech_count'] && $row['active_torrents'] >= $tr_cfg['limit_leech_count']) elseif (!$seeder && $tr_cfg['limit_leech_count'] && $row['active_torrents'] >= $tr_cfg['limit_leech_count'])
{ {
msg_die('Only '. $tr_cfg['limit_leech_count'] .' torrent(s) allowed for leeching'. $rating_msg); msg_die('Only '. $tr_cfg['limit_leech_count'] .' torrent(s) allowed for leeching'. $rating_msg);
} }
@ -321,7 +321,7 @@ else
{ {
msg_die('You can seed only from '. $tr_cfg['limit_seed_ips'] ." IP's"); msg_die('You can seed only from '. $tr_cfg['limit_seed_ips'] ." IP's");
} }
else if (!$seeder && $tr_cfg['limit_leech_ips'] && $row['ips'] >= $tr_cfg['limit_leech_ips']) elseif (!$seeder && $tr_cfg['limit_leech_ips'] && $row['ips'] >= $tr_cfg['limit_leech_ips'])
{ {
msg_die('You can leech only from '. $tr_cfg['limit_leech_ips'] ." IP's"); msg_die('You can leech only from '. $tr_cfg['limit_leech_ips'] ." IP's");
} }
@ -357,7 +357,7 @@ if ($tr_cfg['gold_silver_enabled'] && $down_add)
$down_add = 0; $down_add = 0;
} }
// Silver releases // Silver releases
else if ($tor_type == TOR_TYPE_SILVER) elseif ($tor_type == TOR_TYPE_SILVER)
{ {
$down_add = ceil($down_add/2); $down_add = ceil($down_add/2);
} }

View file

@ -375,7 +375,7 @@ class sql_db
{ {
$info[] = "$ext"; $info[] = "$ext";
} }
else if (!$num && ($aff = $this->affected_rows($this->result) AND $aff != -1)) elseif (!$num && ($aff = $this->affected_rows($this->result) AND $aff != -1))
{ {
$info[] = "$aff rows"; $info[] = "$aff rows";
} }
@ -398,7 +398,7 @@ class sql_db
$this->sql_last_time = 0; $this->sql_last_time = 0;
} }
} }
else if ($mode == 'end') elseif ($mode == 'end')
{ {
if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES) if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES)
{ {

View file

@ -56,7 +56,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update // Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)'; $bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '19-01-2014'; $bb_cfg['tp_release_date'] = '19-01-2014';
$bb_cfg['tp_release_state'] = 'R561'; $bb_cfg['tp_release_state'] = 'R562';
// Database // Database
$charset = 'utf8'; $charset = 'utf8';

View file

@ -321,8 +321,8 @@ class profiler_dbg extends profiler
$perc_class = 'perc'; $perc_class = 'perc';
if ($line_perc > 5) $perc_class .= ' high5'; if ($line_perc > 5) $perc_class .= ' high5';
else if ($line_perc > 3) $perc_class .= ' high3'; elseif ($line_perc > 3) $perc_class .= ' high3';
else if ($line_perc > 1) $perc_class .= ' high1'; elseif ($line_perc > 1) $perc_class .= ' high1';
if ($line_src =& $module_src[$line_no-1]) if ($line_src =& $module_src[$line_no-1])
{ {

View file

@ -19,17 +19,17 @@ if ($mode == 'set_dl_status' || $mode == 'set_topics_dl_status')
$new_dl_status = DL_STATUS_WILL; $new_dl_status = DL_STATUS_WILL;
$dl_key = 'dlw'; $dl_key = 'dlw';
} }
else if (isset($_POST['dl_set_down'])) elseif (isset($_POST['dl_set_down']))
{ {
$new_dl_status = DL_STATUS_DOWN; $new_dl_status = DL_STATUS_DOWN;
$dl_key = 'dld'; $dl_key = 'dld';
} }
else if (isset($_POST['dl_set_complete'])) elseif (isset($_POST['dl_set_complete']))
{ {
$new_dl_status = DL_STATUS_COMPLETE; $new_dl_status = DL_STATUS_COMPLETE;
$dl_key = 'dlc'; $dl_key = 'dlc';
} }
else if (isset($_POST['dl_set_cancel'])) elseif (isset($_POST['dl_set_cancel']))
{ {
$new_dl_status = DL_STATUS_CANCEL; $new_dl_status = DL_STATUS_CANCEL;
$dl_key = 'dla'; $dl_key = 'dla';
@ -139,7 +139,7 @@ if ($mode == 'set_topics_dl_status')
$req_topics_ary[] = (int) $topic_id; $req_topics_ary[] = (int) $topic_id;
} }
} }
else if ($mode == 'set_dl_status') elseif ($mode == 'set_dl_status')
{ {
$req_topics_ary[] = (int) $topic_id; $req_topics_ary[] = (int) $topic_id;
} }

View file

@ -44,7 +44,7 @@ function send_file_to_browser($attachment, $upload_dir)
{ {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} }
else if (!isset($HTTP_USER_AGENT)) elseif (!isset($HTTP_USER_AGENT))
{ {
$HTTP_USER_AGENT = ''; $HTTP_USER_AGENT = '';
} }
@ -54,27 +54,27 @@ function send_file_to_browser($attachment, $upload_dir)
$browser_version = $log_version[2]; $browser_version = $log_version[2];
$browser_agent = 'opera'; $browser_agent = 'opera';
} }
else if (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version)) elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
{ {
$browser_version = $log_version[1]; $browser_version = $log_version[1];
$browser_agent = 'ie'; $browser_agent = 'ie';
} }
else if (preg_match('/OmniWeb\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version)) elseif (preg_match('/OmniWeb\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
{ {
$browser_version = $log_version[1]; $browser_version = $log_version[1];
$browser_agent = 'omniweb'; $browser_agent = 'omniweb';
} }
else if (preg_match('/Netscape([0-9]{1})/', $HTTP_USER_AGENT, $log_version)) elseif (preg_match('/Netscape([0-9]{1})/', $HTTP_USER_AGENT, $log_version))
{ {
$browser_version = $log_version[1]; $browser_version = $log_version[1];
$browser_agent = 'netscape'; $browser_agent = 'netscape';
} }
else if (preg_match('/Mozilla\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version)) elseif (preg_match('/Mozilla\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
{ {
$browser_version = $log_version[1]; $browser_version = $log_version[1];
$browser_agent = 'mozilla'; $browser_agent = 'mozilla';
} }
else if (preg_match('/Konqueror\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version)) elseif (preg_match('/Konqueror\/([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version))
{ {
$browser_version = $log_version[1]; $browser_version = $log_version[1];
$browser_agent = 'konqueror'; $browser_agent = 'konqueror';
@ -120,7 +120,7 @@ function send_file_to_browser($attachment, $upload_dir)
} }
readfile($filename); readfile($filename);
} }
else if (!$gotit && intval($attach_config['allow_ftp_upload'])) elseif (!$gotit && intval($attach_config['allow_ftp_upload']))
{ {
$conn_id = attach_init_ftp(); $conn_id = attach_init_ftp();

View file

@ -15,11 +15,11 @@ function cron_get_file_lock ()
$lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING); $lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
} }
else if (file_exists(CRON_RUNNING)) elseif (file_exists(CRON_RUNNING))
{ {
cron_release_deadlock(); cron_release_deadlock();
} }
else if (!file_exists(CRON_ALLOWED) && !file_exists(CRON_RUNNING)) elseif (!file_exists(CRON_ALLOWED) && !file_exists(CRON_RUNNING))
{ {
file_write('', CRON_ALLOWED); file_write('', CRON_ALLOWED);
$lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING); $lock_obtained = @rename(CRON_ALLOWED, CRON_RUNNING);
@ -37,7 +37,7 @@ function cron_track_running ($mode)
cron_touch_lock_file(CRON_RUNNING); cron_touch_lock_file(CRON_RUNNING);
file_write('', CRON_STARTMARK); file_write('', CRON_STARTMARK);
} }
else if ($mode == 'end') elseif ($mode == 'end')
{ {
@unlink(CRON_STARTMARK); @unlink(CRON_STARTMARK);
} }

View file

@ -33,11 +33,11 @@ if (preg_match('/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si', $_SERVER['QUERY_STRING
$redirect_url[$first_amp] = '?'; $redirect_url[$first_amp] = '?';
} }
} }
else if (!empty($_POST['redirect'])) elseif (!empty($_POST['redirect']))
{ {
$redirect_url = str_replace('&amp;', '&', htmlspecialchars($_POST['redirect'])); $redirect_url = str_replace('&amp;', '&', htmlspecialchars($_POST['redirect']));
} }
else if (!empty($_SERVER['HTTP_REFERER']) && ($parts = @parse_url($_SERVER['HTTP_REFERER']))) elseif (!empty($_SERVER['HTTP_REFERER']) && ($parts = @parse_url($_SERVER['HTTP_REFERER'])))
{ {
$redirect_url = (isset($parts['path']) ? $parts['path'] : "index.php") . (isset($parts['query']) ? '?'. $parts['query'] : ''); $redirect_url = (isset($parts['path']) ? $parts['path'] : "index.php") . (isset($parts['query']) ? '?'. $parts['query'] : '');
} }

View file

@ -28,7 +28,7 @@ function return_msg_mcp ($status_msg)
$message .= sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="'. TOPIC_URL . $topic_id .'">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_TOPIC'], '<a href="'. TOPIC_URL . $topic_id .'">', '</a>');
$message .= '<br /><br />'; $message .= '<br /><br />';
} }
else if (count($req_topics) != 1) elseif (count($req_topics) != 1)
{ {
$message .= sprintf($lang['CLICK_RETURN_MODCP'], '<a href="'. FORUM_URL ."$forum_id&amp;mod=1".'">', '</a>'); $message .= sprintf($lang['CLICK_RETURN_MODCP'], '<a href="'. FORUM_URL ."$forum_id&amp;mod=1".'">', '</a>');
$message .= '<br /><br />'; $message .= '<br /><br />';
@ -78,23 +78,23 @@ else
{ {
$mode = 'delete'; $mode = 'delete';
} }
else if (isset($_REQUEST['move']) || @$_POST['mod_action'] === 'topic_move') elseif (isset($_REQUEST['move']) || @$_POST['mod_action'] === 'topic_move')
{ {
$mode = 'move'; $mode = 'move';
} }
else if (isset($_REQUEST['lock']) || @$_POST['mod_action'] === 'topic_lock') elseif (isset($_REQUEST['lock']) || @$_POST['mod_action'] === 'topic_lock')
{ {
$mode = 'lock'; $mode = 'lock';
} }
else if (isset($_REQUEST['unlock']) || @$_POST['mod_action'] === 'topic_unlock') elseif (isset($_REQUEST['unlock']) || @$_POST['mod_action'] === 'topic_unlock')
{ {
$mode = 'unlock'; $mode = 'unlock';
} }
else if (isset($_REQUEST['post_pin']) || @$_POST['mod_action'] === 'post_pin') elseif (isset($_REQUEST['post_pin']) || @$_POST['mod_action'] === 'post_pin')
{ {
$mode = 'post_pin'; $mode = 'post_pin';
} }
else if (isset($_REQUEST['post_unpin']) || @$_POST['mod_action'] === 'post_unpin') elseif (isset($_REQUEST['post_unpin']) || @$_POST['mod_action'] === 'post_unpin')
{ {
$mode = 'post_unpin'; $mode = 'post_unpin';
} }
@ -122,7 +122,7 @@ if ($topic_id)
$forum_name = $topic_row['forum_name']; $forum_name = $topic_row['forum_name'];
$forum_topics = (!$topic_row['forum_topics']) ? 1 : $topic_row['forum_topics']; $forum_topics = (!$topic_row['forum_topics']) ? 1 : $topic_row['forum_topics'];
} }
else if ($forum_id) elseif ($forum_id)
{ {
$sql = "SELECT forum_name, forum_topics FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1"; $sql = "SELECT forum_name, forum_topics FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
@ -163,7 +163,7 @@ if ($mode == 'ip')
// Moderator can view IP in all forums // Moderator can view IP in all forums
$is_auth['auth_mod'] = $is_moderator; $is_auth['auth_mod'] = $is_moderator;
} }
else if ($mode == 'move' && !$is_auth['auth_mod']) elseif ($mode == 'move' && !$is_auth['auth_mod'])
{ {
// User can move his own topic if this forum is "self_moderated" // User can move his own topic if this forum is "self_moderated"
if ($topic_id && $topic_row['self_moderated'] && $topic_row['topic_poster'] == $userdata['user_id']) if ($topic_id && $topic_row['self_moderated'] && $topic_row['topic_poster'] == $userdata['user_id'])
@ -564,7 +564,7 @@ switch ($mode)
} }
} }
//mpd //mpd
else if ($post_id_sql && $delete_posts) elseif ($post_id_sql && $delete_posts)
{ {
if (!$is_auth['auth_delete']) if (!$is_auth['auth_delete'])
{ {

View file

@ -61,15 +61,15 @@ $is_auth = array();
switch ($mode) switch ($mode)
{ {
case 'newtopic': case 'newtopic':
if(bf($userdata['user_opt'], 'user_opt', 'allow_topic')) if (bf($userdata['user_opt'], 'user_opt', 'allow_topic'))
{ {
bb_die($lang['RULES_POST_CANNOT']); bb_die($lang['RULES_POST_CANNOT']);
} }
if ($topic_type == POST_ANNOUNCE) if ($topic_type == POST_ANNOUNCE)
{ {
$is_auth_type = 'auth_announce'; $is_auth_type = 'auth_announce';
} }
else if ($topic_type == POST_STICKY) elseif ($topic_type == POST_STICKY)
{ {
$is_auth_type = 'auth_sticky'; $is_auth_type = 'auth_sticky';
} }
@ -77,32 +77,37 @@ switch ($mode)
{ {
$is_auth_type = 'auth_post'; $is_auth_type = 'auth_post';
} }
break; break;
case 'reply': case 'reply':
case 'quote': case 'quote':
if(bf($userdata['user_opt'], 'user_opt', 'allow_post')) if (bf($userdata['user_opt'], 'user_opt', 'allow_post'))
{ {
bb_die($lang['RULES_REPLY_CANNOT']); bb_die($lang['RULES_REPLY_CANNOT']);
} }
$is_auth_type = 'auth_reply'; $is_auth_type = 'auth_reply';
break; break;
case 'editpost': case 'editpost':
if(bf($userdata['user_opt'], 'user_opt', 'allow_post_edit')) if (bf($userdata['user_opt'], 'user_opt', 'allow_post_edit'))
{ {
bb_die($lang['RULES_EDIT_CANNOT']); bb_die($lang['RULES_EDIT_CANNOT']);
} }
$is_auth_type = 'auth_edit'; $is_auth_type = 'auth_edit';
break; break;
case 'delete': case 'delete':
case 'poll_delete': case 'poll_delete':
$is_auth_type = 'auth_delete'; $is_auth_type = 'auth_delete';
break; break;
case 'vote': case 'vote':
$is_auth_type = 'auth_vote'; $is_auth_type = 'auth_vote';
break; break;
default: default:
message_die(GENERAL_MESSAGE, $lang['NO_POST_MODE']); message_die(GENERAL_MESSAGE, $lang['NO_POST_MODE']);
break; break;
} }
// Here we do various lookups to find topic_id, forum_id, post_id etc. // Here we do various lookups to find topic_id, forum_id, post_id etc.
@ -117,7 +122,7 @@ switch ($mode)
message_die(GENERAL_MESSAGE, $lang['FORUM_NOT_EXIST']); message_die(GENERAL_MESSAGE, $lang['FORUM_NOT_EXIST']);
} }
$sql = "SELECT * FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1"; $sql = "SELECT * FROM ". BB_FORUMS ." WHERE forum_id = $forum_id LIMIT 1";
break; break;
case 'reply': case 'reply':
case 'vote': case 'vote':
@ -130,7 +135,7 @@ switch ($mode)
WHERE t.topic_id = $topic_id WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
LIMIT 1"; LIMIT 1";
break; break;
case 'quote': case 'quote':
case 'editpost': case 'editpost':
@ -158,7 +163,7 @@ switch ($mode)
" : ''; " : '';
$sql = "$select_sql $from_sql $where_sql LIMIT 1"; $sql = "$select_sql $from_sql $where_sql LIMIT 1";
break; break;
default: default:
message_die(GENERAL_MESSAGE, $lang['NO_VALID_MODE']); message_die(GENERAL_MESSAGE, $lang['NO_VALID_MODE']);
@ -175,7 +180,7 @@ if ($post_info = DB()->fetch_row($sql))
{ {
message_die(GENERAL_MESSAGE, $lang['FORUM_LOCKED']); message_die(GENERAL_MESSAGE, $lang['FORUM_LOCKED']);
} }
else if ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod']) elseif ($mode != 'newtopic' && $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
{ {
message_die(GENERAL_MESSAGE, $lang['TOPIC_LOCKED']); message_die(GENERAL_MESSAGE, $lang['TOPIC_LOCKED']);
} }
@ -235,11 +240,11 @@ if ($post_info = DB()->fetch_row($sql))
message_die(GENERAL_MESSAGE, $message); message_die(GENERAL_MESSAGE, $message);
} }
else if (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete)) elseif (!$post_data['last_post'] && !$is_auth['auth_mod'] && ($mode == 'delete' || $delete))
{ {
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_REPLIED']); message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_REPLIED']);
} }
else if (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete)) elseif (!$post_data['edit_poll'] && !$is_auth['auth_mod'] && ($mode == 'poll_delete' || $poll_delete))
{ {
message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_POLL']); message_die(GENERAL_MESSAGE, $lang['CANNOT_DELETE_POLL']);
} }
@ -405,7 +410,7 @@ if ( ( $delete || $poll_delete || $mode == 'delete' ) && !$confirm )
'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields), 'HIDDEN_FIELDS' => build_hidden_fields($hidden_fields),
)); ));
} }
else if ( $mode == 'vote' ) elseif ( $mode == 'vote' )
{ {
// //
// Vote in a poll // Vote in a poll
@ -480,8 +485,8 @@ else if ( $mode == 'vote' )
} }
} }
//snp //snp
// else if ( $submit || $confirm ) // elseif ( $submit || $confirm )
else if ( ($submit || $confirm) && !$topic_has_new_posts ) elseif ( ($submit || $confirm) && !$topic_has_new_posts )
//snp end //snp end
{ {
// //
@ -611,11 +616,11 @@ if( $refresh || isset($_POST['del_poll_option']) || $error_msg || ($submit && $t
# while( list($option_id, $option_text) = @each($_POST['poll_option_text']) ) # while( list($option_id, $option_text) = @each($_POST['poll_option_text']) )
foreach ($_POST['poll_option_text'] as $option_id => $option_text) foreach ($_POST['poll_option_text'] as $option_id => $option_text)
{ {
if( isset($_POST['del_poll_option'][$option_id]) ) if (isset($_POST['del_poll_option'][$option_id]))
{ {
unset($poll_options[$option_id]); unset($poll_options[$option_id]);
} }
else if ( !empty($option_text) ) elseif (!empty($option_text))
{ {
$poll_options[$option_id] = clean_title($option_text); $poll_options[$option_id] = clean_title($option_text);
} }
@ -655,13 +660,13 @@ else
$subject = ''; $subject = '';
$message = ''; $message = '';
} }
else if ( $mode == 'reply' ) elseif ( $mode == 'reply' )
{ {
$username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : ''; $username = ( $userdata['session_logged_in'] ) ? $userdata['username'] : '';
$subject = ''; $subject = '';
$message = ''; $message = '';
} }
else if ( $mode == 'quote' || $mode == 'editpost' ) elseif ( $mode == 'quote' || $mode == 'editpost' )
{ {
$subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : ''; $subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : '';
$message = $post_info['post_text']; $message = $post_info['post_text'];

View file

@ -53,7 +53,7 @@ if ($only_new == ONLY_NEW_POSTS)
{ {
$only_new_sql = "AND t.topic_last_post_time > $lastvisit"; $only_new_sql = "AND t.topic_last_post_time > $lastvisit";
} }
else if ($only_new == ONLY_NEW_TOPICS) elseif ($only_new == ONLY_NEW_TOPICS)
{ {
$only_new_sql = "AND t.topic_time > $lastvisit"; $only_new_sql = "AND t.topic_time > $lastvisit";
} }
@ -181,12 +181,12 @@ if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums'])
{ {
$folder_image = $images['forum_locked']; $folder_image = $images['forum_locked'];
} }
else if (is_unread($sf_data['topic_last_post_time'], $sf_last_tid, $sf_forum_id)) elseif (is_unread($sf_data['topic_last_post_time'], $sf_last_tid, $sf_forum_id))
{ {
$folder_image = $images['forum_new']; $folder_image = $images['forum_new'];
} }
$last_post_user = profile_url(array('username' => $sf_data['sf_last_username'], 'user_id' => $sf_data['sf_last_user_id'], 'user_rank' => $sf_data['user_rank'])); $last_post_user = profile_url(array('username' => $sf_data['sf_last_username'], 'user_id' => $sf_data['sf_last_user_id'], 'user_rank' => $sf_data['user_rank']));
if ($sf_data['forum_last_post_id']) if ($sf_data['forum_last_post_id'])
{ {
@ -226,7 +226,7 @@ if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums'])
} }
} }
} }
else if ($parent_id = $forum_data['forum_parent']) elseif ($parent_id = $forum_data['forum_parent'])
{ {
$template->assign_vars(array( $template->assign_vars(array(
'HAS_PARENT_FORUM' => true, 'HAS_PARENT_FORUM' => true,
@ -475,12 +475,12 @@ foreach ($topic_rowset as $topic)
define('ANNOUNCE_SEP', true); define('ANNOUNCE_SEP', true);
$separator = $lang['TOPICS_ANNOUNCEMENT']; $separator = $lang['TOPICS_ANNOUNCEMENT'];
} }
else if ($t_type == POST_STICKY && !defined('STICKY_SEP')) elseif ($t_type == POST_STICKY && !defined('STICKY_SEP'))
{ {
define('STICKY_SEP', true); define('STICKY_SEP', true);
$separator = $lang['TOPICS_STICKY']; $separator = $lang['TOPICS_STICKY'];
} }
else if ($t_type == POST_NORMAL && !defined('NORMAL_SEP')) elseif ($t_type == POST_NORMAL && !defined('NORMAL_SEP'))
{ {
if (defined('ANNOUNCE_SEP') || defined('STICKY_SEP')) if (defined('ANNOUNCE_SEP') || defined('STICKY_SEP'))
{ {

View file

@ -94,7 +94,7 @@ if ($topic_id)
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
LIMIT 1"; LIMIT 1";
} }
else if ($post_id) elseif ($post_id)
{ {
$sql = "SELECT t.*, f.*, p.post_time $sql = "SELECT t.*, f.*, p.post_time
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p
@ -496,7 +496,7 @@ if ( $is_auth['auth_mod'] )
} }
} }
} }
else if (($t_data['topic_poster'] == $userdata['user_id']) && $userdata['session_logged_in'] && $t_data['self_moderated']) elseif (($t_data['topic_poster'] == $userdata['user_id']) && $userdata['session_logged_in'] && $t_data['self_moderated'])
{ {
$topic_mod .= "<a href=\"modcp.php?" . POST_TOPIC_URL . "=$topic_id&amp;mode=move&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['MOVE_TOPIC'] . '" title="' . $lang['MOVE_TOPIC'] . '" border="0" /></a>&nbsp;'; $topic_mod .= "<a href=\"modcp.php?" . POST_TOPIC_URL . "=$topic_id&amp;mode=move&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['MOVE_TOPIC'] . '" title="' . $lang['MOVE_TOPIC'] . '" border="0" /></a>&nbsp;';
} }
@ -852,7 +852,7 @@ for($i = 0; $i < $total_posts; $i++)
{ {
$user_sig = $lang['SIGNATURE_DISABLE']; $user_sig = $lang['SIGNATURE_DISABLE'];
} }
else if ($user_sig) elseif ($user_sig)
{ {
$user_sig = bbcode2html($user_sig); $user_sig = bbcode2html($user_sig);
} }
@ -938,7 +938,7 @@ for($i = 0; $i < $total_posts; $i++)
{ {
$post_mod_comment_html = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C"><a href="profile.php?mode=viewprofile&u='. $postrow[$i]['post_mc_mod_id'] .'">'. $postrow[$i]['post_mc_mod_name'] .'</a> '. $lang['WROTE'] .':<br /><br />'. bbcode2html($postrow[$i]['post_mod_comment']) .'</td></tr></table></div>'; $post_mod_comment_html = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1C">K</td><td class="mcTd2C"><a href="profile.php?mode=viewprofile&u='. $postrow[$i]['post_mc_mod_id'] .'">'. $postrow[$i]['post_mc_mod_name'] .'</a> '. $lang['WROTE'] .':<br /><br />'. bbcode2html($postrow[$i]['post_mod_comment']) .'</td></tr></table></div>';
} }
else if ($postrow[$i]['post_mod_comment_type'] == 2) elseif ($postrow[$i]['post_mod_comment_type'] == 2)
{ {
$post_mod_comment_html = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W"><a href="profile.php?mode=viewprofile&u='. $postrow[$i]['post_mc_mod_id'] .'">'. $postrow[$i]['post_mc_mod_name'] .'</a> '. $lang['WROTE'] .':<br /><br />'. bbcode2html($postrow[$i]['post_mod_comment']) .'</td></tr></table></div>'; $post_mod_comment_html = '<div class="mcBlock"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="mcTd1W">!</td><td class="mcTd2W"><a href="profile.php?mode=viewprofile&u='. $postrow[$i]['post_mc_mod_id'] .'">'. $postrow[$i]['post_mc_mod_name'] .'</a> '. $lang['WROTE'] .':<br /><br />'. bbcode2html($postrow[$i]['post_mod_comment']) .'</td></tr></table></div>';
} }