include template('handle_ques_addscore'); } elseif ($command == 'ques_addscore_submit') { $query = $dblink->query("select count(*) from {$dbprefix}ques where qid={$qid}"); if (!$dblink->result($query, 0)) { show_message('action_error', './'); exit; } if (check_submit($_POST['addscoresubmit'], $_POST['formhash'])) { $addscore = intval($_POST['addscore']); $my_score = get_score($cyask_uid); if ($addscore > $my_score) { show_message('score_error', ''); exit; } else { $dblink->query("UPDATE {$dbprefix}ques SET score=score+{$addscore},endtime=endtime+432000 WHERE qid={$qid}"); sub_score($cyask_uid, $addscore); header("location:signal.php?resultno=106&url={$url}"); exit; } } else { show_message('url_error', './'); exit; } } elseif ($command == 'ques_close') { $query = $dblink->query("select count(*) from {$dbprefix}ques where qid={$qid}"); if (!$dblink->result($query, 0)) { show_message('action_error', './'); exit; } $title = $site_name; $query = $dblink->query("select title,score,answercount from {$dbprefix}ques where qid={$qid}");
$sid2 = $sortrow['sid2']; $sid3 = $sortrow['sid']; break; } } else { show_message('class_error', ''); exit; } $give_score = intval($_POST['givescore']); if ($give_score) { $my_score = get_score($cyask_uid); if ($give_score > $my_score) { show_message('score_error', ''); exit; } else { sub_score($cyask_uid, $give_score); } } $ques_title = filters_title($_POST['qtitle']); $ques_content = filters_content($_POST['qsupply']); $ques_hidanswer = $_POST['hidanswer'] ? 1 : 0; $endtime = $timestamp + 1296000; $do = $dblink->query("INSERT INTO {$dbprefix}ques SET title='{$ques_title}',content='{$ques_content}',sid1='{$sid1}',sid2='{$sid2}',sid3='{$sid3}',uid='{$cyask_uid}',username='******',\r\n\t\tscore='{$give_score}',asktime='{$timestamp}',endtime='{$endtime}',hidanswer='{$ques_hidanswer}'"); if ($do) { include language('templates', $tpldir, $styleid); $feed = array(); $feed['icon'] = 'thread'; $feed['title_template'] = $lang['ques_title_template']; $feed['title_data'] = array('username' => $cyask_user); $feed['body_template'] = '<b>{subject}</b><br>{message}'; $feed['body_data'] = array('subject' => "<a href=\"" . $baseurl . "/question.php?qid=" . $dblink->insert_id() . "\">{$ques_title}</a>", 'message' => cut_str(strip_tags(preg_replace("/\\[.+?\\]/is", '', $ques_content)), 150));