Ejemplo n.º 1
0
/**
 * 更新最后回复状态
 * 
 * @param $fid
 * @param $tid
 * @param $type
 * @param $mybbs_id
 * @param $MyDatabase
 * @param $atc_title
 */
function lastinfo($fid, $tid, $type = '', $mybbs_id, $MyDatabase, $atc_title)
{
    $nowtime = date('Y-m-d H:i:s', time());
    $title = subString($atc_title, 24);
    //发帖
    if ($type == 'new') {
        $topicadd = ",topic=topic+1,post=post+1";
    } elseif ($type == 'reply') {
        $topicadd = ",post=post+1";
    }
    $new_url = 'read.php?tid=' . $tid;
    $lastpost = $title . "\t" . addslashes($mybbs_id) . "\t" . $nowtime . "\t" . $new_url;
    //更新最后回复时间
    $SqlStr = 'UPDATE `' . DB_TABLE_PRE . 'forums` SET `lastpost`=\'' . $lastpost . '\'' . $topicadd . '   WHERE `fid`=' . $fid;
    $MyDatabase->SqlStr = $SqlStr;
    if ($MyDatabase->ExecuteQuery()) {
    } else {
        echo '文件:' . __FILE__;
        echo '<br />行数:' . __LINE__;
        echo '<br />原因:';
        DebugStr($MyDatabase->SqlStr);
        ErrorMsg('更新首页显示栏目最新发帖失败!');
    }
}
Ejemplo n.º 2
0
 //保存路径
 $attachdir = 'upload/' . $savedir . '/';
 //文件上传路径
 //$fileuplodeurl= $savedir.'/'.$fileuplodeurl;
 //如果文件夹不存在,则建立文件夹
 if (!is_dir($attachdir)) {
     @mkdir($attachdir);
     @chmod($attachdir, 0777);
     @fclose(@fopen($attachdir . '/index.html', 'w'));
     @chmod($attachdir . '/index.html', 0777);
 }
 $source = $attachdir . $fileuplodeurl;
 //版块id_文件名_时间.类型
 //DebugStr($savedir);
 if (!postupload($atc_attachment, $source)) {
     DebugStr('文件上传失败!');
 }
 //判断文件类型
 $type = 'img';
 /**/
 //获取文件大小
 $size = ceil(filesize("{$attachdir}/{$fileuplodeurl}") / 1024);
 $atc_attachment_name = addslashes($atc_attachment_name);
 $ArrField = array('fid', 'uid', 'hits', 'name', 'type', 'size', 'attachurl', 'uploadtime', 'descrip');
 $ArrValue = array($fid, $user->uid, 0, $atc_attachment_name, $type, $size, $attachdir . '/' . $fileuplodeurl, TIMESTAMP, $descrip);
 if ($MyDatabase->Insert('attachs', $ArrField, $ArrValue)) {
     $aid = $MyDatabase->Insert_id();
     $descrip = str_replace('\\', '', $descrip);
     if ($descrip != '') {
         $str_att .= "\n[b]" . str_replace('\\', '', $descrip) . "[/b]";
     }
Ejemplo n.º 3
0
            if ($MyDatabase->ExecuteQuery()) {
            } else {
                DebugStr($MyDatabase->SqlStr . '文件:' . __FILE__ . '<br />行数:' . __LINE__ . '<br />原因:更新首页显示栏目最新发帖失败!');
            }
        }
    } else {
        //更新回帖
        $ArrField = array('icon', 'title', 'ifsign', 'alterinfo', 'content', 'ifcheck');
        $ArrValue = array($atc_iconid, $atc_title, $atc_usesign, $alterinfo, $atc_content . $str_att, $ifcheck);
        if ($MyDatabase->Update('posts', $ArrField, $ArrValue, 'id=' . $id)) {
        } else {
            DebugStr($MyDatabase->SqlStr . '文件:' . __FILE__ . '<br />行数:' . __LINE__ . '<br />原因:回帖修改失败!');
        }
        if ($ifcheck == 0) {
            $SqlStr = 'UPDATE `' . DB_TABLE_PRE . 'forums` SET `post`=`post`-1 WHERE `fid`=' . $fid;
            $MyDatabase->SqlStr = $SqlStr;
            if ($MyDatabase->ExecuteQuery()) {
            } else {
                DebugStr($MyDatabase->SqlStr . '文件:' . __FILE__ . '<br />行数:' . __LINE__ . '<br />原因:');
            }
            $SqlStr = 'UPDATE `' . DB_TABLE_PRE . 'topics` SET `replies`=`replies`-1 WHERE `tid`=' . $tid;
            $MyDatabase->SqlStr = $SqlStr;
            if ($MyDatabase->ExecuteQuery()) {
            } else {
                DebugStr($MyDatabase->SqlStr . '文件:' . __FILE__ . '<br />行数:' . __LINE__ . '<br />原因:');
            }
        }
    }
    $refresh_msg = '帖子修改 [' . $title . '],成功。' . $addmsg . '';
    ErrorMsg($refresh_msg, $refresh_url);
}
Ejemplo n.º 4
0
 /**
  * 表格内容
  * 
  * @params params 参数列表
  *
  */
 private function getContent()
 {
     $MyDatabase = Database::Get();
     $Table = '`' . DB_TABLE_PRE . $this->params['table'] . '`';
     $SqlWhere = @$this->params['where'];
     $SqlOrderBy = @$this->params['order'];
     if ($SqlOrderBy != '') {
         $SqlOrderBy = 'ORDER BY ' . $SqlOrderBy;
     }
     $SqlLimit = ' LIMIT ' . ($this->params['page'] - 1) * $this->params['pagesize'] . ' ,' . $this->params['pagesize'] . ';';
     $SqlStr = ' SELECT COUNT( * ) FROM ' . $Table;
     $SqlStr .= $SqlWhere;
     $MyDatabase->SqlStr = $SqlStr;
     if ($MyDatabase->Query()) {
         $this->recordcount = $MyDatabase->ResultArr[0][0];
     }
     $SqlStr = 'SELECT ' . $this->params['column'] . ' FROM ' . $Table;
     $SqlStr .= $SqlWhere;
     $SqlStr .= $SqlOrderBy;
     $SqlStr .= $SqlLimit;
     $MyDatabase->SqlStr = $SqlStr;
     DebugStr($SqlStr);
     if ($MyDatabase->Query2()) {
         $this->columns = $MyDatabase->ResultArr;
     }
     //分页用
     $this->page = $this->params['page'];
     $this->pagesize = $this->params['pagesize'];
 }
Ejemplo n.º 5
0
    $page = $numofpage;
}
$start_limit = ($page - 1) * PAGE_PER_B;
$limit2 = ' LIMIT ' . $start_limit . ',' . PAGE_PER_B . ';';
//分页
$pages = numofpage($count, $page, $numofpage, "topic.php?fid={$fid}&search={$search}&{$w_add}");
//排序
$orderway .= ' ' . $asc;
//显示帖子,如果需要查询, 则显示查询的帖子
$SqlStr = 'SELECT * FROM `' . DB_TABLE_PRE . 'topics` WHERE ' . $sql . ' ORDER BY ' . $topadd . $orderway . $limit2;
//	DebugStr($str_Sql);
$MyDatabase->SqlStr = $SqlStr;
if ($MyDatabase->Query()) {
    $topicdb = $MyDatabase->ResultArr;
} else {
    DebugStr($MyDatabase->SqlStr);
    echo '文件:' . __FILE__;
    echo '<br />行数:' . __LINE__;
    echo '<br />原因:';
    ErrorMsg('没有帖子!');
}
//当前栏目的帖子
foreach ($topicdb as $topic) {
    //如果上传过附件
    $topic['titleadd'] = '';
    if ($topic['ifupload']) {
        $topic['titleadd'] = " <img src='../../image/ico/file/img.gif' align='absbottom' border=0>";
    }
    //这个不知道如何注释
    $topics[] = $topic;
}
Ejemplo n.º 6
0
    $start_limit++;
    $MyDatabase->SqlStr = $SqlStr;
    if ($MyDatabase->Query()) {
        $DB_Record_Arr = $MyDatabase->ResultArr;
        foreach ($DB_Record_Arr as $read) {
            //			DebugArr($read);
            $readdb[] = viewread($read, $start_limit);
            if ($authorids) {
                $authorids .= ',' . $read['authorid'];
            } else {
                $authorids = $read['authorid'];
            }
            $start_limit++;
        }
    } else {
        DebugStr($SqlStr);
        echo '文件:' . __FILE__;
        echo '<br />行数:' . __LINE__;
        echo '<br />原因:';
        ErrorMsg('读取帖子数据失败!');
    }
}
/**
 * 显示单个帖子
 * 
 * @param $read					数据
 * @param $start_limit		楼层
 * @param $UserGroups		用户组
 */
function viewread($read, $start_limit)
{