Exemplo n.º 1
0
 function course_last_comment($course_id)
 {
     global $db, $tpf;
     $q = $db->query("select c.*,u.username from {$tpf}comments_course c,{$tpf}users u where course_id='{$course_id}' and is_checked=1 and c.userid=u.userid order by cmt_c_id desc limit 5");
     $cmts = array();
     while ($rs = $db->fetch_array($q)) {
         $rs['content'] = filter_word(str_replace("\r\n", "<br>", $rs['content']));
         $rs['in_time'] = custom_time("Y-m-d H:i:s", $rs['in_time']);
         $rs['a_space'] = urr("space", "username=" . rawurlencode($rs['username']));
         $cmts[] = $rs;
     }
     $db->free($q);
     unset($rs);
     return $cmts;
 }
Exemplo n.º 2
0
function show_comment($file_id)
{
    global $db, $tpf, $pg, $start_num, $perpage;
    $q = $db->query("select c.*,u.username from {$tpf}comments c,{$tpf}users u where file_id='{$file_id}' and is_checked=1 and c.userid=u.userid order by cmt_id asc limit {$start_num},{$perpage}");
    $cmts = array();
    while ($rs = $db->fetch_array($q)) {
        $rs['content'] = str_replace("\r\n", "<br>", $rs['content']);
        $rs['in_time'] = custom_time("Y-m-d H:i:s", $rs['in_time']);
        $rs['a_space'] = urr("space", "username=" . rawurlencode($rs['username']));
        $cmts[] = $rs;
    }
    $db->free($q);
    unset($rs);
    return $cmts;
}
Exemplo n.º 3
0
        unset($rs);
        return $file_ids;
    }
    $file_ids = get_file_ids($tag);
    $file_ids = substr($file_ids, -1) == ',' ? substr($file_ids, 0, -1) : $file_ids;
    if (!$file_ids) {
        header("Location: " . urr("tag", ""));
        exit;
    }
    $sql_do = "{$tpf}files where file_id in ({$file_ids})";
    $rs = $db->fetch_one_array("select count(*) as total_num from {$sql_do}");
    $total_num = $rs['total_num'];
    $start_num = ($pg - 1) * $perpage;
    $q = $db->query("select file_id,file_key,file_name,file_extension,file_size,file_time,server_oid,file_store_path,file_real_name,is_image from {$sql_do} order by file_id desc limit {$start_num},{$perpage}");
    $files_array = array();
    while ($rs = $db->fetch_array($q)) {
        $tmp_ext = $rs['file_extension'] ? '.' . $rs['file_extension'] : "";
        $rs['file_thumb'] = get_file_thumb($rs);
        $rs['file_name_all'] = filter_word($rs['file_name'] . $tmp_ext);
        $rs['file_name'] = cutstr(filter_word($rs['file_name'] . $tmp_ext), 35);
        $rs['file_size'] = get_size($rs['file_size']);
        $rs['file_time'] = custom_time("Y-m-d", $rs['file_time']);
        $rs['a_viewfile'] = urr("viewfile", "file_id={$rs['file_id']}");
        $files_array[] = $rs;
    }
    $db->free($q);
    unset($rs);
    $page_nav = multi($total_num, $perpage, $pg, urr("tag", "tag=" . rawurlencode($tag)));
}
require_once template_echo('pd_tag', $user_tpl_dir);
include PHPDISK_ROOT . "./includes/footer.inc.php";