本文整理汇总了PHP中phpbb\db\driver\driver_interface::sql_fetchrowset方法的典型用法代码示例。如果您正苦于以下问题:PHP driver_interface::sql_fetchrowset方法的具体用法?PHP driver_interface::sql_fetchrowset怎么用?PHP driver_interface::sql_fetchrowset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\db\driver\driver_interface
的用法示例。
在下文中一共展示了driver_interface::sql_fetchrowset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify_posting
public function modify_posting($event)
{
if ($event['mode'] == 'post' && !$event['forum_id']) {
$forum_ary = array();
$forum_read_ary = $this->auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed) {
if ($allowed['f_read'] && $this->auth->acl_get('f_post', $forum_id)) {
if (!$this->exclude_forum($forum_id, $this->config['newtopic_forum'])) {
continue;
}
$forum_ary[] = (int) $forum_id;
}
}
if (sizeof($forum_ary)) {
// Fetching topics of public forums
$sql = 'SELECT forum_id, forum_name, forum_type FROM ' . FORUMS_TABLE . "\n\t\t\t\t\tWHERE " . $this->db->sql_in_set('forum_id', $forum_ary) . "\n\t\t\t\t\t\tAND forum_type != " . FORUM_LINK;
$result = $this->db->sql_query($sql);
$forumrow = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
$s_forum_options = '<select id="f" name="f" onchange="this.form.submit();">';
foreach ($forumrow as $row) {
$s_forum_options .= '<option value="' . $row['forum_id'] . '"' . ($row['forum_id'] == $forum_id ? ' selected="selected"' : '') . '' . ($row['forum_type'] == FORUM_CAT ? ' disabled="disabled" class="disabled-option"' : '') . '>' . ($row['forum_type'] != FORUM_CAT ? ' ' : '') . $row['forum_name'] . '</option>';
$forum_id = $row['forum_type'] == FORUM_POST ? $row['forum_id'] : '';
}
$s_forum_options .= '</select>';
$this->template->assign_vars(array('S_FORUM_OPTIONS' => $s_forum_options, 'S_FORUM_OPT_TRUE' => $forum_id ? true : false));
$event['forum_id'] = $forum_id;
}
}
}
示例2: get_records_by_range
/**
* {@inheritdoc}
*/
protected function get_records_by_range($min_id, $max_id)
{
$sql = $this->get_records_by_range_query($min_id, $max_id);
$result = $this->db->sql_query($sql);
$records = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $records;
}
示例3: get_group_rules
/**
* {@inheritdoc}
*/
public function get_group_rules($type = '')
{
$sql_array = array('SELECT' => 'agr.*, agt.autogroups_type_name', 'FROM' => array($this->autogroups_rules_table => 'agr', $this->autogroups_types_table => 'agt'), 'WHERE' => 'agr.autogroups_type_id = agt.autogroups_type_id' . ($type ? " AND agt.autogroups_type_name = '" . $this->db->sql_escape($type) . "'" : ''));
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql, 7200);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例4: get_batch
/**
* Get batch.
*
* @return array
*/
protected function get_batch()
{
$sql = 'SELECT DISTINCT topic_id, post_user_id
FROM ' . $this->posts_table . '
WHERE post_approved = 1
AND post_deleted = 0';
$result = $this->db->sql_query_limit($sql, $this->limit, $this->start);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例5: get_records_by_range
/**
* {@inheritdoc}
*/
protected function get_records_by_range($min_id, $max_id)
{
$sql = 'SELECT o.topic_id, o.poll_option_id, o.poll_option_text AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE o.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id . '
AND t.topic_id = o.topic_id
AND p.post_id = t.topic_first_post_id';
$result = $this->db->sql_query($sql);
$records = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $records;
}
示例6: display_flags
/**
* Display the flags
*
* @return null
* @access public
*/
public function display_flags()
{
$start = $this->request->variable('start', 0);
$pagination_url = $this->u_action;
$this->user->add_lang_ext('rmcgirr83/nationalflags', 'common');
$sql = 'SELECT f.*, COUNT(u.user_flag) as user_count
FROM ' . $this->flags_table . ' f
LEFT JOIN ' . USERS_TABLE . " u on f.flag_id = u.user_flag\n\t\t\tGROUP BY f.flag_id\n\t\t\tORDER BY f.flag_name ASC";
$result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
// for counting of all the flags
// used for pagination
$result2 = $this->db->sql_query($sql);
$row2 = $this->db->sql_fetchrowset($result2);
$total_count = (int) sizeof($row2);
$this->db->sql_freeresult($result2);
unset($row2);
while ($row = $this->db->sql_fetchrow($result)) {
$user_count = $this->user->lang('FLAG_USERS', (int) $row['user_count']);
$this->template->assign_block_vars('flags', array('FLAG_NAME' => $row['flag_name'], 'FLAG_IMG' => $this->ext_path_web . 'flags/' . strtolower($row['flag_image']), 'FLAG_ID' => $row['flag_id'], 'USER_COUNT' => $user_count, 'U_FLAG' => $this->helper->route('rmcgirr83_nationalflags_getflags', array('flag_id' => $row['flag_id'])), 'U_EDIT' => $this->u_action . "&flag_id={$row['flag_id']}&action=edit", 'U_DELETE' => $this->u_action . "&flag_id={$row['flag_id']}&action=delete"));
}
$this->db->sql_freeresult($result);
$start = $this->pagination->validate_start($start, $this->config['topics_per_page'], $total_count);
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_count, $this->config['topics_per_page'], $start);
$this->template->assign_vars(array('TOTAL_FLAGS' => $total_count, 'S_FLAGS' => true));
}
示例7: mchat_missing_ids
/**
* Returns an array of message IDs that have been deleted from the message table
*/
public function mchat_missing_ids($start_id, $end_id)
{
if ($this->config['mchat_edit_delete_limit']) {
$sql_where = 'message_time < ' . (time() - $this->config['mchat_edit_delete_limit']);
$cache_ttl = 0;
} else {
$sql_where = 'message_id < ' . (int) $start_id;
$cache_ttl = 3600;
}
$sql = 'SELECT message_id
FROM ' . $this->mchat_table . '
WHERE ' . $sql_where . '
ORDER BY message_id DESC';
$result = $this->db->sql_query_limit($sql, 1, 0, $cache_ttl);
$earliest_id = (int) $this->db->sql_fetchfield('message_id');
$this->db->sql_freeresult($result);
if (!$earliest_id) {
$sql = 'SELECT MIN(message_id) as earliest_id
FROM ' . $this->mchat_table;
$result = $this->db->sql_query($sql, 3600);
$earliest_id = $this->db->sql_fetchfield('earliest_id');
$this->db->sql_freeresult($result);
}
if (!$earliest_id) {
return range($start_id, $end_id);
}
$sql = 'SELECT (t1.message_id + 1) AS start, (
SELECT MIN(t3.message_id) - 1
FROM ' . $this->mchat_table . ' t3
WHERE t3.message_id > t1.message_id
) AS end
FROM ' . $this->mchat_table . ' t1
WHERE t1.message_id > ' . (int) $earliest_id . ' AND NOT EXISTS (
SELECT t2.message_id
FROM ' . $this->mchat_table . ' t2
WHERE t2.message_id = t1.message_id + 1
)';
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
$missing_ids = array();
if ($start_id < $earliest_id && !$this->config['mchat_edit_delete_limit']) {
$missing_ids[] = range($start_id, $earliest_id - 1);
}
foreach ($rows as $row) {
if ($row['end']) {
$missing_ids[] = range($row['start'], $row['end']);
} else {
$latest_message = $row['start'] - 1;
if ($end_id > $latest_message) {
$missing_ids[] = range($latest_message + 1, $end_id);
}
}
}
// Flatten
if (!empty($missing_ids)) {
$missing_ids = call_user_func_array('array_merge', $missing_ids);
}
return $missing_ids;
}
示例8: get_auth_link_data
/**
* {@inheritdoc}
*/
public function get_auth_link_data($user_id = 0)
{
$block_vars = array();
// Get all external accounts tied to the current user
$data = array('user_id' => $user_id <= 0 ? (int) $this->user->data['user_id'] : (int) $user_id);
$sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . '
WHERE ' . $this->db->sql_build_array('SELECT', $data);
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
$oauth_user_ids = array();
if ($rows !== false && sizeof($rows)) {
foreach ($rows as $row) {
$oauth_user_ids[$row['provider']] = $row['oauth_provider_id'];
}
}
unset($rows);
foreach ($this->service_providers as $service_name => $service_provider) {
// Only include data if the credentials are set
$credentials = $service_provider->get_service_credentials();
if ($credentials['key'] && $credentials['secret']) {
$actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
$block_vars[$service_name] = array('HIDDEN_FIELDS' => array('link' => !isset($oauth_user_ids[$actual_name]), 'oauth_service' => $actual_name), 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)], 'UNIQUE_ID' => isset($oauth_user_ids[$actual_name]) ? $oauth_user_ids[$actual_name] : null);
}
}
return array('BLOCK_VAR_NAME' => 'oauth', 'BLOCK_VARS' => $block_vars, 'TEMPLATE_FILE' => 'ucp_auth_link_oauth.html');
}
示例9: get_censored_words
/**
* Return the list of censored words
*
* @return array
*/
public function get_censored_words()
{
$sql = 'SELECT word, replacement FROM ' . $this->words_table;
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例10: get_styles
/**
* Lists all styles
*
* @return array Rows with styles data
*/
protected function get_styles()
{
$sql = 'SELECT *
FROM ' . STYLES_TABLE;
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例11: get_attachments
/**
* Get attachments
*
* @param string $conditions SQL conditions
* @return array
*/
protected function get_attachments($conditions)
{
$sql = 'SELECT *
FROM ' . TITANIA_ATTACHMENTS_TABLE . "\n\t\t\tWHERE {$conditions}";
$result = $this->db->sql_query_limit($sql, 25);
$attachments = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $attachments;
}
示例12: get_styles
/**
* Get style data from the styles table
*
* @return Array of style data
* @access protected
*/
protected function get_styles()
{
$sql = 'SELECT style_id, style_name, topic_preview_theme
FROM ' . STYLES_TABLE . '
WHERE style_active = 1';
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例13: get_batch
/**
* Get batch of rows to process.
*
* @return array
*/
protected function get_batch()
{
$sql_ary = array('SELECT' => 'c.contrib_id, c.contrib_type, c.contrib_status, c.contrib_user_id, ca.user_id', 'FROM' => array($this->contribs_table => 'c'), 'LEFT_JOIN' => array(array('FROM' => array($this->contrib_coauthors_table => 'ca'), 'ON' => 'ca.contrib_id = c.contrib_id')), 'WHERE' => 'c.contrib_visible = 1
AND ' . $this->db->sql_in_set('c.contrib_status', $this->valid_statuses), 'ORDER_BY' => 'c.contrib_id');
$sql = $this->db->sql_build_query('SELECT', $sql_ary);
$result = $this->db->sql_query_limit($sql, $this->limit, $this->start);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例14: get_all_autogroups
/**
* Get all auto group rules from the database
*
* @return array Array of auto group rules and their associated data
* @access public
*/
protected function get_all_autogroups()
{
$sql_array = array('SELECT' => 'agr.*, agt.autogroups_type_name, g.group_name', 'FROM' => array($this->autogroups_rules_table => 'agr', $this->autogroups_types_table => 'agt', GROUPS_TABLE => 'g'), 'WHERE' => 'agr.autogroups_type_id = agt.autogroups_type_id
AND agr.autogroups_group_id = g.group_id', 'ORDER_BY' => 'g.group_name ASC, autogroups_min_value ASC');
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}
示例15: get_link_locations
/**
* Get page link location names and identifiers
*
* @return array Array of page link location names and identifiers
* @access public
*/
public function get_link_locations()
{
$sql = 'SELECT page_link_id, page_link_location
FROM ' . $this->pages_links_table . '
ORDER BY page_link_id ASC';
$result = $this->db->sql_query($sql);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
return $rows;
}