aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/includes/mcp/mcp_main.php1
-rw-r--r--phpBB/includes/session.php1
-rw-r--r--phpBB/includes/template.php3
-rw-r--r--phpBB/includes/ucp/ucp_main.php161
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php1
6 files changed, 165 insertions, 4 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 19d72bf919..1f941d0baf 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -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;
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 44e1808f1c..f1f20a9006 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -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']);
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index e035090ca6..9c086a639e 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -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);
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 831f455f35..6c90b95b1b 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -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++)
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 30a1a63ee0..cb0bd4f082 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -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&amp;i=main&amp;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&amp;f=$forum_id&amp;t=$topic_id";
+ $last_post_img = "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;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&amp;f={$row['forum_id']}",
+ 'U_MOVE_UP' => ($row['order_id'] != 1) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=main&amp;mode=bookmarks&amp;move_up={$row['order_id']}" : '',
+ 'U_MOVE_DOWN' => ($row['order_id'] != $max_order_id) ? "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=main&amp;mode=bookmarks&amp;move_down={$row['order_id']}" : '',
+
+ 'S_ROW_COUNT' => $i++)
+ );
+ }
+
+ break;
+
case 'drafts':
global $ucp;
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index f73157d1cd..1275d39eaf 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -19,6 +19,7 @@ class ucp_prefs extends module
$submit = (isset($_POST['submit'])) ? true : false;
$error = $data = array();
+ $s_hidden_fields = '';
switch($mode)
{