• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP qa_db_read_all_assoc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中qa_db_read_all_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_db_read_all_assoc函数的具体用法?PHP qa_db_read_all_assoc怎么用?PHP qa_db_read_all_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qa_db_read_all_assoc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: output_widget

 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     if (!qa_opt('event_logger_to_database')) {
         return;
     }
     $badges = qa_db_read_all_assoc(qa_db_query_sub('SELECT event,handle,params, UNIX_TIMESTAMP(datetime) AS datetime FROM ^eventlog WHERE event=$' . (qa_opt('badge_widget_date_max') ? ' AND DATE_SUB(CURDATE(),INTERVAL ' . (int) qa_opt('badge_widget_date_max') . ' DAY) <= datetime' : '') . ' ORDER BY datetime DESC' . (qa_opt('badge_widget_list_max') ? ' LIMIT ' . (int) qa_opt('badge_widget_list_max') : ''), 'badge_awarded'));
     if (empty($badges)) {
         return;
     }
     $themeobject->output('<h2>' . qa_lang('badges/badge_widget_title') . '</h2>');
     foreach ($badges as $badge) {
         $params = array();
         $paramsa = explode("\t", $badge['params']);
         foreach ($paramsa as $param) {
             $parama = explode('=', $param);
             $params[$parama[0]] = $parama[1];
         }
         $slug = $params['badge_slug'];
         $typea = qa_get_badge_type_by_slug($slug);
         $types = $typea['slug'];
         $typed = $typea['name'];
         $badge_name = qa_lang('badges/' . $slug);
         if (!qa_opt('badge_' . $slug . '_name')) {
             qa_opt('badge_' . $slug . '_name', $badge_name);
         }
         $var = qa_opt('badge_' . $slug . '_var');
         $name = qa_opt('badge_' . $slug . '_name');
         $desc = qa_badge_desc_replace($slug, $var, $name);
         $string = '<span class="badge-' . $types . '" title="' . $desc . ' (' . $typed . ')">' . qa_html($name) . '<br/>- ' . $badge['handle'] . ' -</span>';
         $themeobject->output('<div class="badge-widget-entry" style="padding-top:8px;">', $string, '</div>');
     }
 }
开发者ID:roine,项目名称:q2a-badges,代码行数:32,代码来源:qa-badge-widget.php


示例2: q_list

 public function q_list($q_list)
 {
     if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         // Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (!empty($postids)) {
             // Retrieve the content for these questions from the database and put into an array fetching
             // the minimal amount of characters needed to determine the string should be shortened or not
             $maxlength = qa_opt('mouseover_content_max_len');
             $result = qa_db_query_sub('SELECT postid, LEFT(content, #) content, format FROM ^posts WHERE postid IN (#)', $maxlength + 1, $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             // Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             // Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 if (isset($postinfo[$question['raw']['postid']])) {
                     $thispost = $postinfo[$question['raw']['postid']];
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = qa_shorten_string_line($text, $maxlength);
                     $title = isset($question['title']) ? $question['title'] : '';
                     $q_list['qs'][$index]['title'] = sprintf('<span title="%s">%s</span>', qa_html($text), $title);
                 }
             }
         }
     }
     qa_html_theme_base::q_list($q_list);
     // call back through to the default function
 }
开发者ID:GitFuture,项目名称:bmf,代码行数:34,代码来源:qa-mouseover-layer.php


示例3: q_list

 public function q_list($q_list)
 {
     if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         // Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (!empty($postids)) {
             // Retrieve the content for these questions from the database
             $maxlength = qa_opt('mouseover_content_max_len');
             $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             // Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             // Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 if (isset($postinfo[$question['raw']['postid']])) {
                     $thispost = $postinfo[$question['raw']['postid']];
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = preg_replace('/\\s+/', ' ', $text);
                     // Remove duplicated blanks, new line characters, tabs, etc
                     $text = qa_shorten_string_line($text, $maxlength);
                     $title = isset($question['title']) ? $question['title'] : '';
                     $q_list['qs'][$index]['title'] = $this->getHtmlTitle(qa_html($text), $title);
                 }
             }
         }
     }
     parent::q_list($q_list);
     // call back through to the default function
 }
开发者ID:kosmoluna,项目名称:question2answer,代码行数:35,代码来源:qa-mouseover-layer.php


示例4: q_list

 function q_list($q_list)
 {
     if (count(@$q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         //	Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (count($postids)) {
             //	Retrieve the content for these questions from the database and put into an array
             $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             //	Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             $maxlength = qa_opt('mouseover_content_max_len');
             //	Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 $thispost = @$postinfo[$question['raw']['postid']];
                 if (isset($thispost)) {
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = qa_shorten_string_line($text, $maxlength);
                     $q_list['qs'][$index]['title'] = '<SPAN TITLE="' . qa_html($text) . '">' . @$question['title'] . '</SPAN>';
                 }
             }
         }
     }
     qa_html_theme_base::q_list($q_list);
     // call back through to the default function
 }
开发者ID:mathjoy,项目名称:math-duodaa,代码行数:32,代码来源:qa-mouseover-layer.php


示例5: q2apro_save_most_viewed_questions

function q2apro_save_most_viewed_questions()
{
    // save checktime of cache
    qa_opt('q2apro_popularqu_checktime', time());
    $maxquestions = qa_opt('q2apro_popularqu_maxqu');
    $lastdays = qa_opt('q2apro_popularqu_lastdays');
    $ourTopQuestions = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, title, acount FROM `^posts` 
											WHERE `created` > NOW() - INTERVAL # DAY
											AND `type` = "Q"
											AND `closedbyid` IS NULL
											ORDER BY views DESC
											LIMIT #;', $lastdays, $maxquestions));
    $saveoutput = '';
    foreach ($ourTopQuestions as $qu) {
        $activity_url = qa_path_html(qa_q_request($qu['postid'], $qu['title']), null, qa_opt('site_url'), null, null);
        $questionlink = '<a href="' . $activity_url . '">' . htmlspecialchars($qu['title']) . '</a>';
        $answercnt = '';
        if (qa_opt('q2apro_popularqu_answercount')) {
            $acnttitle = $qu['acount'] == 1 ? qa_lang('q2apro_popularqu_lang/answer_one') : $qu['acount'] . ' ' . qa_lang('q2apro_popularqu_lang/answers');
            $answercnt = ' <span title="' . $acnttitle . '">(' . $qu['acount'] . ')</span>';
        }
        $saveoutput .= '<li>
							' . $questionlink . $answercnt . '
						</li>
						';
    }
    // save into cache
    qa_opt('q2apro_popularqu_cached', $saveoutput);
}
开发者ID:q2apro,项目名称:q2apro-popular-questions-widget,代码行数:29,代码来源:qa-plugin.php


示例6: cs_events

 function cs_events($limit = 10, $events_type = false)
 {
     if (!$events_type) {
         $events_type = array('q_post', 'a_post', 'c_post', 'a_select', 'badge_awarded');
     }
     // query last 3 events
     $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT datetime,ipaddress,handle,event,params FROM ^eventlog WHERE event IN ("q_post", "a_post", "c_post") ORDER BY datetime DESC LIMIT #', $limit));
     if (empty($posts)) {
         return;
     }
     $postids = '';
     $i = 1;
     foreach ($posts as $post) {
         $params = preg_replace('/\\s+/', '&', $post['params']);
         parse_str($params, $data);
         $postids .= ($i != 1 ? ', ' : '') . $data['postid'];
         $i++;
     }
     $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.handle FROM ^posts, ^users WHERE (^posts.userid=^users.userid AND ^posts.postid IN (' . $postids . ')) AND ^posts.type IN ("Q", "A", "C") ORDER BY ^posts.created DESC'));
     $o = '<ul class="ra-activity">';
     foreach ($posts as $p) {
         $event_name = '';
         $event_icon = '';
         if ($p['type'] == 'Q') {
             $event_name = qa_lang('cleanstrap/asked');
             $event_icon = 'icon-question';
         } else {
             if ($p['type'] == 'A') {
                 $event_name = qa_lang('cleanstrap/answered');
                 $event_icon = 'icon-answer';
             } else {
                 $event_name = qa_lang('cleanstrap/commented');
                 $event_icon = 'icon-chat';
             }
         }
         $username = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : htmlspecialchars($p['handle']);
         $usernameLink = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : '<a href="' . qa_path_html('user/' . $p['handle']) . '">' . $p['handle'] . '</a>';
         $timeCode = qa_when_to_html(strtotime($p['created']), 7);
         $time = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
         $o .= '<li class="event-item">';
         $o .= '<div class="event-inner">';
         $o .= '<div class="event-icon pull-left ' . $event_icon . '"></div>';
         $o .= '<div class="event-content">';
         $o .= '<p class="title"><strong class="avatar" data-handle="' . $p['handle'] . '" data-id="' . $p['userid'] . '">' . @$usernameLink . '</strong> <span class="what">' . $event_name . '</span></p>';
         if ($p['type'] == 'Q') {
             $o .= '<a class="event-title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate($p['title'], 100) . '</a>';
         } elseif ($p['type'] == 'A') {
             $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
         } else {
             $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
         }
         $o .= '<span class="time">' . $time . '</span>';
         $o .= '</div>';
         $o .= '</div>';
         $o .= '</li>';
     }
     $o .= '</ul>';
     return $o;
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:59,代码来源:widget_activity.php


示例7: mp_announcements_get_all

function mp_announcements_get_all($categoryid)
{
    /*
    	Return all annoucement posts
    */
    $results = qa_db_read_all_assoc(qa_db_query_sub('select p.*, u.handle from ^posts p, ^users u where p.type="AN" AND p.categoryid=# AND p.userid = u.userid ORDER BY p.created DESC', $categoryid), 'postid');
    return $results;
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:8,代码来源:mp-app-posts.php


示例8: qa_db_uservoteflag_posts_get

function qa_db_uservoteflag_posts_get($postids)
{
    if (QA_FINAL_EXTERNAL_USERS) {
        return qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, userid, vote, flag FROM ^uservotes WHERE postid IN (#) AND ((vote!=0) OR (flag!=0))', $postids));
    } else {
        return qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, handle, vote, flag FROM ^uservotes LEFT JOIN ^users ON ^uservotes.userid=^users.userid WHERE postid IN (#) AND ((vote!=0) OR (flag!=0))', $postids));
    }
}
开发者ID:bafio89,项目名称:qea-u,代码行数:8,代码来源:votes.php


示例9: get_widgets_by_position

function get_widgets_by_position($position)
{
    $widgets = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^cs_widgets WHERE position = $ ORDER BY widget_order', $position));
    foreach ($widgets as $k => $w) {
        $param = unserialize($w['param']);
        $widgets[$k]['param'] = $param;
    }
    return $widgets;
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:9,代码来源:functions.php


示例10: qa_get_public_from_userids

function qa_get_public_from_userids($userids)
{
    global $table_prefix;
    if (count($userids)) {
        return qa_db_read_all_assoc(qa_db_query_sub('SELECT user_nicename, ID FROM ' . $table_prefix . 'users WHERE ID IN (#)', $userids), 'ID', 'user_nicename');
    } else {
        return array();
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:9,代码来源:qa-external-users-wp.php


示例11: cs_user_post_list

 function cs_user_post_list($handle, $type, $limit)
 {
     $userid = qa_handle_to_userid($handle);
     require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
     $post = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^posts INNER JOIN ^users ON ^posts.userid=^users.userid WHERE ^posts.type=$ and ^posts.userid=# ORDER BY ^posts.created DESC LIMIT #', $type, $userid, $limit));
     $output = '<ul class="question-list users-post-widget post-type-' . $type . '">';
     if (count($post) > 0) {
         foreach ($post as $p) {
             if ($type == 'Q') {
                 $what = qa_lang_html('cleanstrap/asked');
             } elseif ($type == 'A') {
                 $what = qa_lang_html('cleanstrap/answered');
             } elseif ('C') {
                 $what = qa_lang_html('cleanstrap/commented');
             }
             $handle = $p['handle'];
             $output .= '<li id="q-list-' . $p['postid'] . '" class="question-item">';
             if ($type == 'Q') {
                 $output .= '<div class="big-ans-count pull-left">' . $p['acount'] . '<span>' . qa_lang_html('cleanstrap/ans') . '</span></div>';
             } elseif ($type == 'A') {
                 $output .= '<div class="big-ans-count pull-left icon-answer"></div>';
             } elseif ($type == 'C') {
                 $output .= '<div class="big-ans-count pull-left icon-comment icon-comments"></div>';
             }
             $output .= '<div class="list-right">';
             $timeCode = qa_when_to_html(strtotime($p['created']), 7);
             $when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
             if ($type == 'Q') {
                 $output .= '<h5><a href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a></h5>';
             } elseif ($type == 'A') {
                 $output .= '<h5><a href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 300) . '</a></h5>';
             } else {
                 $output .= '<h5><a href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 300) . '</a></h5>';
             }
             $output .= '<div class="list-date"><span class="icon-clock">' . $when . '</span>';
             $output .= '<span class="icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span></div>';
             $output .= '</div>';
             $output .= '</li>';
         }
     } else {
         if ($type == 'Q') {
             $what = 'questions';
         } elseif ($type == 'A') {
             $what = 'answers';
         } elseif ('C') {
             $what = 'comments';
         }
         $output .= '<li class="no-post-found">' . qa_lang('cleanstrap/no_' . $what) . ' </li>';
     }
     $output .= '</ul>';
     echo $output;
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:52,代码来源:widget_user_posts.php


示例12: html

 function html()
 {
     if (qa_post_text('ajax_merge_get_from')) {
         $posts = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid,title FROM ^posts WHERE postid IN (#,#)", qa_post_text('ajax_merge_get_from'), qa_post_text('ajax_merge_get_to')));
         if ($posts[0]['postid'] == (int) qa_post_text('ajax_merge_get_from')) {
             echo '{"from":"' . $posts[0]['title'] . '","to":"' . $posts[1]['title'] . '","from_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_from'), $posts[0]['title']), null, qa_opt('site_url')) . '","to_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_to'), $posts[1]['title']), null, qa_opt('site_url')) . '"}';
         } else {
             echo '{"from":"' . $posts[1]['title'] . '","to":"' . $posts[0]['title'] . '","from_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_from'), $posts[1]['title']), null, qa_opt('site_url')) . '","to_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_to'), $posts[0]['title']), null, qa_opt('site_url')) . '"}';
         }
         return;
     }
     qa_html_theme_base::html();
 }
开发者ID:NoahY,项目名称:q2a-post-merge,代码行数:13,代码来源:qa-merge-layer.php


示例13: qa_get_public_from_userids

function qa_get_public_from_userids($userids)
{
    global $wpdb, $qa_cache_wp_user_emails;
    if (count($userids)) {
        $useridtopublic = array();
        $qa_cache_wp_user_emails = array();
        $userfields = qa_db_read_all_assoc(qa_db_query_sub('SELECT ID, user_nicename, user_email FROM ' . $wpdb->base_prefix . 'users WHERE ID IN (#)', $userids), 'ID');
        foreach ($userfields as $id => $fields) {
            $useridtopublic[$id] = $fields['user_nicename'];
            $qa_cache_wp_user_emails[$id] = $fields['user_email'];
        }
        return $useridtopublic;
    } else {
        return array();
    }
}
开发者ID:swuit,项目名称:swuit-q2a,代码行数:16,代码来源:external-users-wp.php


示例14: doctype

 function doctype()
 {
     qa_html_theme_base::doctype();
     if (qa_opt('cp_enable') && ($this->template == 'ask' || isset($this->content['q_list']) || isset($this->content['q_view']))) {
         global $qa_request;
         global $wiki_enable;
         if ($this->template == 'ask' && !qa_user_permit_error('permit_post_q') && !qa_opt('site_maintenance') && qa_permit_check('permit_create_cp')) {
             $this->content['form']['tags'] .= ' onSubmit="pollSubmit(event)"';
             $this->content['form']['fields'][] = array('label' => qa_lang('cp/checkbox_text'), 'tags' => 'NAME="cp_community" ID="cp_community"', 'type' => 'checkbox', 'value' => qa_post_text('cp_community') ? 1 : 0);
         }
         if (isset($this->content['q_view'])) {
             $qid = $this->content['q_view']['raw']['postid'];
             $author = $this->content['q_view']['raw']['userid'];
             if (!isset($wiki_enable)) {
                 $result = qa_db_query_sub('SELECT * FROM ^postmeta WHERE meta_key=$ AND post_id=#', 'is_community', $qid);
                 $wiki_enable = $result->num_rows > 0;
             }
             if ($wiki_enable) {
                 // is a community post
                 $this->content['title'] .= ' ' . qa_lang('cp/question_title');
                 // $this->content['q_view']['content'] = @$this->content['q_view']['content'].'<div id="qa-wiki-div">'.$this->getPollDiv($qid,qa_get_logged_in_userid()).'</div>';
                 $this->content['q_view']['main_form_tags'] = @$this->content['q_view']['main_form_tags'] . ' class="qa-community-posts"';
                 // print_r($this->content['q_view']['form']['buttons']);
                 if (isset($this->content['q_view']['form']['buttons']['edit'])) {
                     $this->content['q_view']['form']['buttons']['edit']['label'] = qa_lang_html('cp/contribute');
                     $this->content['q_view']['form']['buttons']['edit']['popup'] = qa_lang_html('cp/contribute_description');
                 }
                 unset($this->content['q_view']['form']['buttons']['answer']);
                 unset($this->content['q_view']['form']['buttons']['comment']);
                 unset($this->content['a_form']);
                 unset($this->content['c_form']);
             }
         }
         if (isset($this->content['q_list'])) {
             $wiki_array = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^postmeta WHERE meta_key=$', 'is_community'));
             foreach ($wiki_array as $q) {
                 $wiki[(int) $q['post_id']] = $q['meta_value'];
             }
             foreach ($this->content['q_list']['qs'] as $idx => $question) {
                 if (isset($wiki[$question['raw']['postid']])) {
                     $this->content['q_list']['qs'][$idx]['title'] .= ' ' . qa_lang('cp/question_title');
                 }
             }
         }
     }
 }
开发者ID:BrunoVandekerkhove,项目名称:q2a-community-posts,代码行数:46,代码来源:qa-cp-layer.php


示例15: doctype

 function doctype()
 {
     if (qa_opt($this->opt) === '1') {
         // fetch all widgets into a basic list
         $sql = 'SELECT * FROM ^' . $this->pluginkey . ' ORDER BY ordering';
         $widgets = qa_db_read_all_assoc(qa_db_query_sub($sql));
         foreach ($widgets as $wid) {
             $wid['pages'] = explode(',', @$wid['pages']);
             $show_all = $wid['pages'][0] == 'all';
             $show_tmpl = in_array($this->template, $wid['pages']);
             $show_custom = in_array('custom:' . $this->request, $wid['pages']);
             if ($show_all || $show_tmpl || $show_custom) {
                 $this->widgets[] = $wid;
             }
         }
     }
     parent::doctype();
 }
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:18,代码来源:qa-wa-layer.php


示例16: qa_merge_do_merge

function qa_merge_do_merge()
{
    qa_opt('merge_question_merged', qa_post_text('merge_question_merged'));
    $from = (int) qa_post_text('merge_from');
    $to = (int) qa_post_text('merge_to');
    $titles = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid,title,acount FROM ^posts WHERE postid IN (#,#)", qa_post_text('merge_from'), qa_post_text('merge_to')));
    if (count($titles) != 2) {
        $error1 = null;
        $error2 = null;
        if (empty($titles)) {
            $error1 = 'Post not found.';
            $error2 = $error1;
        } else {
            if ($titles[0]['postid'] == $from) {
                $error2 = 'Post not found.';
            } else {
                if ($titles[0]['postid'] == $to) {
                    $error1 = 'Post not found.';
                } else {
                    $error1 = 'unknown error.';
                }
            }
        }
        return array($error1, $error2);
    } else {
        $acount = (int) $titles[0]['acount'] + (int) $titles[1]['acount'];
        $text = '<div class="qa-content-merged"> ' . str_replace('^post', qa_path(qa_q_request((int) qa_post_text('merge_to'), $titles[0]['postid'] == $to ? $titles[0]['title'] : $titles[1]['title']), null, qa_opt('site_url')), qa_opt('merge_question_merged')) . ' </div>';
        qa_db_query_sub("UPDATE ^posts SET parentid=# WHERE parentid=#", $to, $from);
        qa_db_query_sub("UPDATE ^posts SET acount=# WHERE postid=#", $acount, $to);
        qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^postmeta (
				meta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
				post_id bigint(20) unsigned NOT NULL,
				meta_key varchar(255) DEFAULT \'\',
				meta_value longtext,
				PRIMARY KEY (meta_id),
				KEY post_id (post_id),
				KEY meta_key (meta_key)
				) ENGINE=MyISAM  DEFAULT CHARSET=utf8');
        qa_db_query_sub("INSERT INTO ^postmeta (post_id,meta_key,meta_value) VALUES (#,'merged_with',#)", $from, $to);
        require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
        qa_post_delete($from);
        return true;
    }
}
开发者ID:NoahY,项目名称:q2a-post-merge,代码行数:44,代码来源:qa-plugin.php


示例17: cs_post_list

 function cs_post_list($type, $limit, $return = false)
 {
     $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.* FROM ^posts, ^users WHERE ^posts.userid=^users.userid AND ^posts.type=$ ORDER BY ^posts.created DESC LIMIT #', $type, $limit));
     $output = '<ul class="posts-list">';
     foreach ($posts as $p) {
         if ($type == 'Q') {
             $what = qa_lang_html('cleanstrap/asked');
         } elseif ($type == 'A') {
             $what = qa_lang_html('cleanstrap/answered');
         } elseif ('C') {
             $what = qa_lang_html('cleanstrap/commented');
         }
         $handle = $p['handle'];
         $timeCode = qa_when_to_html(strtotime($p['created']), 7);
         $when = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix'];
         $output .= '<li>';
         $output .= cs_get_post_avatar($p, $p['userid'], 30, true);
         $output .= '<div class="post-content">';
         if ($type == 'Q') {
             $output .= '<a class="title question" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . qa_html($p['title']) . '</a>';
         } elseif ($type == 'A') {
             $output .= '<a class="title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
         } else {
             $output .= '<a class="title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>';
         }
         $output .= '<div class="meta">';
         //$output .= '<span><a href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a> ' . $what . '</span>';
         if ($type == 'Q') {
             $output .= '<span>' . qa_lang_sub('cleanstrap/x_answers', $p['acount']) . '</span>';
         }
         $output .= '<span class="time icon-time">' . $when . '</span>';
         $output .= '<span class="vote-count icon-thumbs-up2">' . qa_lang_sub('cleanstrap/x_votes', $p['netvotes']) . '</span>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</li>';
     }
     $output .= '</ul>';
     if ($return) {
         return $output;
     }
     echo $output;
 }
开发者ID:microbye,项目名称:CleanStrap,代码行数:42,代码来源:widget_posts.php


示例18: process_request

 public function process_request($request)
 {
     $requestparts = explode('/', qa_request());
     $slugs = array_slice($requestparts, 1);
     $countslugs = count($slugs);
     $userid = qa_get_logged_in_userid();
     $start = qa_get_start();
     $count = qa_opt_if_loaded('page_size_activity');
     $totalcount = qa_opt('cache_qcount');
     $qspec = qa_db_posts_basic_selectspec($userid, false);
     qa_db_add_selectspec_opost($qspec, 'ra', false, false);
     qa_db_add_selectspec_ousers($qspec, 'rau', 'raup');
     $qspec['source'] .= " JOIN (SELECT questionid, childid FROM ^homepage ORDER BY ^homepage.updated DESC) AS rcaq ON ^posts.postid=rcaq.questionid" . " LEFT JOIN ^posts AS ra ON childid=ra.postid" . (QA_FINAL_EXTERNAL_USERS ? "" : " LEFT JOIN ^users AS rau ON ra.userid=rau.userid") . " LEFT JOIN ^userpoints AS raup ON ra.userid=raup.userid LIMIT #,#";
     array_push($qspec['columns'], 'childid');
     array_push($qspec['arguments'], $start, $count);
     $qspec['sortdesc'] = 'otime';
     $query = 'SELECT ';
     foreach ($qspec['columns'] as $columnas => $columnfrom) {
         $query .= $columnfrom . (is_int($columnas) ? '' : ' AS ' . $columnas) . ', ';
     }
     $query = qa_db_apply_sub(substr($query, 0, -2) . (strlen(@$qspec['source']) ? ' FROM ' . $qspec['source'] : ''), @$qspec['arguments']);
     $results = qa_db_read_all_assoc(qa_db_query_raw($query));
     qa_db_post_select($results, $qspec);
     list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null);
     $questions = qa_any_sort_and_dedupe($results);
     // $questions=qa_any_sort_and_dedupe(array_merge($recentquestions,$recentanswers));
     $pagesize = qa_opt('page_size_home');
     if ($countslugs) {
         if (!isset($categoryid)) {
             return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
         }
         $categorytitlehtml = qa_html($categories[$categoryid]['title']);
         $sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml);
         $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml);
     } else {
         $sometitle = qa_lang_html('main/recent_qs_as_title');
         $nonetitle = qa_lang_html('main/no_questions_found');
     }
     require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
     $qa_content = qa_q_list_page_content($questions, $pagesize, $start, $totalcount, $sometitle, $nonetitle, $categories, $categoryid, true, qa_opt('eql_homepage_url'), qa_opt('feed_for_qa') ? qa_opt('eql_homepage_url') : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null);
     return $qa_content;
 }
开发者ID:BrunoVandekerkhove,项目名称:q2a-expandable-question-lists,代码行数:42,代码来源:qa-eql-homepage.php


示例19: cs_top_users

 function cs_top_users($limit = 5, $size)
 {
     $users = qa_db_read_all_assoc(qa_db_query_sub('SELECT * FROM ^users JOIN ^userpoints ON ^users.userid=^userpoints.userid ORDER BY ^userpoints.points DESC LIMIT #', $limit));
     $output = '<ul class="top-users-list clearfix">';
     foreach ($users as $u) {
         if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
             require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
             $u['handle'] = qa_post_userid_to_handle($u['userid']);
         }
         $output .= '<li class="top-user clearfix">';
         $output .= cs_get_post_avatar($u, $u['userid'], $size, true);
         $output .= '<div class="top-user-data">';
         $output .= '<span class="points">' . $u['points'] . ' ' . qa_lang('cleanstrap/points') . '</span>';
         $output .= '<a href="' . qa_path_html('user/' . $u['handle']) . '" class="name">' . $u['handle'] . '</a>';
         $output .= '<p class="counts"><span>' . qa_lang_sub('cleanstrap/x_questions', $u['qposts']) . '</span> <span>' . qa_lang_sub('cleanstrap/x_answers', $u['aposts']) . '</span><span>' . qa_lang_sub('cleanstrap/x_comments', $u['cposts']) . '</span></p>';
         $output .= '</div>';
         $output .= '</li>';
     }
     $output .= '</ul>';
     return $output;
 }
开发者ID:aresthelord,项目名称:CleanStrap,代码行数:21,代码来源:widget_top_users.php


示例20: qa_db_limits_get

function qa_db_limits_get($userid, $ip, $action)
{
    $selects = array();
    $arguments = array();
    if (isset($userid)) {
        $selects[] = "(SELECT 'user' AS limitkey, period, count FROM ^userlimits WHERE userid=\$ AND action=\$)";
        $arguments[] = $userid;
        $arguments[] = $action;
    }
    if (isset($ip)) {
        $selects[] = "(SELECT 'ip' AS limitkey, period, count FROM ^iplimits WHERE ip=COALESCE(INET_ATON(\$), 0) AND action=\$)";
        $arguments[] = $ip;
        $arguments[] = $action;
    }
    if (count($selects)) {
        $query = qa_db_apply_sub(implode(' UNION ALL ', $selects), $arguments);
        return qa_db_read_all_assoc(qa_db_query_raw($query), 'limitkey');
    } else {
        return array();
    }
}
开发者ID:gogupe,项目名称:question2answer-releases,代码行数:21,代码来源:qa-db-limits.php



注:本文中的qa_db_read_all_assoc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP qa_db_read_all_values函数代码示例发布时间:2022-05-15
下一篇:
PHP qa_db_query_sub函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap