mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
- added folder_moved image
- new feature: bookmark topics - fixed post details link - added confirmation screen to cookie deletion git-svn-id: file:///svn/phpbb/trunk@4912 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -461,7 +461,7 @@ function tz_select($default = '')
|
||||
}
|
||||
|
||||
// Topic and forum watching common code
|
||||
function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $match_id, $notify_status = 'unset')
|
||||
function watch_topic_forum($mode, &$s_watching, &$s_watching_img, $user_id, $match_id, $notify_status = 'unset', $start = 0)
|
||||
{
|
||||
global $template, $db, $user, $phpEx, $SID, $start, $phpbb_root_path;
|
||||
|
||||
|
@@ -990,6 +990,7 @@ class mcp_main extends mcp
|
||||
|
||||
if ($this->confirm)
|
||||
{
|
||||
// delete_topics('topic_id', $topic_id_list, true);
|
||||
return_link('RETURN_FORUM', "viewforum.$phpEx$SID&f={$this->forum_id}");
|
||||
|
||||
$template->assign_var('MESSAGE', (count($topic_id_list) == 1) ? $user->lang['TOPIC_DELETED_SUCCESS'] : $user->lang['TOPICS_DELETED_SUCCESS']);
|
||||
|
@@ -31,7 +31,6 @@ class session
|
||||
$this->page = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : $_ENV['REQUEST_URI'];
|
||||
|
||||
// Generate Valid URL
|
||||
// TODO: need another one with sid for normal redirects
|
||||
$this->cur_page = preg_replace('#^.*?([a-z]+?)\.' . $phpEx . '\?sid=[a-z0-9]*?(&.*)?$#i', '\1.' . $phpEx . '?\2', str_replace('&', '&', htmlspecialchars($this->page)));
|
||||
|
||||
$this->page = preg_replace('#^.*?([a-z]+?)\.' . $phpEx . '\?sid=[a-z0-9]*?(&.*)?$#i', '\1\2', $this->page);
|
||||
|
@@ -223,7 +223,7 @@ class template
|
||||
// Try and open template for read
|
||||
if (!($fp = @fopen($this->files[$handle], 'r')))
|
||||
{
|
||||
trigger_error("template->_tpl_load(): File " . $this->files[$handle] . " does not exist or is empty", E_USER_ERROR);
|
||||
trigger_error("template->_tpl_load_file(): File {$this->files[$handle]} does not exist or is empty", E_USER_ERROR);
|
||||
}
|
||||
|
||||
$this->compiled_code[$handle] = $this->compile(trim(@fread($fp, filesize($this->files[$handle]))));
|
||||
@@ -346,7 +346,6 @@ class template
|
||||
{
|
||||
$this->compile_var_tags($text_blocks[$i]);
|
||||
}
|
||||
|
||||
$compile_blocks = array();
|
||||
|
||||
for ($curr_tb = 0; $curr_tb < count($text_blocks); $curr_tb++)
|
||||
|
@@ -523,6 +523,167 @@ class ucp_main extends module
|
||||
|
||||
break;
|
||||
|
||||
case 'bookmarks':
|
||||
|
||||
if (!$config['allow_bookmarks'])
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_NO_DISPLAY_BOOKMARKS' => true)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$move_up = request_var('move_up', 0);
|
||||
$move_down = request_var('move_down', 0);
|
||||
|
||||
$sql = 'SELECT MAX(order_id) as max_order_id FROM ' . BOOKMARKS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
$max_order_id = $db->sql_fetchfield('max_order_id', 0, $result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($move_up || $move_down)
|
||||
{
|
||||
if (($move_up && $move_up != 1) || ($move_down && $move_down != $max_order_id))
|
||||
{
|
||||
$order = ($move_up) ? $move_up : $move_down;
|
||||
$order_total = $order * 2 + (($move_up) ? -1 : 1);
|
||||
|
||||
$sql = 'UPDATE ' . BOOKMARKS_TABLE . "
|
||||
SET order_id = $order_total - order_id
|
||||
WHERE order_id IN ($order, " . (($move_up) ? $order - 1 : $order + 1) . ')
|
||||
AND user_id = ' . $user->data['user_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['unbookmark']))
|
||||
{
|
||||
$s_hidden_fields = '<input type="hidden" name="unbookmark" value="1" />';
|
||||
$topics = (isset($_POST['t'])) ? array_map('intval', array_keys($_POST['t'])) : array();
|
||||
$url = "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks";
|
||||
|
||||
if (!sizeof($topics))
|
||||
{
|
||||
trigger_error('NO_BOOKMARKS_SELECTED');
|
||||
}
|
||||
|
||||
foreach ($topics as $topic_id)
|
||||
{
|
||||
$s_hidden_fields .= '<input type="hidden" name="t[' . $topic_id . ']" value="1" />';
|
||||
}
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$sql = 'DELETE FROM ' . BOOKMARKS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
AND topic_id IN (' . implode(', ', $topics) . ')';
|
||||
$db->sql_query($sql);
|
||||
|
||||
// Re-Order bookmarks (possible with one query? This query massaker is not really acceptable...)
|
||||
$sql = 'SELECT topic_id FROM ' . BOOKMARKS_TABLE . '
|
||||
WHERE user_id = ' . $user->data['user_id'] . '
|
||||
ORDER BY order_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$i = 1;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$db->sql_query('UPDATE ' . BOOKMARKS_TABLE . "
|
||||
SET order_id = $i
|
||||
WHERE topic_id = {$row['topic_id']}
|
||||
AND user_id = {$user->data['user_id']}");
|
||||
$i++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
meta_refresh(3, $url);
|
||||
$message = $user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
|
||||
trigger_error($message);
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, 'REMOVE_SELECTED_BOOKMARKS', $s_hidden_fields);
|
||||
}
|
||||
}
|
||||
|
||||
// We grab deleted topics here too...
|
||||
// NOTE: At the moment bookmarks are not removed with topics, might be useful later (not really sure how though. :D)
|
||||
// But since bookmarks are sensible to the user, they should not be deleted without notice.
|
||||
$sql = 'SELECT b.order_id, b.topic_id as b_topic_id, t.*, f.forum_name
|
||||
FROM ' . BOOKMARKS_TABLE . ' b
|
||||
LEFT JOIN ' . TOPICS_TABLE . ' t ON b.topic_id = t.topic_id
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f ON t.forum_id = f.forum_id
|
||||
WHERE b.user_id = ' . $user->data['user_id'] . '
|
||||
ORDER BY b.order_id ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$i = 0;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$forum_id = $row['forum_id'];
|
||||
$topic_id = $row['b_topic_id'];
|
||||
|
||||
$replies = ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||
|
||||
$topic_type = '';
|
||||
switch ($row['topic_type'])
|
||||
{
|
||||
case POST_ANNOUNCE:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
|
||||
$folder = 'folder_announce';
|
||||
break;
|
||||
|
||||
case POST_STICKY:
|
||||
$topic_type = $user->lang['VIEW_TOPIC_STICKY'];
|
||||
$folder = 'folder_sticky';
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($replies >= intval($config['hot_threshold']))
|
||||
{
|
||||
$folder = 'folder_hot';
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = 'folder';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($row['topic_status'] == ITEM_LOCKED)
|
||||
{
|
||||
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
|
||||
$folder = 'folder_locked';
|
||||
}
|
||||
|
||||
$folder_alt = ($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'TOPIC';
|
||||
$view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id";
|
||||
$last_post_img = "<a href=\"viewtopic.$phpEx$SID&f=$forum_id&p=" . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'] . '">' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . '</a>';
|
||||
|
||||
$template->assign_block_vars('topicrow', array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
'TOPIC_ID' => $topic_id,
|
||||
'S_DELETED_TOPIC' => (!$row['topic_id']) ? true : false,
|
||||
'TOPIC_TITLE' => censor_text($row['topic_title']),
|
||||
'TOPIC_TYPE' => $topic_type,
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
'POSTED_AT' => $user->format_date($row['topic_time']),
|
||||
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder, $folder_alt),
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', '') : '',
|
||||
|
||||
'U_VIEW_TOPIC' => $view_topic_url,
|
||||
'U_VIEW_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f={$row['forum_id']}",
|
||||
'U_MOVE_UP' => ($row['order_id'] != 1) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_up={$row['order_id']}" : '',
|
||||
'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&i=main&mode=bookmarks&move_down={$row['order_id']}" : '',
|
||||
|
||||
'S_ROW_COUNT' => $i++)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'drafts':
|
||||
global $ucp;
|
||||
|
||||
|
@@ -19,6 +19,7 @@ class ucp_prefs extends module
|
||||
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$error = $data = array();
|
||||
$s_hidden_fields = '';
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user