当前位置: 首页>>代码示例>>PHP>>正文


PHP qa_db_read_all_values函数代码示例

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


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

示例1: init_queries

 function init_queries($tableslc)
 {
     // check if the plugin is initialized
     $ok = qa_opt('open_login_ok');
     if ($ok == 3) {
         return null;
     }
     $queries = array();
     $columns = qa_db_read_all_values(qa_db_query_sub('describe ^userlogins'));
     if (!in_array('oemail', $columns)) {
         $queries[] = 'ALTER TABLE ^userlogins ADD `oemail` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL';
     }
     if (!in_array('ohandle', $columns)) {
         $queries[] = 'ALTER TABLE ^userlogins ADD `ohandle` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL';
     }
     $columns = qa_db_read_all_values(qa_db_query_sub('describe ^users'));
     if (!in_array('oemail', $columns)) {
         $queries[] = 'ALTER TABLE ^users ADD `oemail` VARCHAR( 80 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL';
     }
     if (count($queries)) {
         return $queries;
     }
     // we're already set up
     qa_opt('open_login_ok', '3');
     return null;
 }
开发者ID:microbye,项目名称:q2a-open-login,代码行数:26,代码来源:qa-open-page-logins.php

示例2: mp_get_categoryslug

function mp_get_categoryslug()
{
    $i = qa_db_read_all_values(qa_db_query_sub('select backpath from ^categories where categoryid=#', mp_get_categoryid()));
    if (count($i) > 0) {
        return array_reverse(explode('/', $i[0]));
    } else {
        return "";
    }
}
开发者ID:TheProjecter,项目名称:microprobe,代码行数:9,代码来源:mp-db-users.php

示例3: qa_page_q_post_rules

function qa_page_q_post_rules($post, $parentpost = null, $siblingposts = null, $childposts = null)
{
    $rules = qa_page_q_post_rules_base($post, $parentpost, $siblingposts, $childposts);
    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');
    $expert = qa_db_read_one_value(qa_db_query_sub("SELECT meta_value FROM ^postmeta WHERE meta_key='is_expert_question' AND post_id=#", $post['postid']), true);
    if ($expert) {
        if (!qa_permit_value_error(qa_opt('expert_question_roles'), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags())) {
            $is_expert = true;
        }
        $users = qa_opt('expert_question_users');
        $users = explode("\n", $users);
        $handle = qa_get_logged_in_handle();
        foreach ($users as $idx => $user) {
            if ($user == $handle) {
                $is_expert = true;
                break;
            }
            if (strpos($user, '=')) {
                $user = explode('=', $user);
                if ($user[0] == $handle) {
                    $catnames = explode(',', $user[1]);
                    $cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
                    $is_expert = $cats;
                }
            }
        }
        if (isset($is_expert) && !$rules['viewable']) {
            // experts that aren't allowed to change hidden questions
            if (is_array($is_expert)) {
                $in_cats = qa_db_read_one_value(qa_db_query_sub("SELECT COUNT(postid) FROM ^posts WHERE categoryid IN (#) AND postid=#", $is_expert, $post['postid']), true);
                if ($in_cats) {
                    $rules['viewable'] = true;
                }
            } else {
                $rules['viewable'] = true;
            }
        }
        $rules['reshowable'] = false;
        $rules['answerbutton'] = true;
        $rules['commentbutton'] = true;
        $rules['commentable'] = true;
    }
    return $rules;
}
开发者ID:rkarimabadi,项目名称:q2a-expert-questions,代码行数:52,代码来源:qa-expert-overrides.php

示例4: process_event

    function process_event($event, $userid, $handle, $cookieid, $params)
    {
        if (qa_opt('expert_question_enable')) {
            switch ($event) {
                case 'q_post':
                    if (qa_post_text('is_expert_question') == 'yes' || in_array(qa_opt('expert_question_type'), array(1, 2)) && !qa_get_logged_in_userid() || qa_opt('expert_question_type') == 3) {
                        require_once QA_INCLUDE_DIR . 'qa-app-post-update.php';
                        qa_question_set_hidden($params, true, $userid, $handle, $cookieid, array(), array());
                        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 (#,'is_expert_question','1')", $params['postid']);
                        if (qa_opt('expert_question_email_experts')) {
                            $subs = array('^post_title' => $params['title'], '^post_url' => qa_path_html(qa_q_request($params['postid'], $params['title']), null, qa_opt('site_url')), '^questions_list' => qa_path_html(qa_opt('expert_question_page_url'), null, qa_opt('site_url')), '^site_url' => qa_opt('site_url'));
                            $experts = explode("\n", qa_opt('expert_question_users'));
                            foreach ($experts as $expert) {
                                if (strpos($expert, '=')) {
                                    $expert = explode('=', $expert);
                                    $catnames = explode(',', $expert[1]);
                                    $cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
                                    if (in_array($params['categoryid'], $cats)) {
                                        qa_send_notification($this->getuserfromhandle($expert[0]), '@', $expert[0], qa_opt('expert_question_email_subject'), qa_opt('expert_question_email_body'), $subs);
                                    }
                                } else {
                                    qa_send_notification($this->getuserfromhandle($expert), '@', $expert, qa_opt('expert_question_email_subject'), qa_opt('expert_question_email_body'), $subs);
                                }
                            }
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }
开发者ID:rkarimabadi,项目名称:q2a-expert-questions,代码行数:41,代码来源:qa-expert-check.php

示例5: is_expert_user

 function is_expert_user()
 {
     if (!qa_permit_value_error(qa_opt('expert_question_roles'), qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags())) {
         return true;
     }
     $users = qa_opt('expert_question_users');
     $users = explode("\n", $users);
     $handle = qa_get_logged_in_handle();
     foreach ($users as $idx => $user) {
         if ($user == $handle) {
             return true;
         }
         if (strpos($user, '=')) {
             $user = explode('=', $user);
             if ($user[0] == $handle) {
                 $catnames = explode(',', $user[1]);
                 $cats = qa_db_read_all_values(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE title IN ($)', $catnames));
                 return $cats;
             }
         }
     }
     return false;
 }
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:23,代码来源:qa-book-page.php

示例6: cs_user_badge

function cs_user_badge($handle)
{
    if (qa_opt('badge_active')) {
        $userids = qa_handles_to_userids(array($handle));
        $userid = $userids[$handle];
        // displays small badge widget, suitable for meta
        $result = qa_db_read_all_values(qa_db_query_sub('SELECT badge_slug FROM ^userbadges WHERE user_id=#', $userid));
        if (count($result) == 0) {
            return;
        }
        $badges = qa_get_badge_list();
        foreach ($result as $slug) {
            $bcount[$badges[$slug]['type']] = isset($bcount[$badges[$slug]['type']]) ? $bcount[$badges[$slug]['type']] + 1 : 1;
        }
        $output = '<ul class="user-badge clearfix">';
        for ($x = 2; $x >= 0; $x--) {
            if (!isset($bcount[$x])) {
                continue;
            }
            $count = $bcount[$x];
            if ($count == 0) {
                continue;
            }
            $type = qa_get_badge_type($x);
            $types = $type['slug'];
            $typed = $type['name'];
            $output .= '<li class="badge-medal ' . $types . '"><i class="icon-badge" title="' . $count . ' ' . $typed . '"></i><span class="badge-pointer badge-' . $types . '-count" title="' . $count . ' ' . $typed . '"> ' . $count . '</span></li>';
        }
        $output = substr($output, 0, -1);
        // lazy remove space
        $output .= '</ul>';
        return $output;
    }
}
开发者ID:microbye,项目名称:CleanStrap,代码行数:34,代码来源:functions.php

示例7: qa_db_user_find_by_handle

function qa_db_user_find_by_handle($handle)
{
    return qa_db_read_all_values(qa_db_query_sub('SELECT userid FROM ^users WHERE handle=$', $handle));
}
开发者ID:bafio89,项目名称:qea-u,代码行数:4,代码来源:qa-db-users.php

示例8: check_badges

 function check_badges($uid)
 {
     $medals = qa_db_read_all_values(qa_db_query_sub('SELECT user_id FROM ^userbadges WHERE user_id=#', $uid));
     $badges = array('medalist', 'champion', 'olympian');
     foreach ($badges as $badge_slug) {
         if (count($medals) >= (int) qa_opt('badge_' . $badge_slug . '_var') && qa_opt('badge_' . $badge_slug . '_enabled') !== '0') {
             $result = qa_db_read_one_value(qa_db_query_sub('SELECT badge_slug FROM ^userbadges WHERE user_id=# AND badge_slug=$', $uid, $badge_slug), true);
             if ($result == null) {
                 // not already awarded this badge
                 $this->award_badge(null, $uid, $badge_slug, true);
                 // this is a "badge badge"
             }
         }
     }
 }
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:15,代码来源:qa-badge-check.php

示例9: qa_news_plugin_send_newsletter

function qa_news_plugin_send_newsletter($news)
{
    $users = qa_db_read_all_values(qa_db_query_sub("SELECT userid FROM qa_usermetas WHERE title = \$ AND content = \$", 'newsletter', '1'));
    require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
    $handles = qa_userids_to_handles($users);
    foreach ($users as $userid) {
        $handle = $handles[$userid];
        if (QA_FINAL_EXTERNAL_USERS) {
            $email = qa_get_user_email($userid);
        } else {
            $useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
            $email = @$useraccount['email'];
        }
        qa_send_email(array('fromemail' => qa_opt('from_email'), 'fromname' => qa_opt('site_title'), 'toemail' => $email, 'toname' => $handle, 'subject' => qa_opt('site_title') . ' ' . qa_lang('newsletter/newsletter'), 'body' => $news, 'html' => true));
    }
    error_log('Q2A Newsletter Sent on ' . date('M j, Y \\a\\t H\\:i\\:s'));
}
开发者ID:ruuttt,项目名称:question2answer_sandbox,代码行数:17,代码来源:qa-plugin.php

示例10: qa_db_upgrade_tables


//.........这里部分代码省略.........
                    qa_db_upgrade_query(qa_db_create_table_sql('userfields', array('fieldid' => $definitions['userfields']['fieldid'], 'title' => $definitions['userfields']['title'], 'content' => $definitions['userfields']['content'], 'position' => $definitions['userfields']['position'], 'flags' => $definitions['userfields']['flags'], 'PRIMARY KEY (fieldid)')));
                    $locktablesquery .= ', ^userfields WRITE';
                    qa_db_upgrade_query($locktablesquery);
                    qa_db_upgrade_query(qa_db_default_userfields_sql());
                }
                break;
                //	Up to here: Version 1.3 beta 1
            //	Up to here: Version 1.3 beta 1
            case 22:
                if (!QA_FINAL_EXTERNAL_USERS) {
                    qa_db_upgrade_query('ALTER TABLE ^users ADD COLUMN sessionsource ' . $definitions['users']['sessionsource'] . ' AFTER sessioncode');
                    qa_db_upgrade_query($locktablesquery);
                }
                break;
                //	Up to here: Version 1.3 beta 2 and release
            //	Up to here: Version 1.3 beta 2 and release
            case 23:
                qa_db_upgrade_query('UNLOCK TABLES');
                qa_db_upgrade_query(qa_db_create_table_sql('widgets', array('widgetid' => $definitions['widgets']['widgetid'], 'place' => $definitions['widgets']['place'], 'position' => $definitions['widgets']['position'], 'tags' => $definitions['widgets']['tags'], 'title' => $definitions['widgets']['title'], 'PRIMARY KEY (widgetid)', 'UNIQUE position (position)')));
                $locktablesquery .= ', ^widgets WRITE';
                qa_db_upgrade_query($locktablesquery);
                break;
            case 24:
                qa_db_upgrade_query('UNLOCK TABLES');
                qa_db_upgrade_query(qa_db_create_table_sql('tagwords', array('postid' => $definitions['tagwords']['postid'], 'wordid' => $definitions['tagwords']['wordid'], 'KEY postid (postid)', 'KEY wordid (wordid)', 'CONSTRAINT ^tagwords_ibfk_1 FOREIGN KEY (postid) REFERENCES ^posts(postid) ON DELETE CASCADE', 'CONSTRAINT ^tagwords_ibfk_2 FOREIGN KEY (wordid) REFERENCES ^words(wordid)')));
                $locktablesquery .= ', ^tagwords WRITE';
                qa_db_upgrade_query('ALTER TABLE ^words ADD COLUMN tagwordcount ' . $definitions['words']['tagwordcount'] . ' AFTER contentcount');
                qa_db_upgrade_query($locktablesquery);
                $keyrecalc['doreindexcontent'] = true;
                break;
                //	Up to here: Version 1.4 developer preview
            //	Up to here: Version 1.4 developer preview
            case 25:
                $keycolumns = qa_array_to_keys(qa_db_read_all_values(qa_db_query_sub('SHOW COLUMNS FROM ^blobs')));
                // might be using blobs table shared with another installation, so check if we need to upgrade
                if (isset($keycolumns['filename'])) {
                    qa_db_upgrade_progress('Skipping upgrading blobs table since it was already upgraded by another Q2A site sharing it.');
                } else {
                    qa_db_upgrade_query('ALTER TABLE ^blobs ADD COLUMN filename ' . $definitions['blobs']['filename'] . ' AFTER content, ADD COLUMN userid ' . $definitions['blobs']['userid'] . ' AFTER filename, ADD COLUMN cookieid ' . $definitions['blobs']['cookieid'] . ' AFTER userid, ADD COLUMN createip ' . $definitions['blobs']['createip'] . ' AFTER cookieid, ADD COLUMN created ' . $definitions['blobs']['created'] . ' AFTER createip');
                    qa_db_upgrade_query($locktablesquery);
                }
                break;
            case 26:
                qa_db_upgrade_query('ALTER TABLE ^uservotes ADD COLUMN flag ' . $definitions['uservotes']['flag'] . ' AFTER vote');
                qa_db_upgrade_query($locktablesquery);
                qa_db_upgrade_query('ALTER TABLE ^posts ADD COLUMN flagcount ' . $definitions['posts']['flagcount'] . ' AFTER downvotes, ADD KEY type_3 (type, flagcount, created)');
                qa_db_upgrade_query($locktablesquery);
                $keyrecalc['dorecountposts'] = true;
                break;
            case 27:
                qa_db_upgrade_query('ALTER TABLE ^posts ADD COLUMN netvotes ' . $definitions['posts']['netvotes'] . ' AFTER downvotes, ADD KEY type_4 (type, netvotes, created)');
                qa_db_upgrade_query($locktablesquery);
                $keyrecalc['dorecountposts'] = true;
                break;
            case 28:
                qa_db_upgrade_query('ALTER TABLE ^posts ADD COLUMN views ' . $definitions['posts']['views'] . ' AFTER netvotes, ADD COLUMN hotness ' . $definitions['posts']['hotness'] . ' AFTER views, ADD KEY type_5 (type, views, created), ADD KEY type_6 (type, hotness)');
                qa_db_upgrade_query($locktablesquery);
                $keyrecalc['dorecountposts'] = true;
                break;
            case 29:
                qa_db_upgrade_query('ALTER TABLE ^posts ADD COLUMN lastviewip ' . $definitions['posts']['lastviewip'] . ' AFTER netvotes');
                qa_db_upgrade_query($locktablesquery);
                break;
            case 30:
                qa_db_upgrade_query('ALTER TABLE ^posts DROP FOREIGN KEY ^posts_ibfk_3');
                // to allow category column types to be changed
开发者ID:kosmoluna,项目名称:question2answer,代码行数:67,代码来源:install.php

示例11: get_expert_question_for_user

    function get_expert_question_for_user($uid)
    {
        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');
        $questions = qa_db_read_all_values(qa_db_query_sub("SELECT ^posts.postid FROM ^postmeta, ^posts WHERE ^postmeta.meta_key='is_expert_question' AND ^postmeta.post_id=^posts.postid AND ^posts.userid=#", $uid), true);
        return $questions;
    }
开发者ID:rkarimabadi,项目名称:q2a-expert-questions,代码行数:14,代码来源:qa-expert-layer.php

示例12: ra_user_followers

function ra_user_followers($handle)
{
    $userid = qa_handle_to_userid($handle);
    $followers = qa_db_read_all_values(qa_db_query_sub('SELECT ^users.handle FROM ^userfavorites, ^users  WHERE (^userfavorites.userid = ^users.userid and ^userfavorites.entityid = #) and ^userfavorites.entitytype = "U" LIMIT 12', $userid));
    if (count($followers)) {
        $output = '<div class="user-followsers widget">';
        $output .= '<h3 class="widget-title">' . _ra_lang('Followers') . '<span class="counts">' . count($followers) . '</span></h3>';
        $output .= '<ul class="user-followers clearfix">';
        foreach ($followers as $user) {
            $id = qa_handle_to_userid($user);
            $output .= '<li><div class="avatar" data-handle="' . $user . '" data-id="' . $id . '"><a href="' . qa_path_html('user/' . $user) . '"><img src="' . ra_get_avatar($user, 50, false) . '" /></a></div></li>';
        }
        $output .= '</ul>';
        $output .= '</div>';
        echo $output;
    }
    return;
}
开发者ID:rahularyan,项目名称:dude-theme,代码行数:18,代码来源:qa-plugin.php

示例13: badge_notify

 function badge_notify()
 {
     $userid = qa_get_logged_in_userid();
     qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^userbadges (' . 'awarded_at DATETIME NOT NULL,' . 'user_id INT(11) NOT NULL,' . 'notify TINYINT DEFAULT 0 NOT NULL,' . 'object_id INT(10),' . 'badge_slug VARCHAR (64) CHARACTER SET ascii DEFAULT \'\',' . 'id INT(11) NOT NULL AUTO_INCREMENT,' . 'PRIMARY KEY (id)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $result = qa_db_read_all_values(qa_db_query_sub('SELECT badge_slug FROM ^userbadges WHERE user_id=# AND notify>=1', $userid));
     if (count($result) > 0) {
         $notice = '<div class="notify-container">';
         if (count($result) == 1) {
             $slug = $result[0];
             $badge_name = qa_lang('badges/' . $slug);
             if (!qa_opt('badge_' . $slug . '_name')) {
                 qa_opt('badge_' . $slug . '_name', $badge_name);
             }
             $name = qa_opt('badge_' . $slug . '_name');
             $notice .= '<div class="badge-notify notify">' . qa_lang('badges/badge_notify') . "'" . $name . '\'&nbsp;&nbsp;' . qa_lang('badges/badge_notify_profile_pre') . '<a href="' . qa_path_html((QA_FINAL_EXTERNAL_USERS ? qa_path_to_root() : '') . 'user/' . qa_get_logged_in_handle(), array('tab' => 'badges'), qa_opt('site_url')) . '">' . qa_lang('badges/badge_notify_profile') . '</a><div class="notify-close" onclick="jQuery(this).parent().slideUp(\'slow\')">x</div></div>';
         } else {
             $number_text = count($result) > 2 ? str_replace('#', count($result) - 1, qa_lang('badges/badge_notify_multi_plural')) : qa_lang('badges/badge_notify_multi_singular');
             $slug = $result[0];
             $badge_name = qa_lang('badges/' . $slug);
             if (!qa_opt('badge_' . $slug . '_name')) {
                 qa_opt('badge_' . $slug . '_name', $badge_name);
             }
             $name = qa_opt('badge_' . $slug . '_name');
             $notice .= '<div class="badge-notify notify">' . qa_lang('badges/badge_notify') . "'" . $name . '\'&nbsp;' . $number_text . '&nbsp;&nbsp;' . qa_lang('badges/badge_notify_profile_pre') . '<a href="' . qa_path_html('user/' . qa_get_logged_in_handle(), array('tab' => 'badges'), qa_opt('site_url')) . '">' . qa_lang('badges/badge_notify_profile') . '</a><div class="notify-close" onclick="jQuery(this).parent().slideUp(\'slow\')">x</div></div>';
         }
         $notice .= '</div>';
         // remove notification flag
         qa_db_query_sub('UPDATE ^userbadges SET notify=0 WHERE user_id=# AND notify>=1', $userid);
         $this->badge_notice = $notice;
     }
 }
开发者ID:architbakliwal,项目名称:Q2A,代码行数:31,代码来源:qa-badge-layer.php

示例14: qa_db_has_blobs_in_db

function qa_db_has_blobs_in_db()
{
    return count(qa_db_read_all_values(qa_db_query_sub('SELECT blobid FROM ^blobs WHERE content IS NOT NULL LIMIT 1'))) ? true : false;
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:4,代码来源:qa-db-admin.php

示例15: qa_db_posts_get_for_deleting

function qa_db_posts_get_for_deleting($type, $startpostid = 0, $limit = null)
{
    $limitsql = isset($limit) ? ' ORDER BY ^posts.postid LIMIT ' . (int) $limit : '';
    return qa_db_read_all_values(qa_db_query_sub("SELECT ^posts.postid FROM ^posts LEFT JOIN ^posts AS child ON child.parentid=^posts.postid WHERE ^posts.type=\$ AND ^posts.postid>=# AND child.postid IS NULL" . $limitsql, $type . '_HIDDEN', $startpostid));
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:5,代码来源:qa-db-recalc.php


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