public function askAction() { //include_once("connect.php"); if ($_POST) { $content = $_POST['content']; $id = $_POST['UID']; $title = $_POST['title']; $abstract = substr($content, 0, 100); $nowtime = date('Y-m-d H:i:s'); $tab = $_POST['tag']; //$tab = 'hahaha'; $ask = new ask(); $question = new question(); $tag = new tag(); $question_arr = array('QTitle' => $title, 'Qcontent' => $content, 'Qabstract' => $abstract, 'looknum' => 0); $qid = $question->insertQuestion($question_arr); $ask_arr = array('UID' => $id, 'QID' => $qid, 'time' => $nowtime); $ask->insertAsk($ask_arr); $tag_arr = array('QID' => $qid, 'tag' => $tab); $tag->insertTag($tag_arr); //$this->view->QID = $qid; echo $qid; //$this->render('questioned'); } }
function fetchAskQuestions(&$page = NULL) { $x = rand(0, 100); if ($x < 50) { $mode = 'recent'; $title = 'Recent Questions'; $cacheName = 'home_askRecent'; } else { $mode = 'popular'; $title = 'Popular Questions'; $cacheName = 'home_askPopular'; } if ($this->templateObj->checkCache($cacheName, 30)) { // still current, get from cache $code = $this->templateObj->fetchCache($cacheName); } else { require_once PATH_FACEBOOK . '/classes/ask.class.php'; $askObj = new ask($this->db, $this->templateObj); $code = ''; $code .= '<div class="panel_1">'; $code .= $page->buildPanelBar($title, '<span class="pipe">|</span><a href="?p=ask&o=browse" onclick="switchPage(\'ask\',\'browse\');return false;">See all</a>', 'Questions asked by ' . SITE_TITLE . ' members'); $code .= '<div id="storyList">'; $code .= $askObj->listQuestions($mode, 0, 0, 0, 3); $code .= '</div><!-- end storyList -->'; $code .= '</div><!--end "panel_1"-->'; $this->templateObj->cacheContent($cacheName, $code); } return $code; }
<?php /** * 知识问答 列表文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once 'config/config.inc.php'; require_once "class/ask.class.php"; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); $objWebInit->db(); if (empty($_SESSION['user_id'])) { check::AlertExit("请先登陆", -1); } //删除回复帖子 if ($_GET['ac'] == 'del') { $intID = intval($_GET['id']); $arrInfo = $objWebInit->getInfo($intID); if ($_SESSION['user_group'] == '3' || $_SESSION['user_group'] == '2' || $_SESSION['user_id'] == $arrInfo['user_id']) { unset($arrInfo['reply'][$_GET['rid']]); $arrInfo['replytimes'] = $arrInfo['replytimes'] - 1; $objWebInit->saveInfo($arrInfo, 1); } } //设成最佳答案
<?php /** * 最新已解决知识问答文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ if (is_object($objWebInit)) { if (!isset($objask)) { include_once dirname(__FILE__) . "/../class/ask.class.php"; include_once dirname(__FILE__) . "/../config/var.inc.php"; $objask = new ask(); $objask->setDBG($arrGPdoDB); if (is_object($objWebInit->db)) { $objask->db = $objWebInit->db; } else { $objask->db(); } } $arrTopask = array(); $arrTopask['datas'] = $objask->getInfoList('where pass=1 ', ' ORDER BY clicktimes asc', 0, 9); $arrTopask['COUNT_ROWS'] = $arrTopask['datas']['COUNT_ROWS']; //用来判断是否有数据之用,无特别需要本行可删除 unset($arrTopask['datas']['COUNT_ROWS']); //print_r($arrTopask); // 输出到模板 $arrMOutput["smarty_assign"]['arrTopaskHot'] = $arrTopask;
<?php /** * 行业资讯后台管理栏目新增文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once '../config/config.inc.php'; require_once "../class/ask.class.php"; require_once '../../useradmin/checklogin.php'; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //图片上传参数 $objWebInit->arrGPic = $arrGPic; $objWebInit->db(); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['submitpass']) || $_POST['submitpass'] != $_SESSION['submitpasskey']) { exit; } if (empty($_POST['type_id']) || empty($_POST['title']) || empty($_POST['intro'])) { check::AlertExit("错误:有必填选项没填!", -1); } $arrTemp = explode('|', $_POST['type_id']); $_POST['type_id'] = $arrTemp[0];
} else { $userid = 0; } if (isset($_GET['sessionKey'])) { $sessionKey = $_GET['sessionKey']; } else { $sessionKey = 'noSessionKey'; } $app = setupAppFramework(); if ($session->validateSession($userid, $sessionKey) !== false) { switch ($method) { case 'askPostAnswer': if (isset($_GET['id'])) { $id = $_GET['id']; require_once PATH_FACEBOOK . "/classes/ask.class.php"; $askObj = new ask($db); $askObj->setAppLink($app); $code = $askObj->ajaxAskPostAnswer($userid, $id); } break; case 'fetchRewards': if (isset($_GET['sort'])) { $sort = $_GET['sort']; } else { $sort = 'default'; } if (isset($_GET['filter'])) { $filter = $_GET['filter']; } else { $filter = 'redeemable'; }
public function questionAction() { //封装header $auth = Zend_Auth::getinstance(); #获取auth用户实例 $auth->getIdentity(); #取得当前用户信息 $email = $auth->getIdentity(); $quser = new user(); $qquestion = new question(); $qanswer = new answer(); $qcomment = new comment(); $qask = new ask(); $likec = new likeC(); $likea = new likeA(); $followq = new followQ(); $user = $quser->getAllbyEmail($email); $header = array("UID" => $user[0]["UID"], "image" => $user[0]["image"]); $qtag = new tag(); $QID = $this->getRequest()->getParam("QID"); $tag = $qtag->getTagbyQID($QID); $Q = $qquestion->getAllbyQID($QID); $qtitle = $Q["qtitle"]; $qtime = $qask->getAskTimebyQID($QID); $qcontent = $Q["Qcontent"]; $answernum = $qanswer->getAnswernumbyQID($QID); $AIDs = $qanswer->getAIDsbyQID($QID); $ans_val[0][0] = 0; $comment[0][0] = 0; $answer[0][0] = 0; $com_val[0][0] = 0; for ($i = 0; $i < $answernum; $i++) { //第i个回答 $AID = $AIDs[$i]; $AUID = $qanswer->getUIDbyAID($AID); $auser = $quser->getAllbyUID($AUID); $Anickname = $auser["nickname"]; $anow = $qanswer->getAllbyAID($AID); $acontent = $anow["AContent"]; //print_r($anow); //print_r($acontent); $unow = $quser->getAllbyUID($AUID); $image = $unow["image"]; $atime = $qanswer->getTimebyAID($AID); $ans_val[$i] = $atime; $commentnum = $qcomment->getCommentnumbyAID($AID); $CIDs = $qcomment->getCIDsbyAID($AID); $likeNum = $likea->getLikenumbyAID($AID); $comment = array(); $com_val = array(); for ($j = 0; $j < $commentnum; $j++) { //第j个评论 $CID = $CIDs[$j]; $CUID = $qcomment->getUIDbyCID($CID); $RUID = $qcomment->getRIDbyCID($CID); $ccontent = $qcomment->getContentbyCID($CID); $ctime = $qcomment->getTimebyCID($CID); $com_val[$j] = $ctime; $user = new user(); $tmp = $user->getAllbyUID($CUID); $comment[$j] = array("CID" => $CID, "CUID" => $CUID, "RUID" => $RUID, "nickname" => $tmp['nickname'], "content" => $ccontent, "time" => $ctime); } if ($commentnum > 0) { array_multisort($com_val, SORT_DESC, $comment); } $answer[$i] = array("AID" => $AID, "AUID" => $AUID, "content" => $acontent, "image" => $image, "time" => $atime, "comment" => $comment, "commentnum" => $commentnum, "time" => $atime, "Anickname" => $Anickname, "likeNum" => $likeNum); } array_multisort($ans_val, SORT_DESC, $answer); $iscollect = false; //session_start(); if (isset($_SESSION['user'])) { $loginuser = $_SESSION['user']; } else { $loginuser = array('UID' => -1); } $UID = $loginuser['UID']; $carr = $followq->getQIDsbyUID($UID); for ($i = 0; $i < count($carr); $i++) { if ($QID == $carr[$i]) { $iscollect = true; break; } } $question = array("QID" => $QID, "content" => $qcontent, "tag" => $tag, "answernum" => $answernum, "answer" => $answer, "title" => $qtitle, "time" => $qtime, "iscollect" => $iscollect); //HotQlist $hquestion = $qanswer->getMostAnsweredQID(1, 6); for ($i = 0; $i < count($hquestion); $i++) { $qq = $qquestion->getAllbyQID($hquestion[$i]); $HotQlist[$i]["QID"] = $qq["QID"]; $HotQlist[$i]["title"] = $qq["qtitle"]; $HotQlist[$i]["follownum"] = $followq->getFollownumbyQID($qq["QID"]); $HotQlist[$i]["answernum"] = $qanswer->getAnswernumbyQID($qq["QID"]); } //print_r($question["answer"][1]); //print_r($question["answer"][1]["comment"]); $this->view->hotQlist = $HotQlist; $this->view->question = $question; $this->view->header = $header; $this->render('qdetail'); }
<?php /** * 行业资讯后台管理栏目首页文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once '../config/config.inc.php'; require_once "../class/ask.class.php"; require_once '../../useradmin/checklogin.php'; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //翻页参数 $objWebInit->arrGPage = $arrGPage; //图片上传参数 $objWebInit->arrGPic = $arrGPic; $objWebInit->db(); $arrWhere = array(); $arrLink = array(); if (isset($_GET['action'])) { if ($_GET['action'] == 'search') { // 构造搜索条件和翻页参数 $arrLink[] = 'action=search'; if (!empty($_GET['title'])) {
See LICENSE.TXT file for licensing details. */ header('Content-Type: application/xml; charset=utf-8'); require_once 'lib-php/ask.php'; echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <rss version="0.92" xml:lang="en-EN.utf8"> <channel> <title><?php echo $_SERVER['SERVER_NAME']; ?> </title> <link><?php echo 'http://' . $_SERVER['SERVER_NAME']; ?> </link> <description><![CDATA[Informazioni in diretta da <?php echo $_SERVER['SERVER_NAME']; ?> ]]></description> <?php $request = new ask(); $request->multi('SELECT * FROM Articles ORDER BY ID DESC LIMIT 12'); foreach ($request->toShow as $item) { echo "\t\t<item>\n" . "\t\t\t<title><![CDATA[" . $item->title . "]]></title>\n" . "\t\t\t<link>" . "http://" . $_SERVER["SERVER_NAME"] . "?p=" . $item->id . "</link>\n" . "\t\t\t<description><![CDATA[" . $item->body . "]]></description>\n" . "\t\t\t<category><![CDATA[" . $item->category . "]]></category>\n" . "\t\t\t<pubDate>" . $item->date . "</pubDate>\n" . "\t\t</item>\n"; } ?> </channel> </rss> <?php /* End feed_rss.php */
public function tagAction() { //封装header $auth = Zend_Auth::getinstance(); #获取当前用户实例 $UID = $auth->getIdentity(); #取得当前用户信息 if ($auth->hasIdentity() == false) { $this->render('index'); } $tuser = new user(); $user = $tuser->getAllbyUID($UID); $header = array("UID" => $user["UID"], "image" => $user["image"]); //封装tag $ttag = new tag(); $tans = new answer(); $task = new ask(); $tquestion = new question(); $tfollowq = new followQ(); $tagnum = $ttag->gerRequest()->getParam("tagnum"); $tags = $ttag->getAllTags(); for ($i = 0; $i < $tagnum; $i++) { //第i个tag $QIDs = $ttag->getQIDsbyTags($tags[$i]); for ($j = 0; $j < tagnum; $j++) { //第j个question $mUID = $task->getUIDbyQID($QIDs[$j]); $person = $tuser->getAllbyUID($mUID); $image1[$j] = $person['image']; $question = $tquestion->getAllbyQID($QIDs[$j]); $QID1[$j] = $QIDs[$i]; $title1[$j] = $question["title"]; $abstract1[$j] = $question["Qabstract"]; $follownum[$j] = $tfollowq->getFollownumbyQID($QID1[$j]); $answernum[$j] = $tans->getAnswernumbyQID($QID1[$j]); $tag1[$j] = $ttag->getTagbyQID($QID1[$j]); $time1[$j] = $task->getAskTimebyQID($QIDs[$j]); $tag[$i][$j] = array("image" => $image1[$j], "QID" => $QIDs[$j], "title" => $title1[$j], "abstract" => $abstract1[$j], "follownum" => $follownum[$j], "answernum" => $answernum[$j], "tag" => $tag1[$j], "time" => $time1[$j]); } } //传递变量,render $this->view->tag = $tag; $this->view->header = $header; $this->render('tag'); }
<?php /** * 行业资讯后台分类管理文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once '../config/config.inc.php'; require_once "../class/ask.class.php"; require_once '../../admin/checklogin.php'; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $arrMOutput["template_file"] = "admin.html"; $objWebInit->arrGSmarty = $arrGSmarty; $objWebInit->db(); //图形参数 $objWebInit->arrGPic = $arrGPic; //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'])) { check::AlertExit('对不起,您没有权限访问此页', -1); } if (isset($_GET['action'])) { switch ($_GET['action']) { // 显示新增页面 case 'add':
<?php /** * 最新已解决知识问答文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ if (is_object($objWebInit)) { if (!isset($objask)) { include_once dirname(__FILE__) . "/../class/ask.class.php"; include_once dirname(__FILE__) . "/../config/var.inc.php"; $objask = new ask(); $objask->setDBG($arrGPdoDB); if (is_object($objWebInit->db)) { $objask->db = $objWebInit->db; } else { $objask->db(); } } $arrTopask = array(); $arrTopask['datas'] = $objask->getInfoList('where is_answer =1 and pass=1 ', ' ORDER BY submit_date DESC', 0, 10); $arrTopask['COUNT_ROWS'] = $arrTopask['datas']['COUNT_ROWS']; //用来判断是否有数据之用,无特别需要本行可删除 unset($arrTopask['datas']['COUNT_ROWS']); $arrTopask['FileCallPath'] = $arrGPic['FileCallPath']; foreach ($arrTopask['datas'] as $k => $v) { switch ($v['type_id']) {
public function askAction() { session_start(); if (isset($_SESSION['user'])) { $loginuser = $_SESSION['user']; } else { $loginuser = array('UID' => -1); } #名字要根据login的控制器改过来 $UID = $loginuser['UID']; //$UID=2; #if($_GET['P'] != null) #$QPage=$_GET['P']; #从前端获取ask的页码 #else $QPage=1; $QPage = 1; $tag = new tag(); $this->view->url = "\\personal\\ask"; //$this->view->Tag=$tag.getAllTags(); #$MUID=$this->getRequest()->getParam('MUID',''); #从前端的获取被访问者的UID $MUID = $_GET['UID']; $user = new user(); $info = $user->getAllbyUID($MUID); $answer_tmp = new answer(); $likeQ = new likeQ(); $likeA = new likeA(); $followu = new followU(); $follownum = $followu->getFollownumbyUID($MUID); $followednum = $followu->getFollownumbyFUID($MUID); $farr = $followu->getFUIDsbyUID($UID); $isfollow = false; for ($i = 0; $i < count($farr); $i++) { if ($farr[$i] == $MUID) { $isfollow = true; break; } } $this->view->pinfo = array('UID' => $MUID, 'nickname' => $info['nickname'], 'sex' => $info['sex'], 'image' => $info['image'], 'institute' => $info['institute'], 'grade' => $info['grade'], 'answernum' => $answer_tmp->getAnswernumbyUID($MUID), 'likenum' => $this->getLikedNumByUID($MUID), 'likeQnum' => $likeQ->getLikenumbyUID($MUID), 'follownum' => $follownum, 'followednum' => $followednum, 'isfollow' => $isfollow); file_put_contents("E:/out.txt", $info); $question = new question(); $followq = new followQ(); $followu = new followU(); $ask_tmp = new ask(); $answer1 = new answer(); $tag = new tag(); $QIDs = $ask_tmp->getQIDsbyUID($MUID); $Qnum = count($QIDs); $QID_Time_tmp = array(); $ask = array(); $m = 0; #计数用 for ($i = 0; $i < $Qnum; $i++) { $QID_Time_tmp[$QIDs[$i]] = $ask_tmp->getAskTimebyQID($QIDs[$i]); } arsort($QID_Time_tmp); foreach ($QID_Time_tmp as $qid => $time) { $q = $question->getAllbyQID($qid); $ask[$m] = array('QID' => $qid, 'title' => $q['qtitle'], 'abstract' => $q['Qabstract'], 'follownum' => $followq->getFollownumbyQID($qid), 'answernum' => $answer1->getAnswernumbyQID($qid), 'tag' => $tag->getTagbyQID($qid), 'Atime' => $QID_Time_tmp[$qid]); $m++; } if ($Qnum % 10 == 0) { $this->view->QpageNum = $Qnum / 10; } else { $this->view->QpageNum = $Qnum / 10 + 1; } $this->view->ask = array_slice($ask, ($QPage - 1) * 10, 10); //$this->render("ask"); $this->render("homepage-ask"); }
$b = $_REQUEST['b']; //check if db should be used $db_use = 0; if ($a == 'start' || $a == 'results' || $a == 'view_questions') { $db_use = 1; } if ($db_use == 1) { require 'classes/class_db.php'; $db = new database(); $db->connect(); } require 'header.php'; if ($a == 'start' || $a == 'results' || $a == 'view_questions') { //start new questions require 'classes/class_ask.php'; $ask = new ask(); if ($a == 'start') { $ask->start(); } elseif ($a == 'results') { $ask->results(); } elseif ($a == 'view_questions') { $ask->list_questions(); } } elseif ($a == 'terms') { include 'inc/terms.php'; } elseif ($a == 'privacy-policy') { include 'inc/privacy.php'; } elseif ($a == 'contact') { include 'inc/contact.php'; } else { //show homepage
function updateAsk($key, $set) { if ($key == null && $set == null) { return -1; } $table = new ask(); $db = $table->getAdapter(); $where = $db->quoteInto('UID=?', $key['UID']) . ' AND ' . $db->quoteInto('QID=?', $key['QID']); $row = $table->update($set, $where); return $row; }
public function tagAction() { if ($_GET) { $key = $this->getRequest()->getParam('tag', ''); $P = $this->getRequest()->getParam('P', '1'); } $perpage = 10; //question number per page $answer = new answer(); $followQ = new followQ(); $question = new question(); $tag = new tag(); $ask = new ask(); $QID = $tag->getQIDsbyTag($key); $result = array(); for ($i = 0; $i < count($QID); $i++) { $result[$i] = $question->getAllbyQID($QID[$i]); $result[$i]['time'] = $ask->getAskTimebyQID($result[$i]['QID']); $result[$i]['answernum'] = $answer->getAnswernumbyQID($result[$i]['QID']); $result[$i]['follownum'] = $followQ->getFollownumbyQID($result[$i]['QID']); $result[$i]['tag'] = $tag->getTagbyQID($result[$i]['QID']); } $answer = new answer(); $likeA = new likeA(); $user = new user(); for ($i = 0; $i < count($result); $i++) { $maxansid = -1; $maxsum = -1; //the id of most liked answer, the like number of the answer $AID = $answer->getAIDsbyQID($QID[$i]); for ($j = 0; $j < count($AID); $j++) { $likenum = $likeA->getLikenumbyAID($AID[$j]); if ($likenum > $maxsum) { $maxansid = $AID[$j]; $maxsum = $likenum; } } if ($maxansid != -1) { $result[$i]['AAbstract'] = $answer->getAbstractbyAID($maxansid); $tmp = $user->getAllbyUID($answer->getUIDbyAID($maxansid)); $result[$i]['image'] = $tmp['image']; } } $sum = count($result); //divide into several pages $Pnum = floor($sum / $perpage); if ($sum % $perpage > 0) { $Pnum++; } $presult = array(); $length = min($P * $perpage, $sum); for ($i = ($P - 1) * $perpage; $i < $length; $i++) { $presult[$i] = $result[$i]; } $this->view->P = $P; $this->view->Pnum = $Pnum; $this->view->Qresult = $presult; $tmp = $tag->getAllTags(); //warning: bad situation:$tmp[1] is empty,but $tmp[0] && $tmp[2] is exist $i = 0; foreach ($tmp as $a) { $result[$i++] = $a; } $this->view->tag = $result; //HotQlist $mans = new answer(); $mquestion = new question(); $mfollowq = new followQ(); $hquestion = $mans->getMostAnsweredQID(1, 6); for ($i = 0; $i < count($hquestion); $i++) { $qq = $mquestion->getAllbyQID($hquestion[$i]); $HotQlist[$i]["QID"] = $qq["QID"]; $HotQlist[$i]["title"] = $qq["qtitle"]; $HotQlist[$i]["follownum"] = $mfollowq->getFollownumbyQID($qq["QID"]); $HotQlist[$i]["answernum"] = $mans->getAnswernumbyQID($qq["QID"]); } $lefter = array("hotQlist" => $HotQlist); $this->view->lefter = $lefter; $this->view->url = "/search/tag"; $this->render('tagresult'); // }
<?php /** * 行业资讯 列表文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once 'config/config.inc.php'; require_once "class/ask.class.php"; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); $objWebInit->db(); //图像参数 $objWebInit->arrGPic = $arrGPic; //smarty参数 if ($arrGWeb['URL_static']) { $arrGSmarty['caching'] = false; } else { $arrGSmarty['cache_lifetime'] = 3600; } $objWebInit->arrGSmarty = $arrGSmarty; if ($_GET['id'] === null) { exit; } $intID = intval($_GET['id']); $arrInfo = $objWebInit->getInfo($intID);
<?php /** * 行业资讯 列表文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once 'config/config.inc.php'; require_once "class/ask.class.php"; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //翻页参数 $objWebInit->arrGPage = $arrGPage; $objWebInit->db(); if (empty($_GET['page'])) { $intPage = 1; } else { $intPage = intval($_GET['page']); } if (!isset($_GET['status'])) { $is_answer = 0; } else { $is_answer = intval($_GET['status']); }
<?php /* * 行业资讯数据库安装文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * modified 2009-1-3 */ include_once dirname(__FILE__) . '/config/config.inc.php'; include_once dirname(__FILE__) . '/class/ask.class.php'; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; $objWebInit->db(); if (empty($charset)) { $charset = str_replace('-', '', $arrGWeb['charset']); } if (empty($charset)) { $extend = $objWebInit->db->getAttribute(PDO::ATTR_SERVER_VERSION) > '4.1' ? " DEFAULT CHARSET={$charset} " : ""; } $intDbSummaryLen = $arrGWeb['db_summary_len']; //写入频道数组 if (empty($strWEB_ROOT_pre)) { $strWEB_ROOT_pre = $arrGWeb['WEB_ROOT_pre']; } if (empty($strWEBADMIN_ROOT)) { $strWEBADMIN_ROOT = $arrGWeb['WEBADMIN_ROOT'];
</b>, this is the panel to manage qpage database</p> <p><b>Info</b> in a summarize<br /> <b>a) head.php</b>, here you can edit the head of every page;<br /> <b>b) foot.php</b>, foot of every page;<br /> <b>c) style.css</b>, the style sheet of every page but management page.</p> <b>Don't touch php snippet if you don't know it well;</b><br /><br /> <p>For other informations see <a href='docs/'>documentation</a> in 'docs/'.</p> </div> <?php if (isset($_GET['edit'])) { if (!isset($_GET['edit'])) { Error('You must give me an article ID to work.'); } require_once 'lib-php/ask.php'; $request = new ask(); $request->single('SELECT * FROM Articles WHERE ID=\'' . intval($_GET['edit']) . '\' LIMIT 1'); echo "<div class='act' style='display: block'><form action='?act=edit' method='POST'><input type='hidden' name='ID' value='" . $_GET['edit'] . "'><p>Title: <input name='title' value='" . $request->toShow[0]->title . "'></p><p>Category: <input name='category' value='" . $request->toShow[0]->category . "'></p><p><textarea rows=20 name='body'>" . $request->toShow[0]->body . "</textarea></p><input type = 'submit' value = 'Edit'></form></div>"; } ?> <div class='act' id='change_permission'> <form action='?act=change_permission' method='POST'> <p>Username: <input name='username'></p> <p>Permission: <input name='permission'></p> <input type = 'submit' value = 'Send'> </form> </div> <div class='act' id='delete'> <form action='?act=delete' method='POST'> <p>ID's article: <input name='ID'></p> <input type = 'submit' value = 'Delete'>
<?php require 'global.php'; $a = $_REQUEST['a']; $b = $_REQUEST['b']; // exit; if ($a == 'data') { require 'classes/class_db.php'; require 'classes/class_ask.php'; $db = new database(); $db->connect(); $ask = new ask(); if ($b == 'start') { $ask->register_session(); } elseif ($b == 'save_data') { $ask->save_data(); } elseif ($b == 'send_partner_email') { $ask->send_partner_email(); } elseif ($b == 'add_questions') { $ask->add_questions(); } elseif ($b == 'del_questions') { $ask->del_questions(); } elseif ($b == 'contact') { $ask->contact(); } elseif ($b == 'set_done') { $ask->set_done(); } $db->disconnect(); }
<?php /** * 最新未解决知识问答文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ if (is_object($objWebInit)) { if (!isset($objask)) { include_once dirname(__FILE__) . "/../class/ask.class.php"; include_once dirname(__FILE__) . "/../config/var.inc.php"; $objask = new ask(); $objask->setDBG($arrGPdoDB); if (is_object($objWebInit->db)) { $objask->db = $objWebInit->db; } else { $objask->db(); } } $arrTopask = array(); $arrTopask['datas'] = $objask->getInfoList('where is_answer =0 and pass=1 ', ' ORDER BY clicktimes asc', 0, 10); $arrTopask['COUNT_ROWS'] = $arrTopask['datas']['COUNT_ROWS']; //用来判断是否有数据之用,无特别需要本行可删除 unset($arrTopask['datas']['COUNT_ROWS']); $arrTopask['FileCallPath'] = $arrGPic['FileCallPath']; //print_r($arrTopask); // 输出到模板
<?php /** * 行业资讯后台管理栏目修改文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ require_once '../config/config.inc.php'; require_once "../class/ask.class.php"; require_once '../../admin/checklogin.php'; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //图片上传参数 $objWebInit->arrGPic = $arrGPic; $objWebInit->db(); //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'])) { check::AlertExit('对不起,您没有权限访问此页', -1); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['type_id']) || empty($_POST['title']) || empty($_POST['intro'])) { check::AlertExit("错误:有必填选项没填!", -1); } if ($_FILES['Filedata']['name'] != "") {
</div> <div id='right'> <form id="search" method='GET' action='<?php echo SITE_PATH; ?> '> <p><b>Article's name:</b><br /> <input name='find'></p> <input type='submit' value='Search'> </form> <div id="topics"> <h2>Topics</h2><br /> <?php $cat = new ask(); $cat->get_field("SELECT DISTINCT Category FROM Articles"); foreach ($cat->toShow as $string) { if (empty($string)) { continue; } echo "<a href='" . SITE_PATH . "?cat=" . $string . "'>" . $string . "</a><br />"; } echo "<a href='" . SITE_PATH . "?cat='>Without category</a>"; ?> </div> <a href="<?php echo SITE_PATH; ?> ?all">Articles Archive</a>
<?php /** * 行业资讯 列表文件 * * @author Arthur(ArthurXF@gmail.com) * @copyright (c) 2006 by bizeway.com * @version $Id$ * @package ArthurXF * @subpackage ask */ //配置文件调用 require_once 'config/config.inc.php'; require_once "class/ask.class.php"; $objWebInit = new ask(); //数据库连接参数 $objWebInit->setDBG($arrGPdoDB); //smarty参数 $objWebInit->arrGSmarty = $arrGSmarty; //翻页参数 $objWebInit->arrGPage = $arrGPage; $objWebInit->db(); //获取分类信息 if (!is_array($arrMType) || empty($arrMType)) { $arrMType = $objWebInit->getTypeList(); $arrMType = $objWebInit->formatTypeList(0, $arrMType); } //有问必答特有栏目:未解答问题输出 $strWhere = " where pass=1 and is_answer=0"; $strOrder = " ORDER BY topflag DESC,recommendflag DESC,submit_date DESC"; $intStartID = 0;