Skip to content

Commit

Permalink
update from server at Thu, Sep 20, 2012 11:50:49 AM
Browse files Browse the repository at this point in the history
  • Loading branch information
U-Home\William authored and U-Home\William committed Sep 20, 2012
1 parent 0107b28 commit bc4dfd6
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 54 deletions.
6 changes: 3 additions & 3 deletions d.php
Expand Up @@ -110,20 +110,20 @@
$row = $obj->get_content($_GET['cid']);
$info['row'] = $row;
$info['cid'] = $row['cid'];
$info['title'] = $row['linkname'];
$info['title'] = $row['title'];
$info['content'] = '<div class="display_content">'.$row['content'].'</div>';
$info['cate_id'] = $row['cate_id'];
$info['iid'] = $row['iid'];

$prev = $obj->get_content_previous($_GET['cid']);
$info['previous'] = array(
'cid' => $prev['cid'],
'linkname' => $prev['linkname'],
'title' => $prev['title'],
);
$next = $obj->get_content_next($_GET['cid']);
$info['next'] = array(
'cid' => $next['cid'],
'linkname' => $next['linkname'],
'title' => $next['title'],
);
$ary = $obj->get_rand_keywords();
$info['keywords'] = array_slice($ary, rand(0,3));
Expand Down
18 changes: 9 additions & 9 deletions dixiClass.php
Expand Up @@ -48,7 +48,7 @@ function get_tab_list_1()

$t = $t1 . " and cs.frequency=$frequency and ct.cate_id=cs.cid and ct.category=cs.name
order by rand() limit 0, " . TAB_LIST;
$sql = "select ct.cid, ct.linkname, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu, ct.cate_id from contents ct, categories cs where language='".$this->lang."' ". $t;
$sql = "select ct.cid, ct.title, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu, ct.cate_id from contents ct, categories cs where language='".$this->lang."' ". $t;
$res = $this->mdb2->queryAll($sql);
if (PEAR::isError($res)) die($res->getMessage());
return $res;
Expand All @@ -59,7 +59,7 @@ function get_tab_list($desc=false, $start=0, $limit=TAB_LIST) {
// william add temporily:
$order = 'order by rand() ';
$limit = 'limit ' . $start . ', ' . $limit;
$sql = "select cid, linkname, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where active='Y' and language='".$this->lang."' ". $order . $limit;
$sql = "select cid, title, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where active='Y' and language='".$this->lang."' ". $order . $limit;
$res = $this->mdb2->queryAll($sql);
if (PEAR::isError($res)) die($res->getMessage());
return $res;
Expand All @@ -80,7 +80,7 @@ function get_loop2() {

// contents 表.
function get_definition() {
$sql = "select content from contents where linkname = '负面新闻' ";
$sql = "select content from contents where title = '负面新闻' ";
$res = $this->mdb2->queryOne($sql);
if (PEAR::isError($res)) {
die($res->getMessage(). ' - line ' . __LINE__ . ': ' . $sql);
Expand All @@ -91,13 +91,13 @@ function get_definition() {
//Same and no use
function get_contents() {
$ary = array();
$sql = "select cid, linkname from contents where active='Y' and language='".$this->lang."' order by cid desc";
$sql = "select cid, title from contents where active='Y' and language='".$this->lang."' order by cid desc";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage(). ' - line ' . __LINE__ . ': ' . $sql);
}
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
array_push($ary, array($row['cid'], $row['linkname']));
array_push($ary, array($row['cid'], $row['title']));
}
return $ary;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ function get_carousel1()
}

$t = isset($_SESSION[PACKAGE]['language']) ? $_SESSION[PACKAGE]['language'] : '';
$sql = "select linkname, cid from contents where language='". $t ."' order by rand() limit 0,13";
$sql = "select title, cid from contents where language='". $t ."' order by rand() limit 0,13";
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) {
array_push($ary2, $row);
Expand All @@ -148,7 +148,7 @@ function get_carousel1()
$html .=
'<div class="item">' . '<a href="./general.php?cid=' . $ary2[$i]['cid'] . '">' . $ary1[$i] . '</a>' .
' <div class="carousel-caption">' .
' <h4>' . $ary2[$i]['linkname'] . '</h4>' .
' <h4>' . $ary2[$i]['title'] . '</h4>' .
' </div>' .
"</div>\n";
}
Expand All @@ -168,10 +168,10 @@ function get_carousel2() {
//2. 内容
$ary2 = array();
$t = isset($_SESSION[PACKAGE]['language']) ? $_SESSION[PACKAGE]['language'] : '';
$sql = "select linkname, cid from contents where language='". $t ."' order by rand() limit 0,13";
$sql = "select title, cid from contents where language='". $t ."' order by rand() limit 0,13";
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) {
$t = array('h4'=>$row['linkname'], 'a'=>'./general.php?cid='.$row['cid']);
$t = array('h4'=>$row['title'], 'a'=>'./general.php?cid='.$row['cid']);
array_push($ary2, $t);
}

Expand Down
42 changes: 20 additions & 22 deletions generalClass.php
Expand Up @@ -131,7 +131,7 @@ function get_category_count() {
//////////////// Contents ////////////////
//上下文应该是同一个category或item下的所有内�?而不是所有的,连续的cid.
function get_content($cid) {
#$sql = "select content, linkname, cid, category, cate_id, item, iid from contents where cid=".$cid;
#$sql = "select cid, content, title, category, cate_id, item, iid from contents where cid=".$cid;
$sql = "select * from contents where cid=".$cid;
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
Expand All @@ -141,20 +141,20 @@ function get_content($cid) {
$b = array();
$b[] = array('name'=>$row['category'], 'link'=>$this->general.'?cmenu='.$row['cate_id']);
$b[] = array('name'=>$row['item'], 'link'=>$this->general.'?iid='.$row['iid']);
$b[] = array('name'=>$row['linkname'], 'active'=>1);
$b[] = array('name'=>$row['title'], 'active'=>1);
$this->set_breadcrumb($b);
$this->update_total($cid);
return $row;
}
function get_content_previous($cid) {
$sql = "select linkname, cid from contents where cid < " . $cid . " order by cid desc limit 1";
$sql = "select cid, title from contents where cid < " . $cid . " order by cid desc limit 1";
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
mysql_free_result($res);
return $row;
}
function get_content_next($cid) {
$sql = "select linkname, cid from contents where cid >".$cid. " order by cid limit 1";
$sql = "select cid, title from contents where cid >".$cid. " order by cid limit 1";
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
mysql_free_result($res);
Expand All @@ -164,7 +164,7 @@ function get_content_next($cid) {
// 输出内容,并构建面包�?
function get_content_1($cid)
{
#$sql = "select content, linkname, cid, category, cate_id, item, iid from contents where cid=".$cid;
#$sql = "select content, title, cid, category, cate_id, item, iid from contents where cid=".$cid;
$sql = "select * from contents where cid=".$cid;
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
Expand All @@ -174,7 +174,7 @@ function get_content_1($cid)
$b = array();
$b[] = array('name'=>$row['category'], 'link'=>$this->general.'?cmenu='.$row['cate_id']);
$b[] = array('name'=>$row['item'], 'link'=>$this->general.'?iid='.$row['iid']);
$b[] = array('name'=>$row['linkname'], 'active'=>1);
$b[] = array('name'=>$row['title'], 'active'=>1);
$this->set_breadcrumb($b);
$this->update_total($cid);
return $row;
Expand All @@ -183,19 +183,19 @@ function get_content_1($cid)
// and language=''
function get_contents_list($iid) {
$ary = array();
$sql = "select linkname, cid, category, cate_id, item, iid from contents where iid=".$iid . " order by cid desc";
$sql = "select title, cid, category, cate_id, item, iid from contents where iid=".$iid . " order by cid desc";
$res = mysql_query($sql);

list($cate_id, $category, $item) = array(0, '', '');
$t = '<ul class="nav nav-pills nav-stacked">';
// $t .= '<li><a href="'.$config['general'].'?cid='.$row['cid'].'">'.$row['linkname']."</a></li>\n";
// $t .= '<li><a href="'.$config['general'].'?cid='.$row['cid'].'">'.$row['title']."</a></li>\n";
while($row = mysql_fetch_assoc($res)) {
if(!$cate_id && !$category && !$item) {
$cate_id = $row['cate_id'];
$category = $row['category'];
$item = $row['item'];
}
$t .= '<li><a href="'.$this->general.'?cid='.$row['cid'].'">'.$row['linkname']."</a></li>\n";
$t .= '<li><a href="'.$this->general.'?cid='.$row['cid'].'">'.$row['title']."</a></li>\n";
}
$t .= '</ul>';
mysql_free_result($res);
Expand Down Expand Up @@ -292,17 +292,15 @@ function select_contents_by_keyword($key)

//生成新的查询语句�?
$lang_case = " and language = '" . $this->lang . "' ";
/*
$sql = "select linkname, cid, date(created) as date from contents
where content like '%".$key ."%' "
. " or linkname like '%".$key ."%' "
.$lang_case." order by cid desc";
*/
$sql = "select cid, linkname, date(created) as date from contents
where match(linkname, content) against ('$key')
content like '%".$key ."%' "
. " or linkname like '%".$key ."%' "
.$lang_case." order by cid desc";
/* select cid, title, date(created) as date, match(title, content) against('不理性行为' in boolean mode) as score
* from contents where match(title, content) against ('不理性行为' in boolean mode)
* and language = '中文' order by score desc limit 0,25
*/
$sql = "select cid, title, date(created) as date,
MATCH(title, content) AGAINST('$key') as score
from contents
where MATCH(title, content) AGAINST('$key') "
.$lang_case." order by score desc";

$_SESSION[PACKAGE][SEARCH]['sql'] = $sql;
$sql .= " limit " . $row_no . "," . ROWS_PER_PAGE;
Expand Down Expand Up @@ -466,7 +464,7 @@ function assemble_sitemap($sm)

function get_relative_articles($cid,$iid,$cate_id) {
$ary = array();
$sql = "select cid, linkname, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where cid!=$cid and iid=$iid order by pubdate desc limit 0,6";
$sql = "select cid, title, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where cid!=$cid and iid=$iid order by pubdate desc limit 0,6";
$res = mysql_query($sql);
while($row = mysql_fetch_array($res)) {
array_push($ary, $row);
Expand All @@ -477,7 +475,7 @@ function get_relative_articles($cid,$iid,$cate_id) {

function get_relative_references($cid,$iid,$cate_id)
{
$sql = "select cid, linkname, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where cid!=$cid and iid=$iid order by rand() limit 0,6";
$sql = "select cid, title, (FLOOR( 1 + RAND( ) *1000 )) AS guanzhu from contents where cid!=$cid and iid=$iid order by rand() limit 0,6";
$res = mysql_query($sql);
$html = "<ul>\n";
while($row = mysql_fetch_array($res)) {
Expand Down
32 changes: 16 additions & 16 deletions help/index1.php
Expand Up @@ -83,31 +83,31 @@ function get_header_submenu($mid)
{
$ary = array();
if (! isset($mid)) $mid = $this->default_mid;
$sql = "SELECT cid, linkname, author FROM contents WHERE mid=" . $mid . "
$sql = "SELECT cid, title, author FROM contents WHERE mid=" . $mid . "
AND site_id=".$this->sid . "
AND weight NOT IN (". implode(',', $this->ignore_ary) .") ORDER BY cid DESC";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage().' - line '.__LINE__.': '.$sql);
}
while($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))
$ary[$row['cid']] = $row['linkname'];
$ary[$row['cid']] = $row['title'];
return $ary;
}

function get_footer_submenu($mid)
{
$ary = array();
if (! isset($mid)) $mid = $this->default_mid;
$sql = "SELECT cid, linkname, author FROM contents WHERE mid=" . $mid . "
$sql = "SELECT cid, title, author FROM contents WHERE mid=" . $mid . "
AND site_id=".$this->sid . "
AND weight NOT IN (". implode(',', $this->ignore_ary) .") ORDER BY cid ";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage().' - line '.__LINE__.': '.$sql);
}
while($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))
$ary[$row['cid']] = $row['linkname'];
$ary[$row['cid']] = $row['title'];
return $ary;
}

Expand Down Expand Up @@ -152,7 +152,7 @@ function get_logo()
function get_banner($mid='') {
$ary = array();
if (!$mid) $mid = $this->default_mid;
$sql = "SELECT cid, linkname, author, content FROM `contents` WHERE mid=".$mid."
$sql = "SELECT cid, title, author, content FROM `contents` WHERE mid=".$mid."
AND site_id=".$this->sid . "
AND active='Y' AND weight=".BANNER;

Expand All @@ -170,12 +170,12 @@ function get_banner($mid='') {
/**
* contents.weight = 254
* if (!$mid) $mid = $this->default_mid;
* $sql = "SELECT cid, linkname, author, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight=".INTRO;
* $sql = "SELECT cid, title, author, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight=".INTRO;
*/
function get_intro($mid='')
{
$ary = array();
$sql = "SELECT cid, linkname, author, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight=".INTRO;
$sql = "SELECT cid, title, author, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight=".INTRO;

$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
Expand All @@ -191,7 +191,7 @@ function get_latest_10($mid='')
{
$ary = array();
$url = $this->url . '?js_latest_content=1&cid=';
$sql = "SELECT cid, linkname, author, updated, mname
$sql = "SELECT cid, title, author, updated, mname
FROM `contents` WHERE site_id=".$this->sid . " ORDER BY updated DESC, cid DESC LIMIT 0, 10 ";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
Expand All @@ -200,7 +200,7 @@ function get_latest_10($mid='')
array_push($ary, "<h3>最近10条信息</h3>");
array_push($ary, "<ul>");
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$t1 = $row['linkname'] . ' - ' . $row['author'] . ' ('. $row['updated'] . ') 〖 ' . $row['mname'] . ' 〗';
$t1 = $row['title'] . ' - ' . $row['author'] . ' ('. $row['updated'] . ') 〖 ' . $row['mname'] . ' 〗';
$t = '<li><a rel="group_new" href="'.$url.$row['cid'].'">'.$t1.'</a></li>';
array_push($ary, $t);
}
Expand All @@ -219,36 +219,36 @@ function get_latest_content($cid) {

function get_content($cid) {
$pattern = array("/\<p>\&nbsp;\<\/p>/", "/\<p>\s*\<\/p>/", "/<p>\&nbsp;<\/p>/");
$sql = "SELECT linkname, author, date(updated) as created, content FROM contents WHERE active='Y' AND cid = " . $cid;
$sql = "SELECT title, author, date(updated) as created, content FROM contents WHERE active='Y' AND cid = " . $cid;
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage().' - line '.__LINE__.', '.$sql);
}
while($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$t1 = preg_replace($pattern, '', $row['content']);
$t2 = '<h4>'.$row['linkname'].' - 〖 ' . $row['author'] . ' 于 ' . $row['created']. '〗</h4>'."\n";
$t2 = '<h4>'.$row['title'].' - 〖 ' . $row['author'] . ' 于 ' . $row['created']. '〗</h4>'."\n";
$t2 .= $t1;
}
return $t2;
}
//$sql = "SELECT cid, linkname, author, content FROM `contents` WHERE mid=".$mid." AND weight IN (". implode(',', $this->ignore_ary) .") ORDER BY cid";
//$sql = "SELECT cid, title, author, content FROM `contents` WHERE mid=".$mid." AND weight IN (". implode(',', $this->ignore_ary) .") ORDER BY cid";
function get_default_content_by_mid($mid='') {
$pattern = array("/\<p>\&nbsp;\<\/p>/", "/\<p>\s*\<\/p>/", "/<p>\&nbsp;<\/p>/");
$ary = array();
if (!$mid) $mid = $this->default_mid;

$sql = "SELECT cid, linkname, author, date(updated) as created, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight = ". DEFAULT_CONTENT . " ORDER BY updated DESC, cid DESC";
$sql = "SELECT cid, title, author, date(updated) as created, content FROM `contents` WHERE mid=".$mid." AND active='Y' AND weight = ". DEFAULT_CONTENT . " ORDER BY updated DESC, cid DESC";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage(). ' - line ' . __LINE__ . ': ' . $sql);
}
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$t = '<h4>'.$row['linkname'].' - 〖 ' . $row['author'] . ' 于 ' . $row['created']. ' 〗</h4>'."\n";
$t = '<h4>'.$row['title'].' - 〖 ' . $row['author'] . ' 于 ' . $row['created']. ' 〗</h4>'."\n";
$t .= preg_replace($pattern, '', $row['content'])."\n";
array_push($ary, $t);
}
if(empty($ary)) {
$sql = "SELECT cid, linkname, author, date(updated) as created, content FROM `contents` WHERE active='Y' AND mid=".$mid." AND weight<200 ORDER BY updated DESC, cid DESC ";
$sql = "SELECT cid, title, author, date(updated) as created, content FROM `contents` WHERE active='Y' AND mid=".$mid." AND weight<200 ORDER BY updated DESC, cid DESC ";
$row = $this->mdb2->queryRow($sql);
$t = '<h4>'.$row[1].' - 〖 ' . $row[2] . ' 于 ' . $row[3]. ' 〗</h4>'."\n";
$t .= preg_replace($pattern, '', $row[4]);
Expand All @@ -260,7 +260,7 @@ function get_default_content_by_mid($mid='') {
function get_left($mid=NULL) {
$ary = array();
if (! isset($mid)) $mid = $this->default_mid;
$sql = "SELECT cid, linkname, author, date(updated) as created FROM contents WHERE mid=".$mid." AND active='Y' AND weight NOT IN (".implode(",",$this->ignore_ary).") ORDER BY updated DESC, cid DESC limit 0,20";
$sql = "SELECT cid, title, author, date(updated) as created FROM contents WHERE mid=".$mid." AND active='Y' AND weight NOT IN (".implode(",",$this->ignore_ary).") ORDER BY updated DESC, cid DESC limit 0,20";
$res = $this->mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage().' - line '.__LINE__.': '.$sql);
Expand Down
2 changes: 1 addition & 1 deletion templates/general/2/search.tpl.html
Expand Up @@ -9,7 +9,7 @@
<div class="pages">{include file="{$path2}pagination.tpl.html"}</div>
<ul class="nav nav-pills nav-stacked">
{foreach $results as $rts}
<li class="li3"><span class="badge badge-warning">{$no++}</span> <a href="{$url}?cid={$rts.cid}&js_get_content=1">{$rts.linkname} ({$rts.date})</a></li>
<li class="li3"><span class="badge badge-warning">{$no++}</span> <a href="{$url}?cid={$rts.cid}&js_get_content=1">{$rts.title} ({$rts.date})</a></li>
{/foreach}
</ul>
<div class="pages">{include file="{$path2}pagination.tpl.html"}</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/general/2/single.tpl.html
Expand Up @@ -3,7 +3,7 @@
<div class="box5">
<table width="100%" border="0" cellpadding="2px" cellspacing="2px">
<tr>
<th><h3><a href="?cid={$row.cid}">{$row.linkname}</a></h3></th>
<th><h3><a href="?cid={$row.cid}">{$row.title}</a></h3></th>
</tr>
<tr>
<td><span>
Expand Down
4 changes: 2 additions & 2 deletions templates/general/3/lianjie.tpl.html
Expand Up @@ -2,8 +2,8 @@
<div class="row" style="margin-bottom:0px;">
<div class="span9">
<ul class="pager">
<li class="previous"> <a href=""><i class="icon-arrow-left"></i> {$info.previous.linkname}</a> </li>
<li class="next"> <a href="">{$info.next.linkname} <i class="icon-arrow-right"></i></a></li>
<li class="previous"> <a href=""><i class="icon-arrow-left"></i> {$info.previous.title}</a> </li>
<li class="next"> <a href="">{$info.next.title} <i class="icon-arrow-right"></i></a></li>
</ul>
</div>
<div tyle="width:100%">
Expand Down

0 comments on commit bc4dfd6

Please sign in to comment.