diff options
Diffstat (limited to 'phpBB/includes/functions_admin.php')
| -rw-r--r-- | phpBB/includes/functions_admin.php | 752 | 
1 files changed, 285 insertions, 467 deletions
| diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3e69a997a2..d72f89b6ac 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2,9 +2,8 @@  /**  *  * @package acp -* @version $Id$  * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -619,7 +618,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)  */  function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true)  { -	global $db, $config; +	global $db, $config, $phpbb_container;  	$approved_topics = 0;  	$forum_ids = $topic_ids = array(); @@ -645,7 +644,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  		'posts' => ($call_delete_posts) ? delete_posts($where_type, $where_ids, false, true, $post_count_sync, false) : 0,  	); -	$sql = 'SELECT topic_id, forum_id, topic_approved, topic_moved_id +	$sql = 'SELECT topic_id, forum_id, topic_visibility, topic_moved_id  		FROM ' . TOPICS_TABLE . '  		WHERE ' . $where_clause;  	$result = $db->sql_query($sql); @@ -655,7 +654,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  		$forum_ids[] = $row['forum_id'];  		$topic_ids[] = $row['topic_id']; -		if ($row['topic_approved'] && !$row['topic_moved_id']) +		if ($row['topic_visibility'] == ITEM_APPROVED && !$row['topic_moved_id'])  		{  			$approved_topics++;  		} @@ -716,6 +715,14 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  		set_config_count('num_topics', $approved_topics * (-1), true);  	} +	$phpbb_notifications = $phpbb_container->get('notification_manager'); + +	$phpbb_notifications->delete_notifications(array( +		'topic', +		'approve_topic', +		'topic_in_queue', +	), $topic_ids); +  	return $return;  } @@ -724,7 +731,32 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s  */  function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true)  { -	global $db, $config, $phpbb_root_path, $phpEx; +	global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container, $phpbb_dispatcher; + +	// Notifications types to delete +	$delete_notifications_types = array( +		'quote', +		'bookmark', +		'post', +		'approve_post', +		'post_in_queue', +	); + +	/** +	* Perform additional actions before post(s) deletion +	* +	* @event core.delete_posts_before +	* @var	string	where_type					Variable containing posts deletion mode  +	* @var	mixed	where_ids					Array or comma separated list of posts ids to delete +	* @var	bool	auto_sync					Flag indicating if topics/forums should be synchronized +	* @var	bool	posted_sync					Flag indicating if topics_posted table should be resynchronized +	* @var	bool	post_count_sync				Flag indicating if posts count should be resynchronized +	* @var	bool	call_delete_topics			Flag indicating if topics having no posts should be deleted +	* @var	array	delete_notifications_types	Array with notifications types to delete +	* @since 3.1.0-a4 +	*/ +	$vars = array('where_type', 'where_ids', 'auto_sync', 'posted_sync', 'post_count_sync', 'call_delete_topics', 'delete_notifications_types'); +	extract($phpbb_dispatcher->trigger_event('core.delete_posts_before', compact($vars)));  	if ($where_type === 'range')  	{ @@ -768,7 +800,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  	$approved_posts = 0;  	$post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array(); -	$sql = 'SELECT post_id, poster_id, post_approved, post_postcount, topic_id, forum_id +	$sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id  		FROM ' . POSTS_TABLE . '  		WHERE ' . $where_clause;  	$result = $db->sql_query($sql); @@ -780,12 +812,12 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  		$topic_ids[] = (int) $row['topic_id'];  		$forum_ids[] = (int) $row['forum_id']; -		if ($row['post_postcount'] && $post_count_sync && $row['post_approved']) +		if ($row['post_postcount'] && $post_count_sync && $row['post_visibility'] == ITEM_APPROVED)  		{  			$post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;  		} -		if ($row['post_approved']) +		if ($row['post_visibility'] == ITEM_APPROVED)  		{  			$approved_posts++;  		} @@ -848,17 +880,15 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  	}  	// Remove the message from the search index -	$search_type = basename($config['search_type']); +	$search_type = $config['search_type']; -	if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) +	if (!class_exists($search_type))  	{  		trigger_error('NO_SUCH_SEARCH_MODULE');  	} -	include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx"); -  	$error = false; -	$search = new $search_type($error); +	$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user);  	if ($error)  	{ @@ -869,8 +899,40 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  	delete_attachments('post', $post_ids, false); +	/** +	* Perform additional actions during post(s) deletion +	* +	* @event core.delete_posts_in_transaction +	* @var	array	post_ids					Array with deleted posts' ids +	* @var	array	poster_ids					Array with deleted posts' author ids +	* @var	array	topic_ids					Array with deleted posts' topic ids +	* @var	array	forum_ids					Array with deleted posts' forum ids +	* @var	string	where_type					Variable containing posts deletion mode  +	* @var	mixed	where_ids					Array or comma separated list of posts ids to delete +	* @var	array	delete_notifications_types	Array with notifications types to delete +	* @since 3.1.0-a4 +	*/ +	$vars = array('post_ids', 'poster_ids', 'topic_ids', 'forum_ids', 'where_type', 'where_ids', 'delete_notifications_types'); +	extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction', compact($vars))); +  	$db->sql_transaction('commit'); +	/** +	* Perform additional actions after post(s) deletion +	* +	* @event core.delete_posts_after +	* @var	array	post_ids					Array with deleted posts' ids +	* @var	array	poster_ids					Array with deleted posts' author ids +	* @var	array	topic_ids					Array with deleted posts' topic ids +	* @var	array	forum_ids					Array with deleted posts' forum ids +	* @var	string	where_type					Variable containing posts deletion mode  +	* @var	mixed	where_ids					Array or comma separated list of posts ids to delete +	* @var	array	delete_notifications_types	Array with notifications types to delete +	* @since 3.1.0-a4 +	*/ +	$vars = array('post_ids', 'poster_ids', 'topic_ids', 'forum_ids', 'where_type', 'where_ids', 'delete_notifications_types'); +	extract($phpbb_dispatcher->trigger_event('core.delete_posts_after', compact($vars))); +  	// Resync topics_posted table  	if ($posted_sync)  	{ @@ -884,7 +946,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  		sync('forum', 'forum_id', $forum_ids, true, true);  	} -	if ($approved_posts) +	if ($approved_posts && $post_count_sync)  	{  		set_config_count('num_posts', $approved_posts * (-1), true);  	} @@ -895,6 +957,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =  		delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false);  	} +	$phpbb_notifications = $phpbb_container->get('notification_manager'); + +	$phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); +  	return sizeof($post_ids);  } @@ -1277,7 +1343,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false)  * - forum				Resync complete forum  * - topic				Resync topics  * - topic_moved			Removes topic shadows that would be in the same forum as the topic they link to -* - topic_approved		Resyncs the topic_approved flag according to the status of the first post +* - topic_visibility	Resyncs the topic_visibility flag according to the status of the first post  * - post_reported		Resyncs the post_reported flag, relying on actual reports  * - topic_reported		Resyncs the topic_reported flag, relying on post_reported flags  * - post_attachement	Same as post_reported, but with attachment flags @@ -1297,7 +1363,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  		$where_ids = ($where_ids) ? array((int) $where_ids) : array();  	} -	if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_approved' || $mode == 'topic_reported' || $mode == 'post_reported') +	if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_visibility' || $mode == 'topic_reported' || $mode == 'post_reported')  	{  		if (!$where_type)  		{ @@ -1383,43 +1449,55 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			$db->sql_transaction('commit');  			break; -		case 'topic_approved': +		case 'topic_visibility':  			$db->sql_transaction('begin'); -			switch ($db->sql_layer) + +			$sql = 'SELECT t.topic_id, p.post_visibility +				FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p +				$where_sql_and p.topic_id = t.topic_id +					AND p.post_visibility = " . ITEM_APPROVED; +			$result = $db->sql_query($sql); + +			$topics_approved = array(); +			while ($row = $db->sql_fetchrow($result))  			{ -				case 'mysql4': -				case 'mysqli': -					$sql = 'UPDATE ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p -						SET t.topic_approved = p.post_approved -						$where_sql_and t.topic_first_post_id = p.post_id"; -					$db->sql_query($sql); -				break; +				$topics_approved[] = (int) $row['topic_id']; +			} +			$db->sql_freeresult($result); -				default: -					$sql = 'SELECT t.topic_id, p.post_approved -						FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p -						$where_sql_and p.post_id = t.topic_first_post_id -							AND p.post_approved <> t.topic_approved"; -					$result = $db->sql_query($sql); +			$sql = 'SELECT t.topic_id, p.post_visibility +				FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p +				$where_sql_and " . $db->sql_in_set('t.topic_id', $topics_approved, true, true) . ' +					AND p.topic_id = t.topic_id +					AND p.post_visibility = ' . ITEM_DELETED; +			$result = $db->sql_query($sql); -					$topic_ids = array(); -					while ($row = $db->sql_fetchrow($result)) -					{ -						$topic_ids[] = $row['topic_id']; -					} -					$db->sql_freeresult($result); +			$topics_softdeleted = array(); +			while ($row = $db->sql_fetchrow($result)) +			{ +				$topics_softdeleted[] = (int) $row['topic_id']; +			} +			$db->sql_freeresult($result); -					if (!sizeof($topic_ids)) -					{ -						return; -					} +			$topics_softdeleted = array_diff($topics_softdeleted, $topics_approved); +			$topics_not_unapproved = array_merge($topics_softdeleted, $topics_approved); + +			$update_ary = array( +				ITEM_UNAPPROVED	=> (!empty($topics_not_unapproved)) ? $where_sql_and . ' ' . $db->sql_in_set('topic_id', $topics_not_unapproved, true) : '', +				ITEM_APPROVED	=> (!empty($topics_approved)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_approved) : '', +				ITEM_DELETED	=> (!empty($topics_softdeleted)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_softdeleted) : '', +			); +			foreach ($topic_visiblities as $visibility => $sql_where) +			{ +				if ($sql_where) +				{  					$sql = 'UPDATE ' . TOPICS_TABLE . ' -						SET topic_approved = 1 - topic_approved -						WHERE ' . $db->sql_in_set('topic_id', $topic_ids); +						SET topic_visibility = ' . $visibility . ' +						' . $sql_where;  					$db->sql_query($sql); -				break; +				}  			}  			$db->sql_transaction('commit'); @@ -1660,9 +1738,12 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				$forum_data[$forum_id] = $row;  				if ($sync_extra)  				{ -					$forum_data[$forum_id]['posts'] = 0; -					$forum_data[$forum_id]['topics'] = 0; -					$forum_data[$forum_id]['topics_real'] = 0; +					$forum_data[$forum_id]['posts_approved'] = 0; +					$forum_data[$forum_id]['posts_unapproved'] = 0; +					$forum_data[$forum_id]['posts_softdeleted'] = 0; +					$forum_data[$forum_id]['topics_approved'] = 0; +					$forum_data[$forum_id]['topics_unapproved'] = 0; +					$forum_data[$forum_id]['topics_softdeleted'] = 0;  				}  				$forum_data[$forum_id]['last_post_id'] = 0;  				$forum_data[$forum_id]['last_post_subject'] = ''; @@ -1683,20 +1764,27 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			// 2: Get topic counts for each forum (optional)  			if ($sync_extra)  			{ -				$sql = 'SELECT forum_id, topic_approved, COUNT(topic_id) AS forum_topics +				$sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS total_topics  					FROM ' . TOPICS_TABLE . '  					WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' -					GROUP BY forum_id, topic_approved'; +					GROUP BY forum_id, topic_visibility';  				$result = $db->sql_query($sql);  				while ($row = $db->sql_fetchrow($result))  				{  					$forum_id = (int) $row['forum_id']; -					$forum_data[$forum_id]['topics_real'] += $row['forum_topics']; -					if ($row['topic_approved']) +					if ($row['topic_visibility'] == ITEM_APPROVED) +					{ +						$forum_data[$forum_id]['topics_approved'] = $row['total_topics']; +					} +					else if ($row['topic_visibility'] == ITEM_UNAPPROVED)  					{ -						$forum_data[$forum_id]['topics'] = $row['forum_topics']; +						$forum_data[$forum_id]['topics_unapproved'] = $row['total_topics']; +					} +					else if ($row['topic_visibility'] == ITEM_DELETED) +					{ +						$forum_data[$forum_id]['topics_softdeleted'] = $row['total_topics'];  					}  				}  				$db->sql_freeresult($result); @@ -1707,18 +1795,16 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			{  				if (sizeof($forum_ids) == 1)  				{ -					$sql = 'SELECT SUM(t.topic_replies + 1) AS forum_posts +					$sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted  						FROM ' . TOPICS_TABLE . ' t  						WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' -							AND t.topic_approved = 1  							AND t.topic_status <> ' . ITEM_MOVED;  				}  				else  				{ -					$sql = 'SELECT t.forum_id, SUM(t.topic_replies + 1) AS forum_posts +					$sql = 'SELECT t.forum_id, SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted  						FROM ' . TOPICS_TABLE . ' t  						WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' -							AND t.topic_approved = 1  							AND t.topic_status <> ' . ITEM_MOVED . '  						GROUP BY t.forum_id';  				} @@ -1729,7 +1815,9 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				{  					$forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; -					$forum_data[$forum_id]['posts'] = (int) $row['forum_posts']; +					$forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved']; +					$forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; +					$forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted'];  				}  				$db->sql_freeresult($result);  			} @@ -1740,14 +1828,14 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				$sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id  					FROM ' . TOPICS_TABLE . ' t  					WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' -						AND t.topic_approved = 1'; +						AND t.topic_visibility = ' . ITEM_APPROVED;  			}  			else  			{  				$sql = 'SELECT t.forum_id, MAX(t.topic_last_post_id) as last_post_id  					FROM ' . TOPICS_TABLE . ' t  					WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' -						AND t.topic_approved = 1 +						AND t.topic_visibility = ' . ITEM_APPROVED . '  					GROUP BY t.forum_id';  			} @@ -1810,7 +1898,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			if ($sync_extra)  			{ -				array_push($fieldnames, 'posts', 'topics', 'topics_real'); +				array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted');  			}  			foreach ($forum_data as $forum_id => $row) @@ -1845,11 +1933,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			break;  		case 'topic': -			$topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); +			$topic_data = $post_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array();  			$db->sql_transaction('begin'); -			$sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time +			$sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_visibility, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time  				FROM ' . TOPICS_TABLE . " t  				$where_sql";  			$result = $db->sql_query($sql); @@ -1864,8 +1952,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				$topic_id = (int) $row['topic_id'];  				$topic_data[$topic_id] = $row; -				$topic_data[$topic_id]['replies_real'] = -1; -				$topic_data[$topic_id]['replies'] = 0; +				$topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED; +				$topic_data[$topic_id]['posts_approved'] = 0; +				$topic_data[$topic_id]['posts_unapproved'] = 0; +				$topic_data[$topic_id]['posts_softdeleted'] = 0;  				$topic_data[$topic_id]['first_post_id'] = 0;  				$topic_data[$topic_id]['last_post_id'] = 0;  				unset($topic_data[$topic_id]['topic_id']); @@ -1882,11 +1972,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  			$db->sql_freeresult($result);  			// Use "t" as table alias because of the $where_sql clause -			// NOTE: 't.post_approved' in the GROUP BY is causing a major slowdown. -			$sql = 'SELECT t.topic_id, t.post_approved, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id +			// NOTE: 't.post_visibility' in the GROUP BY is causing a major slowdown. +			$sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id  				FROM ' . POSTS_TABLE . " t  				$where_sql -				GROUP BY t.topic_id, t.post_approved"; +				GROUP BY t.topic_id, t.post_visibility";  			$result = $db->sql_query($sql);  			while ($row = $db->sql_fetchrow($result)) @@ -1907,14 +1997,38 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  					// When we'll be done, only topics with no posts will remain  					unset($delete_topics[$topic_id]); -					$topic_data[$topic_id]['replies_real'] += $row['total_posts']; -					$topic_data[$topic_id]['first_post_id'] = (!$topic_data[$topic_id]['first_post_id']) ? $row['first_post_id'] : min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']); +					if ($row['post_visibility'] == ITEM_APPROVED) +					{ +						$topic_data[$topic_id]['posts_approved'] = $row['total_posts']; +					} +					else if ($row['post_visibility'] == ITEM_UNAPPROVED) +					{ +						$topic_data[$topic_id]['posts_unapproved'] = $row['total_posts']; +					} +					else if ($row['post_visibility'] == ITEM_DELETED) +					{ +						$topic_data[$topic_id]['posts_softdeleted'] = $row['total_posts']; +					} -					if ($row['post_approved'] || !$topic_data[$topic_id]['last_post_id']) +					if ($row['post_visibility'] == ITEM_APPROVED)  					{ -						$topic_data[$topic_id]['replies'] = $row['total_posts'] - 1; +						$topic_data[$topic_id]['visibility'] = ITEM_APPROVED; +						$topic_data[$topic_id]['first_post_id'] = $row['first_post_id'];  						$topic_data[$topic_id]['last_post_id'] = $row['last_post_id'];  					} +					else if ($topic_data[$topic_id]['visibility'] != ITEM_APPROVED) +					{ +						// If there is no approved post, we take the min/max of the other visibilities +						// for the last and first post info, because it is only visible to moderators anyway +						$topic_data[$topic_id]['first_post_id'] = (!empty($topic_data[$topic_id]['first_post_id'])) ? min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']) : $row['first_post_id']; +						$topic_data[$topic_id]['last_post_id'] = max($topic_data[$topic_id]['last_post_id'], $row['last_post_id']); + +						if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED) +						{ +							// Soft delete status is stronger than unapproved. +							$topic_data[$topic_id]['visibility'] = $row['post_visibility']; +						} +					}  				}  			}  			$db->sql_freeresult($result); @@ -1955,7 +2069,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				unset($delete_topics, $delete_topic_ids);  			} -			$sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour +			$sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour  				FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u  				WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '  					AND u.user_id = p.poster_id'; @@ -1968,10 +2082,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				if ($row['post_id'] == $topic_data[$topic_id]['first_post_id'])  				{ -					if ($topic_data[$topic_id]['topic_approved'] != $row['post_approved']) -					{ -						$approved_unapproved_ids[] = $topic_id; -					}  					$topic_data[$topic_id]['time'] = $row['post_time'];  					$topic_data[$topic_id]['poster'] = $row['poster_id'];  					$topic_data[$topic_id]['first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; @@ -2032,7 +2142,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				$sync_shadow_topics = array();  				if (sizeof($post_ids))  				{ -					$sql = 'SELECT p.post_id, p.topic_id, p.post_approved, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour +					$sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour  						FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u  						WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '  							AND u.user_id = p.poster_id'; @@ -2099,18 +2209,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,  				unset($sync_shadow_topics, $shadow_topic_data);  			} -			// approved becomes unapproved, and vice-versa -			if (sizeof($approved_unapproved_ids)) -			{ -				$sql = 'UPDATE ' . TOPICS_TABLE . ' -					SET topic_approved = 1 - topic_approved -					WHERE ' . $db->sql_in_set('topic_id', $approved_unapproved_ids); -				$db->sql_query($sql); -			} -			unset($approved_unapproved_ids); -  			// These are fields that will be synchronised -			$fieldnames = array('time', 'replies', 'replies_real', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); +			$fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour');  			if ($sync_extra)  			{ @@ -2208,6 +2308,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync  	if (!($prune_flags & FORUM_FLAG_PRUNE_ANNOUNCE))  	{  		$sql_and .= ' AND topic_type <> ' . POST_ANNOUNCE; +		$sql_and .= ' AND topic_type <> ' . POST_GLOBAL;  	}  	if (!($prune_flags & FORUM_FLAG_PRUNE_STICKY)) @@ -2225,6 +2326,11 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync  		$sql_and .= " AND topic_last_view_time < $prune_date";  	} +	if ($prune_mode == 'shadow') +	{ +		$sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; +	} +  	$sql = 'SELECT topic_id  		FROM ' . TOPICS_TABLE . '  		WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " @@ -2294,28 +2400,17 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr  }  /** -* remove_comments will strip the sql comment lines out of an uploaded sql file -* specifically for mssql and postgres type files in the install.... +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table.  * -* @deprecated		Use phpbb_remove_comments() instead. +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\cache\driver\driver_interface Cache driver +* @param \phpbb\auth\auth $auth Authentication object +* @return null  */ -function remove_comments(&$output) +function phpbb_cache_moderators($db, $cache, $auth)  { -	// Remove /* */ comments (http://ostermiller.org/findcomment.html) -	$output = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $output); - -	// Return by reference and value. -	return $output; -} - -/** -* Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username -* and group names must be carried through for the moderators table -*/ -function cache_moderators() -{ -	global $db, $cache, $auth, $phpbb_root_path, $phpEx; -  	// Remove cached sql results  	$cache->destroy('sql', MODERATOR_CACHE_TABLE); @@ -2345,7 +2440,7 @@ function cache_moderators()  		$ug_id_ary = array_keys($hold_ary);  		// Remove users who have group memberships with DENY moderator permissions -		$sql = $db->sql_build_query('SELECT', array( +		$sql_ary_deny = array(  			'SELECT'	=> 'a.forum_id, ug.user_id, g.group_id',  			'FROM'		=> array( @@ -2358,8 +2453,8 @@ function cache_moderators()  			'LEFT_JOIN'	=> array(  				array(  					'FROM'	=> array(ACL_ROLES_DATA_TABLE => 'r'), -					'ON'	=> 'a.auth_role_id = r.role_id' -				) +					'ON'	=> 'a.auth_role_id = r.role_id', +				),  			),  			'WHERE'		=> '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id) @@ -2371,7 +2466,8 @@ function cache_moderators()  				AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "  				AND ug.user_pending = 0  				AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char), -		)); +		); +		$sql = $db->sql_build_query('SELECT', $sql_ary_deny);  		$result = $db->sql_query($sql);  		while ($row = $db->sql_fetchrow($result)) @@ -2485,303 +2581,60 @@ function cache_moderators()  }  /** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @deprecated 3.1 +* @return null +*/ +function cache_moderators() +{ +	global $db, $cache, $auth; +	return phpbb_cache_moderators($db, $cache, $auth); +} + +/**  * View log -* If $log_count is set to false, we will skip counting all entries in the database. +* +* @param	string	$mode			The mode defines which log_type is used and from which log the entry is retrieved +* @param	array	&$log			The result array with the logs +* @param	mixed	&$log_count		If $log_count is set to false, we will skip counting all entries in the database. +*									Otherwise an integer with the number of total matching entries is returned. +* @param	int		$limit			Limit the number of entries that are returned +* @param	int		$offset			Offset when fetching the log entries, f.e. when paginating +* @param	mixed	$forum_id		Restrict the log entries to the given forum_id (can also be an array of forum_ids) +* @param	int		$topic_id		Restrict the log entries to the given topic_id +* @param	int		$user_id		Restrict the log entries to the given user_id +* @param	int		$log_time		Only get log entries newer than the given timestamp +* @param	string	$sort_by		SQL order option, e.g. 'l.log_time DESC' +* @param	string	$keywords		Will only return log entries that have the keywords in log_operation or log_data +* +* @return	int				Returns the offset of the last valid page, if the specified offset was invalid (too high)  */  function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '')  { -	global $db, $user, $auth, $phpEx, $phpbb_root_path, $phpbb_admin_path; - -	$topic_id_list = $reportee_id_list = $is_auth = $is_mod = array(); - -	$profile_url = (defined('IN_ADMIN')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview') : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile'); - -	switch ($mode) -	{ -		case 'admin': -			$log_type = LOG_ADMIN; -			$sql_forum = ''; -		break; - -		case 'mod': -			$log_type = LOG_MOD; -			$sql_forum = ''; - -			if ($topic_id) -			{ -				$sql_forum = 'AND l.topic_id = ' . (int) $topic_id; -			} -			else if (is_array($forum_id)) -			{ -				$sql_forum = 'AND ' . $db->sql_in_set('l.forum_id', array_map('intval', $forum_id)); -			} -			else if ($forum_id) -			{ -				$sql_forum = 'AND l.forum_id = ' . (int) $forum_id; -			} -		break; - -		case 'user': -			$log_type = LOG_USERS; -			$sql_forum = 'AND l.reportee_id = ' . (int) $user_id; -		break; - -		case 'users': -			$log_type = LOG_USERS; -			$sql_forum = ''; -		break; - -		case 'critical': -			$log_type = LOG_CRITICAL; -			$sql_forum = ''; -		break; - -		default: -			return; -	} - -	// Use no preg_quote for $keywords because this would lead to sole backslashes being added -	// We also use an OR connection here for spaces and the | string. Currently, regex is not supported for searching (but may come later). -	$keywords = preg_split('#[\s|]+#u', utf8_strtolower($keywords), 0, PREG_SPLIT_NO_EMPTY); -	$sql_keywords = ''; - -	if (!empty($keywords)) -	{ -		$keywords_pattern = array(); - -		// Build pattern and keywords... -		for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++) -		{ -			$keywords_pattern[] = preg_quote($keywords[$i], '#'); -			$keywords[$i] = $db->sql_like_expression($db->any_char . $keywords[$i] . $db->any_char); -		} - -		$keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui'; - -		$operations = array(); -		foreach ($user->lang as $key => $value) -		{ -			if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value)) -			{ -				$operations[] = $key; -			} -		} - -		$sql_keywords = 'AND ('; -		if (!empty($operations)) -		{ -			$sql_keywords .= $db->sql_in_set('l.log_operation', $operations) . ' OR '; -		} -		$sql_lower = $db->sql_lower_text('l.log_data'); -		$sql_keywords .= "$sql_lower " . implode(" OR $sql_lower ", $keywords) . ')'; -	} - -	if ($log_count !== false) -	{ -		$sql = 'SELECT COUNT(l.log_id) AS total_entries -			FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u -			WHERE l.log_type = $log_type -				AND l.user_id = u.user_id -				AND l.log_time >= $limit_days -				$sql_keywords -				$sql_forum"; -		$result = $db->sql_query($sql); -		$log_count = (int) $db->sql_fetchfield('total_entries'); -		$db->sql_freeresult($result); -	} - -	// $log_count may be false here if false was passed in for it, -	// because in this case we did not run the COUNT() query above. -	// If we ran the COUNT() query and it returned zero rows, return; -	// otherwise query for logs below. -	if ($log_count === 0) -	{ -		// Save the queries, because there are no logs to display -		return 0; -	} - -	if ($offset >= $log_count) -	{ -		$offset = ($offset - $limit < 0) ? 0 : $offset - $limit; -	} - -	$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour -		FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u -		WHERE l.log_type = $log_type -			AND u.user_id = l.user_id -			" . (($limit_days) ? "AND l.log_time >= $limit_days" : '') . " -			$sql_keywords -			$sql_forum -		ORDER BY $sort_by"; -	$result = $db->sql_query_limit($sql, $limit, $offset); - -	$i = 0; -	$log = array(); -	while ($row = $db->sql_fetchrow($result)) -	{ -		if ($row['topic_id']) -		{ -			$topic_id_list[] = $row['topic_id']; -		} - -		if ($row['reportee_id']) -		{ -			$reportee_id_list[] = $row['reportee_id']; -		} - -		$log[$i] = array( -			'id'				=> $row['log_id'], - -			'reportee_id'			=> $row['reportee_id'], -			'reportee_username'		=> '', -			'reportee_username_full'=> '', - -			'user_id'			=> $row['user_id'], -			'username'			=> $row['username'], -			'username_full'		=> get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, $profile_url), - -			'ip'				=> $row['log_ip'], -			'time'				=> $row['log_time'], -			'forum_id'			=> $row['forum_id'], -			'topic_id'			=> $row['topic_id'], - -			'viewforum'			=> ($row['forum_id'] && $auth->acl_get('f_read', $row['forum_id'])) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : false, -			'action'			=> (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}', -		); - -		if (!empty($row['log_data'])) -		{ -			$log_data_ary = @unserialize($row['log_data']); -			$log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary; - -			if (isset($user->lang[$row['log_operation']])) -			{ -				// Check if there are more occurrences of % than arguments, if there are we fill out the arguments array -				// It doesn't matter if we add more arguments than placeholders -				if ((substr_count($log[$i]['action'], '%') - sizeof($log_data_ary)) > 0) -				{ -					$log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($log[$i]['action'], '%') - sizeof($log_data_ary), '')); -				} - -				$log[$i]['action'] = vsprintf($log[$i]['action'], $log_data_ary); - -				// If within the admin panel we do not censor text out -				if (defined('IN_ADMIN')) -				{ -					$log[$i]['action'] = bbcode_nl2br($log[$i]['action']); -				} -				else -				{ -					$log[$i]['action'] = bbcode_nl2br(censor_text($log[$i]['action'])); -				} -			} -			else if (!empty($log_data_ary)) -			{ -				$log[$i]['action'] .= '<br />' . implode('', $log_data_ary); -			} - -			/* Apply make_clickable... has to be seen if it is for good. :/ -			// Seems to be not for the moment, reconsider later... -			$log[$i]['action'] = make_clickable($log[$i]['action']); -			*/ -		} - -		$i++; -	} -	$db->sql_freeresult($result); - -	if (sizeof($topic_id_list)) -	{ -		$topic_id_list = array_unique($topic_id_list); - -		// This query is not really needed if move_topics() updates the forum_id field, -		// although it's also used to determine if the topic still exists in the database -		$sql = 'SELECT topic_id, forum_id -			FROM ' . TOPICS_TABLE . ' -			WHERE ' . $db->sql_in_set('topic_id', array_map('intval', $topic_id_list)); -		$result = $db->sql_query($sql); - -		$default_forum_id = 0; - -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (!$row['forum_id']) -			{ -				if ($auth->acl_getf_global('f_read')) -				{ -					if (!$default_forum_id) -					{ -						$sql = 'SELECT forum_id -							FROM ' . FORUMS_TABLE . ' -							WHERE forum_type = ' . FORUM_POST; -						$f_result = $db->sql_query_limit($sql, 1); -						$default_forum_id = (int) $db->sql_fetchfield('forum_id', false, $f_result); -						$db->sql_freeresult($f_result); -					} +	global $phpbb_log; -					$is_auth[$row['topic_id']] = $default_forum_id; -				} -			} -			else -			{ -				if ($auth->acl_get('f_read', $row['forum_id'])) -				{ -					$is_auth[$row['topic_id']] = $row['forum_id']; -				} -			} +	$count_logs = ($log_count !== false); -			if ($auth->acl_gets('a_', 'm_', $row['forum_id'])) -			{ -				$is_mod[$row['topic_id']] = $row['forum_id']; -			} -		} -		$db->sql_freeresult($result); +	$log = $phpbb_log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords); +	$log_count = $phpbb_log->get_log_count(); -		foreach ($log as $key => $row) -		{ -			$log[$key]['viewtopic'] = (isset($is_auth[$row['topic_id']])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $is_auth[$row['topic_id']] . '&t=' . $row['topic_id']) : false; -			$log[$key]['viewlogs'] = (isset($is_mod[$row['topic_id']])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=topic_logs&t=' . $row['topic_id'], true, $user->session_id) : false; -		} -	} - -	if (sizeof($reportee_id_list)) -	{ -		$reportee_id_list = array_unique($reportee_id_list); -		$reportee_names_list = array(); - -		$sql = 'SELECT user_id, username, user_colour -			FROM ' . USERS_TABLE . ' -			WHERE ' . $db->sql_in_set('user_id', $reportee_id_list); -		$result = $db->sql_query($sql); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$reportee_names_list[$row['user_id']] = $row; -		} -		$db->sql_freeresult($result); - -		foreach ($log as $key => $row) -		{ -			if (!isset($reportee_names_list[$row['reportee_id']])) -			{ -				continue; -			} - -			$log[$key]['reportee_username'] = $reportee_names_list[$row['reportee_id']]['username']; -			$log[$key]['reportee_username_full'] = get_username_string('full', $row['reportee_id'], $reportee_names_list[$row['reportee_id']]['username'], $reportee_names_list[$row['reportee_id']]['user_colour'], false, $profile_url); -		} -	} - -	return $offset; +	return $phpbb_log->get_valid_offset();  }  /** -* Update foes - remove moderators and administrators from foe lists... +* Removes moderators and administrators from foe lists. +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\auth\auth $auth Authentication object +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null  */ -function update_foes($group_id = false, $user_id = false) +function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)  { -	global $db, $auth; -  	// update foes for some user  	if (is_array($user_id) && sizeof($user_id))  	{ @@ -2796,18 +2649,18 @@ function update_foes($group_id = false, $user_id = false)  	if (is_array($group_id) && sizeof($group_id))  	{  		// Grab group settings... -		$sql = $db->sql_build_query('SELECT', array( +		$sql_ary = array(  			'SELECT'	=> 'a.group_id',  			'FROM'		=> array(  				ACL_OPTIONS_TABLE	=> 'ao', -				ACL_GROUPS_TABLE	=> 'a' +				ACL_GROUPS_TABLE	=> 'a',  			),  			'LEFT_JOIN'	=> array(  				array(  					'FROM'	=> array(ACL_ROLES_DATA_TABLE => 'r'), -					'ON'	=> 'a.auth_role_id = r.role_id' +					'ON'	=> 'a.auth_role_id = r.role_id',  				),  			), @@ -2815,8 +2668,9 @@ function update_foes($group_id = false, $user_id = false)  				AND ' . $db->sql_in_set('a.group_id', $group_id) . "  				AND ao.auth_option IN ('a_', 'm_')", -			'GROUP_BY'	=> 'a.group_id' -		)); +			'GROUP_BY'	=> 'a.group_id', +		); +		$sql = $db->sql_build_query('SELECT', $sql_ary);  		$result = $db->sql_query($sql);  		$groups = array(); @@ -2890,6 +2744,20 @@ function update_foes($group_id = false, $user_id = false)  }  /** +* Removes moderators and administrators from foe lists. +* +* @deprecated 3.1 +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function update_foes($group_id = false, $user_id = false) +{ +	global $db, $auth; +	return phpbb_update_foes($db, $auth, $group_id, $user_id); +} + +/**  * Lists inactive users  */  function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') @@ -3194,7 +3062,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port  	return $file_info;  } -/** +/*  * Tidy Warnings  * Remove all warnings which have now expired from the database  * The duration of a warning can be defined by the administrator @@ -3278,77 +3146,29 @@ function tidy_database()  */  function add_permission_language()  { -	global $user, $phpEx; +	global $user, $phpEx, $phpbb_extension_manager; -	// First of all, our own file. We need to include it as the first file because it presets all relevant variables. -	$user->add_lang('acp/permissions_phpbb'); +	// add permission language files from extensions +	$finder = $phpbb_extension_manager->get_finder(); -	$files_to_add = array(); +	$lang_files = $finder +		->prefix('permissions_') +		->suffix(".$phpEx") +		->core_path('language/' . $user->lang_name . '/') +		->extension_directory('/language/' . $user->lang_name) +		->find(); -	// Now search in acp and mods folder for permissions_ files. -	foreach (array('acp/', 'mods/') as $path) +	foreach ($lang_files as $lang_file => $ext_name)  	{ -		$dh = @opendir($user->lang_path . $user->lang_name . '/' . $path); - -		if ($dh) +		if ($ext_name === '/')  		{ -			while (($file = readdir($dh)) !== false) -			{ -				if ($file !== 'permissions_phpbb.' . $phpEx && strpos($file, 'permissions_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) -				{ -					$files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1)); -				} -			} -			closedir($dh); +			$user->add_lang($lang_file);  		} -	} - -	if (!sizeof($files_to_add)) -	{ -		return false; -	} - -	$user->add_lang($files_to_add); -	return true; -} - -/** - * Obtains the latest version information - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @param bool $warn_fail Trigger a warning if obtaining the latest version information fails. Defaults to false. - * @param int $ttl Cache version information for $ttl seconds. Defaults to 86400 (24 hours). - * - * @return string | false Version info on success, false on failure. - */ -function obtain_latest_version_info($force_update = false, $warn_fail = false, $ttl = 86400) -{ -	global $cache; - -	$info = $cache->get('versioncheck'); - -	if ($info === false || $force_update) -	{ -		$errstr = ''; -		$errno = 0; - -		$info = get_remote_file('version.phpbb.com', '/phpbb', -				((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); - -		if (empty($info)) +		else  		{ -			$cache->destroy('versioncheck'); -			if ($warn_fail) -			{ -				trigger_error($errstr, E_USER_WARNING); -			} -			return false; +			$user->add_lang_ext($ext_name, $lang_file);  		} - -		$cache->put('versioncheck', $info, $ttl);  	} - -	return $info;  }  /** @@ -3370,5 +3190,3 @@ function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more  		' . $sql_more;  	$db->sql_query($sql);  } - -?>
\ No newline at end of file | 
