Exemple #1
0
function qa_db_user_create_by_id($FbId, $email, $password, $handle, $level, $ip)
{
    require_once QA_INCLUDE_DIR . 'qa-util-string.php';
    $salt = isset($password) ? qa_random_alphanum(16) : null;
    qa_db_query_sub('INSERT INTO ^users (userid,created, createip, email, passsalt, passcheck, level, handle, loggedin, loginip) ' . 'VALUES ($,NOW(), COALESCE(INET_ATON($), 0), $, $, UNHEX($), #, $, NOW(), COALESCE(INET_ATON($), 0))', $FbId, $ip, $email, $salt, isset($password) ? qa_db_calc_passcheck($password, $salt) : null, (int) $level, $handle, $ip);
    return qa_db_last_insert_id();
}
Exemple #2
0
function widget_opt_update($name, $position, $order, $param, $id = false)
{
    if ($id) {
        qa_db_query_sub('UPDATE ^cs_widgets SET position = $, widget_order = #, param = $ WHERE id=#', $position, $order, $param, $id);
        return $id;
    } else {
        qa_db_query_sub('INSERT ^cs_widgets (name, position, widget_order, param) VALUES ($, $, #, $)', $name, $position, $order, $param);
        return qa_db_last_insert_id();
    }
}
function qa_db_post_create($type, $parentid, $userid, $cookieid, $ip, $title, $content, $format, $tagstring, $notify, $categoryid = null, $name = null)
{
    qa_db_query_sub('INSERT INTO ^posts (categoryid, type, parentid, userid, cookieid, createip, title, content, format, tags, notify, name, created) ' . 'VALUES (#, $, #, $, #, INET_ATON($), $, $, $, $, $, $, NOW())', $categoryid, $type, $parentid, $userid, $cookieid, $ip, $title, $content, $format, $tagstring, $notify, $name);
    return qa_db_last_insert_id();
}
Exemple #4
0
function qa_db_message_create($fromuserid, $touserid, $content, $format)
{
    qa_db_query_sub('INSERT INTO ^messages (fromuserid, touserid, content, format, created) VALUES (#, #, $, $, NOW())', $fromuserid, $touserid, $content, $format);
    return qa_db_last_insert_id();
}
Exemple #5
0
function qa_db_usernotice_create($userid, $content, $format = '', $tags = null)
{
    qa_db_query_sub('INSERT INTO ^usernotices (userid, content, format, tags, created) VALUES ($, $, $, $, NOW())', $userid, $content, $format, $tags);
    return qa_db_last_insert_id();
}
Exemple #6
0
function qa_db_widget_create($title, $tags)
{
    $position = qa_db_read_one_value(qa_db_query_sub('SELECT 1+COALESCE(MAX(position), 0) FROM ^widgets'));
    qa_db_query_sub('INSERT INTO ^widgets (place, position, tags, title) VALUES (\'\', #, $, $)', $position, $tags, $title);
    return qa_db_last_insert_id();
}
 private function save_widget()
 {
     $widget = array();
     $widget['id'] = qa_post_text('wid');
     $widget['title'] = qa_post_text('wtitle');
     $widget['position'] = qa_post_text('wposition');
     $widget['ordering'] = qa_post_text('wordering');
     $widget['content'] = qa_post_text('wcontent');
     $pages = array();
     if (qa_post_text('wpages_all')) {
         $pages[] = 'all';
     } else {
         foreach ($this->templatelangkeys as $key => $lang) {
             if (qa_post_text('wpages_' . $key)) {
                 $pages[] = $key;
             }
         }
         if (qa_post_text('cb_custom_pages')) {
             $wpages_custom = explode(',', qa_post_text('wpages_custom'));
             foreach ($wpages_custom as $cp) {
                 $pages[] = 'custom:' . $cp;
             }
         }
     }
     $widget['pages'] = implode(',', $pages);
     if ($widget['id'] === '0') {
         $sql = 'INSERT INTO ^' . $this->pluginkey . ' (id, title, pages, position, ordering, content) VALUES (0, $, $, $, #, $)';
         $success = qa_db_query_sub($sql, $widget['title'], $widget['pages'], $widget['position'], $widget['ordering'], $widget['content']);
         $widget['id'] = qa_db_last_insert_id();
     } else {
         $sql = 'UPDATE ^' . $this->pluginkey . ' SET title=$, pages=$, position=$, ordering=#, content=$ WHERE id=#';
         $success = qa_db_query_sub($sql, $widget['title'], $widget['pages'], $widget['position'], $widget['ordering'], $widget['content'], $widget['id']);
     }
     return $widget;
 }
function qa_db_message_create($fromuserid, $touserid, $content, $format, $public = false)
{
    qa_db_query_sub('INSERT INTO ^messages (type, fromuserid, touserid, content, format, created) VALUES ($, #, #, $, $, NOW())', $public ? 'PUBLIC' : 'PRIVATE', $fromuserid, $touserid, $content, $format);
    return qa_db_last_insert_id();
}
function qw_dump_email_to_db($notifying_user, $queue_id)
{
    qa_db_query_sub('INSERT INTO ^ra_email_queue_receiver (userid, handle, email , name , queue_id ) ' . 'VALUES (#, $, $ , $ , # )', $notifying_user['userid'], $notifying_user['handle'], $notifying_user['email'], $notifying_user['name'], $queue_id);
    return qa_db_last_insert_id();
}
Exemple #10
0
function updateQues($postid, $title = null, $content = null, $areaclass = null, $conclass = null, $tags = null, $istop = -1, $ishot = -1)
{
    $post = qa_post_get_full($postid);
    if ($istop == 1) {
        //如果设置了置顶,则将同类其它的帖子取消置顶
        setTopQuestion($postid);
    } elseif ($istop == 0) {
        unsetTopQuestion($postid);
    }
    if ($ishot == 1) {
        setHotQA($postid);
    } elseif ($ishot == 0) {
        unsetHotQA($postid);
    }
    if (!isset($title)) {
        $title = $post['title'];
    }
    if (!isset($content)) {
        $content = $post['content'];
    }
    if (!isset($areaclass)) {
        $title = @$post['areaclass'];
    }
    if (!isset($conclass)) {
        $content = @$post['conclass'];
    }
    $query = 'UPDATE ^posts set title=$, content=$, areaclass=$, conclass=$,tags=$';
    $query .= ' where postid= $';
    // echo $query.'<br />';
    // for ($i=0; $i < func_num_args(); $i++) {
    // 	$arg = func_get_arg($i);
    // 	echo $arg.'<br />';
    // }
    $arr = qa_db_query_sub($query, $title, $content, $areaclass, $conclass, $tags, $postid);
    return qa_db_last_insert_id();
}
Exemple #11
0
 private function post_message($data)
 {
     $sql = 'INSERT INTO ^chat_posts (postid, userid, posted, message) VALUES (0, #, $, $)';
     qa_db_query_sub($sql, $data['userid'], $data['posted'], $data['message']);
     return qa_db_last_insert_id();
 }