Merge branch 'ticket/11103' of github.com:EXreaction/phpbb3 into ticket/11103

This commit is contained in:
Nathan Guse 2012-10-13 18:58:42 -05:00
commit 441e389123
5 changed files with 97 additions and 2 deletions

View file

@ -57,6 +57,14 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post
return 'approve_post'; return 'approve_post';
} }
/**
* Is available
*/
public function is_available()
{
return !$this->auth->acl_get('m_approve');
}
/** /**
* Find the users who want to receive notifications * Find the users who want to receive notifications
* *
@ -106,6 +114,38 @@ class phpbb_notification_type_approve_post extends phpbb_notification_type_post
return $notify_users; return $notify_users;
} }
/**
* Pre create insert array function
* This allows you to perform certain actions, like run a query
* and load data, before create_insert_array() is run. The data
* returned from this function will be sent to create_insert_array().
*
* @param array $post Post data from submit_post
* @param array $notify_users Notify users list
* Formated from find_users_for_notification()
* @return array Whatever you want to send to create_insert_array().
*/
public function pre_create_insert_array($post, $notify_users)
{
/*if (!sizeof($notify_users))
{
return array();
}
// Mark the topic unread before the post
$sql = 'UPDATE ' . TOPICS_TRACK_TABLE . '
SET mark_time = ' . (int) ($post['post_time'] - 1) . '
WHERE topic_id = ' . (int) $post['topic_id'] . '
AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users));
$this->db->sql_query($sql);*/
// In the parent class, this is used to check if the post is already
// read by a user and marks the notification read if it was marked read.
// Returning an empty array in effect, forces it to be marked as unread
// (and also saves a query)
return array();
}
/** /**
* Function for preparing the data for insertion in an SQL query * Function for preparing the data for insertion in an SQL query
* (The service handles insertion) * (The service handles insertion)

View file

@ -57,6 +57,14 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi
return 'approve_topic'; return 'approve_topic';
} }
/**
* Is available
*/
public function is_available()
{
return !$this->auth->acl_get('m_approve');
}
/** /**
* Find the users who want to receive notifications * Find the users who want to receive notifications
* *
@ -106,6 +114,36 @@ class phpbb_notification_type_approve_topic extends phpbb_notification_type_topi
return $notify_users; return $notify_users;
} }
/**
* Pre create insert array function
* This allows you to perform certain actions, like run a query
* and load data, before create_insert_array() is run. The data
* returned from this function will be sent to create_insert_array().
*
* @param array $post Post data from submit_post
* @param array $notify_users Notify users list
* Formated from find_users_for_notification()
* @return array Whatever you want to send to create_insert_array().
*/
public function pre_create_insert_array($post, $notify_users)
{
/*if (!sizeof($notify_users))
{
return array();
}
// Mark the topic unread
$sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . '
WHERE topic_id = ' . (int) $post['topic_id'] . '
AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users));
$this->db->sql_query($sql*/
// In the parent class, this is used to check if the post is already
// read by a user and marks the notification read if it was marked read.
// Returning an empty array in effect, forces it to be marked as unread
return array();
}
/** /**
* Function for preparing the data for insertion in an SQL query * Function for preparing the data for insertion in an SQL query
* (The service handles insertion) * (The service handles insertion)

View file

@ -87,13 +87,16 @@ class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
'ignore_users' => array(), 'ignore_users' => array(),
), $options); ), $options);
$auth_approve = $this->auth->acl_get_list(false, $this->permission, $post['forum_id']); // 0 is for global
$auth_approve = $this->auth->acl_get_list(false, $this->permission, array($post['forum_id'], 0));
if (empty($auth_approve)) if (empty($auth_approve))
{ {
return array(); return array();
} }
$auth_approve[$post['forum_id']] = array_unique(array_merge($auth_approve[$post['forum_id']], $auth_approve[0]));
$notify_users = array(); $notify_users = array();
$sql = 'SELECT * $sql = 'SELECT *

View file

@ -74,6 +74,17 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
return (int) $pm['report_id']; return (int) $pm['report_id'];
} }
/**
* Is available
*/
public function is_available()
{
$m_approve = $this->auth->acl_getf($this->permission, true);
return (!empty($m_approve));
}
/** /**
* Find the users who want to receive notifications * Find the users who want to receive notifications
* (copied from post_in_queue) * (copied from post_in_queue)

View file

@ -80,13 +80,16 @@ class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_top
'ignore_users' => array(), 'ignore_users' => array(),
), $options); ), $options);
$auth_approve = $this->auth->acl_get_list(false, 'm_approve', $topic['forum_id']); // 0 is for global
$auth_approve = $this->auth->acl_get_list(false, 'm_approve', array($topic['forum_id'], 0));
if (empty($auth_approve)) if (empty($auth_approve))
{ {
return array(); return array();
} }
$auth_approve[$topic['forum_id']] = array_unique(array_merge($auth_approve[$topic['forum_id']], $auth_approve[0]));
$notify_users = array(); $notify_users = array();
$sql = 'SELECT * $sql = 'SELECT *