Ejemplo n.º 1
0
 function down($file, $name = null, $attachment = true, $mimeType = null, $headers = [])
 {
     file_exists($file) or die;
     $size = filesize($file);
     $name = $name ?: basename($file);
     header('Cache-Control: public, must-revalidate, max-age=0');
     if (!ie()) {
         header("Cache-Control: no-cache");
         header("Pragma: no-cache");
     }
     foreach ($headers as $k => $v) {
         header($k . ': ' . $v);
     }
     if ($mimeType) {
         header('Content-Type: ' . $mimeType);
     } else {
         header('Content-Type: application/octet-stream');
         header("Content-Transfer-Encoding: binary");
     }
     header('Accept-Ranges: bytes');
     header('Accept-Length: ' . $size);
     if ($attachment) {
         header('Content-Disposition: attachment; filename="' . rawurlencode($name) . '"; filename*=utf-8\'\'' . rawurlencode($name));
     }
     ob_clean();
     flush();
     readfile($file);
 }
Ejemplo n.º 2
0
function int_article($article, $fname, $bid)
{
    global $domain;
    $arr = array();
    $ret = bbs_parse_article($fname, $arr, 0);
    if ($ret < 0) {
        ie("cannot parse article.");
    }
    $response->id = $article["ID"];
    $response->reid = $article["REID"];
    $response->groupid = $article["GROUPID"];
    $response->author->name = $arr["userid"];
    $response->author->nick_name = int_string(htmlspecialchars($arr["username"]));
    $response->title = int_string(htmlspecialchars($article["TITLE"]));
    $response->text = int_string(bbs_printansifile($fname, 1, "http://{$domain}/bbscon.php?bid={$bid}&amp;id={$article["ID"]}", 0, 0));
    $response->publish_time = $article["POSTTIME"];
    $response->publish_author = $article["OWNER"];
    return $response;
}
Ejemplo n.º 3
0
if ($page == 0) {
    $page = $pagecount;
}
$start = ($page - 1) * PAGE_SIZE + 1;
$count = PAGE_SIZE;
if ($page == $pagecount) {
    cache_header("nocache");
} else {
    $origin_if = bbs_get_board_index($bname, $dir_modes["ORIGIN"]);
    if (cache_header("public", @filemtime($origin_if), 10)) {
        exit;
    }
}
$articles = bbs_getarticles($bname, $start, $count, $dir_modes["ORIGIN"]);
if ($articles == FALSE) {
    ie("cannot read index.");
}
$response->pagecount = $pagecount;
$arr = array();
$i = 0;
foreach ($articles as $article) {
    $response->topic[$i]->id = $article["ID"];
    $response->topic[$i]->title = int_string(htmlspecialchars($article["TITLE"]));
    $response->topic[$i]->author = $article["OWNER"];
    $response->topic[$i]->reply = $article["REPLYCOUNT"];
    $response->topic[$i]->last_reply_time = $article["LAST_POSTTIME"];
    $response->topic[$i]->last_reply_author = $article["LAST_OWNER"];
    $filename = bbs_get_board_filename($bname, $article["FILENAME"]);
    $ret = bbs_parse_article($filename, $arr, 1);
    if ($ret == 0) {
        $response->topic[$i]->brief = int_string(htmlspecialchars($arr["brief"]));
Ejemplo n.º 4
0
function print_row($a)
{
    global $r;
    if (array_key_exists("check_key", $a) || array_key_exists("link", $a)) {
        $hover = true;
        if (@$a["checked"] == "1" || @$a["checked"]) {
            $checked = true;
        } else {
            $checked = false;
        }
    } else {
        $hover = false;
    }
    if (array_key_exists("indent_width", $a)) {
        $indent_width = ' style="width: ' . $a["indent_width"] . 'px !important"';
    } else {
        $indent_width = "";
    }
    writeln('	<tr>');
    if ($hover) {
        writeln('		<td class="hover">');
    } else {
        writeln('		<td>');
    }
    if (array_key_exists("text_key", $a)) {
        writeln('			<div class="row_tab">');
        writeln('				<div' . $indent_width . ' class="row_caption">' . $a["caption"] . '</div>');
        writeln('				<div><div class="row_outline"><input id="' . $a["text_key"] . '" name="' . $a["text_key"] . '" type="text" value="' . @$a["text_value"] . '"/></div></div>');
        if (array_key_exists("text_default", $a)) {
            writeln('				<div style="width: 20px"><div class="row_button" style="background-image: url(/images/undo-16.png)" title="Reset" onclick="$(\'#' . $a["text_key"] . '\').val(\'' . addcslashes($a["text_default"], "\\") . '\')"></div></div>');
        }
        if (array_key_exists("text_browse", $a)) {
            writeln('				<div style="width: 20px"><div class="row_button" style="background-image: url(/images/folder.png)" title="Browse" onclick="$( \'#' . $a["text_key"] . '_dialog\' ).dialog( \'open\' );"></div></div>');
        }
        writeln('			</div>');
    } else {
        if (array_key_exists("password_key", $a)) {
            writeln('			<div class="row_tab">');
            writeln('				<div' . $indent_width . ' class="row_caption">' . $a["caption"] . '</div>');
            writeln('				<div><div class="row_outline"><input id="' . $a["password_key"] . '" name="' . $a["password_key"] . '" type="password" value="' . @$a["password_value"] . '"/></div></div>');
            writeln('			</div>');
        } else {
            if (array_key_exists("textarea_key", $a)) {
                if (array_key_exists("textarea_height", $a)) {
                    $height = $a["textarea_height"];
                } else {
                    $height = 100;
                }
                writeln('			<div class="row_tab">');
                writeln('				<div' . $indent_width . ' class="row_caption">' . $a["caption"] . '</div>');
                writeln('				<textarea name="' . $a["textarea_key"] . '" style="height: ' . $height . 'px">' . @$a["textarea_value"] . '</textarea>');
                writeln('			</div>');
            } else {
                if (array_key_exists("option_key", $a)) {
                    if (array_key_exists("option_change", $a)) {
                        $event = ' onchange="' . $a["option_change"] . '"';
                    } else {
                        $event = '';
                    }
                    writeln('			<div class="row_tab">');
                    writeln('				<div class="row_caption">' . $a["caption"] . '</div>');
                    writeln('				<select name="' . $a["option_key"] . '"' . $event . '>');
                    for ($i = 0; $i < count($a["option_list"]); $i++) {
                        if (array_key_exists("option_keys", $a)) {
                            if ($a["option_keys"][$i] == @$a["option_value"]) {
                                writeln('					<option selected="selected" value="' . $a["option_keys"][$i] . '">' . $a["option_list"][$i] . '</option>');
                            } else {
                                writeln('					<option value="' . $a["option_keys"][$i] . '">' . $a["option_list"][$i] . '</option>');
                            }
                        } else {
                            if ($a["option_list"][$i] == @$a["option_value"]) {
                                writeln('					<option selected="selected">' . $a["option_list"][$i] . '</option>');
                            } else {
                                writeln('					<option>' . $a["option_list"][$i] . '</option>');
                            }
                        }
                    }
                    writeln('				</select>');
                    writeln('			</div>');
                } else {
                    if (array_key_exists("link", $a)) {
                        if (array_key_exists("description", $a)) {
                            writeln('			<a href="' . $a["link"] . '">');
                            writeln('			<dl style="background-image: url(/images/' . $a["icon"] . '-32.png)">');
                            writeln('				<dt>' . $a["caption"] . '</dt>');
                            writeln('				<dd>' . $a["description"] . '</dd>');
                            writeln('			</dl>');
                            writeln('			</a>');
                        } else {
                            writeln('			<a href="' . $a["link"] . '"><div class="icon_16" style="background-image: url(/images/' . $a["icon"] . '-16.png); color: #000000">' . $a["caption"] . '</div></a>');
                        }
                    } else {
                        if (array_key_exists("icon_32", $a)) {
                            if (array_key_exists("description", $a)) {
                                writeln('			<dl style="background-image: url(/images/' . $a["icon_32"] . '-32.png)">');
                                writeln('				<dt>' . $a["caption"] . '</dt>');
                                writeln('				<dd>' . $a["description"] . '</dd>');
                                writeln('			</dl>');
                            } else {
                                writeln('			<div class="icon_32" style="background-image: url(/images/' . $a["icon_32"] . '-32.png)"><h1>' . $a["caption"] . '</h1></div>');
                            }
                        } else {
                            if (array_key_exists("check_key", $a)) {
                                if (array_key_exists("check_show", $a) || array_key_exists("check_hide", $a)) {
                                    //$on_click = ' onchange="alert(this.checked)" onclick="this.focus(); document.getElementById(\'location\').focus()"';
                                    $show_id = @$a["check_show"];
                                    $hide_id = @$a["check_hide"];
                                    if (ie()) {
                                        $event = ' onclick="check_click(this, \'' . $show_id . '\', \'' . $hide_id . '\')"';
                                    } else {
                                        $event = ' onchange="check_change(this, \'' . $show_id . '\', \'' . $hide_id . '\')"';
                                    }
                                } else {
                                    $event = '';
                                }
                                if (array_key_exists("check_value", $a)) {
                                    $check_value = ' value="' . $a["check_value"] . '"';
                                } else {
                                    $check_value = '';
                                }
                                writeln('			<input name="' . $a["check_key"] . '" class="row_check" type="checkbox"' . $check_value . ($checked ? ' checked="true"' : '') . $event . '/>');
                            }
                            if (array_key_exists("icon", $a)) {
                                writeln('			<img src="/images/' . $a["icon"] . '.png" style="vertical-align: middle; margin-right: 8px"/>');
                            }
                            if (array_key_exists("caption", $a)) {
                                writeln('			' . $a["caption"]);
                            }
                        }
                    }
                }
            }
        }
    }
    writeln('		</td>');
    writeln('	</tr>');
}
Ejemplo n.º 5
0
    $page = $_GET["page"];
} else {
    $page = 1;
}
$bname = bbs_getbname($bid);
if ($bname == "") {
    ie("board not found.");
}
if (!bbs_checkreadperm($uid, $bid)) {
    ie("permission denied.");
}
$haveprev = 0;
$articles = array();
$ret = bbs_get_threads_from_gid($bid, $id, 1, $articles, $haveprev);
if ($ret == 0) {
    ie("cannot read threads.");
}
$pagecount = ceil($ret / THREAD_PAGE_SIZE);
if ($page < 1) {
    $page = 1;
}
if ($page > $pagecount) {
    $page = $pagecount;
}
if ($page == $pagecount) {
    cache_header("nocache");
} else {
    $all_if = bbs_get_board_index($bname, $dir_modes["NORMAL"]);
    if (cache_header("public", @filemtime($all_if), 300)) {
        exit;
    }
Ejemplo n.º 6
0
<?php

if (!defined('_ROOT')) {
    exit('Access Denied');
}
$oClass = new ClassModel();
$breadcrumb = new breadcrumb();
extract($_GET);
$request = $_GET;
$request['type'] = intval($request['type']);
$request['query_string'] = '?' . $_SERVER['QUERY_STRING'];
$request['http_referer'] = $_SERVER['HTTP_REFERER'];
$table_row = ie() ? 'block' : 'table-row';
$cfg_type = array();
$result = $oConfigure->getMod(" `module`='" . $system->module . "' AND typeid='" . intval($request['id']) . "'");
$tmp = $result->fetch();
$request['module_description'] = nl2br($tmp['content']);
if ($tmp['data']) {
    $cfg_type = unserialize($tmp['data']);
}
$show_actions = $cfg_type['act'] ? $cfg_type['act'] : array();
if (!$cfg_type['act']) {
    $cfg_type['act'] = array();
}
$show_fields = array();
if (in_array('image', $cfg_type['act']) && $cfg_type['main_icon']['chose']) {
    $show_fields[] = 'icon';
}
if (in_array('image', $cfg_type['act']) && $cfg_type['main_img']['chose']) {
    $show_fields[] = 'image';
}
Ejemplo n.º 7
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . '/templates/header.php';
?>
<div id="feed">
	<?php 
if (ie() && $_COOKIE['ignoreIeWarning'] != "true") {
    header("Refresh: 0; url=\"./ie.php\"");
}
if (!isset($page)) {
    $page = 1;
}
$link = getDbConnection();
$total = $link->query("SELECT * FROM posts WHERE visible = '1'")->num_rows;
if ($total > 0) {
    if (!isset($perpage)) {
        $perpage = $total;
    }
    $pages = $total / $perpage;
    $start = ($page - 1) * $perpage;
    $query = $link->query("SELECT * FROM posts WHERE visible = '1' ORDER BY time DESC LIMIT " . $start . ", " . $perpage);
    $numrows = $query->num_rows;
    if ($numrows > 0) {
        $i = 0;
        while ($post = $query->fetch_array()) {
            $i += 1;
            $id = $post['id'];
            $title = $post['title'];
            $content = $post['content'];
            $parser = new Parsedown();
            $content = $parser->text(syntaxPreprocessor($content));
Ejemplo n.º 8
0
Archivo: post.php Proyecto: bianle/www2
    ie("board is readonly.");
}
if (!bbs_checkpostperm($uid, $bid)) {
    ie("post is denied.");
}
$title = rtrim($request->title);
if ($title == "") {
    ie("empty title.");
}
if ($request->content == "") {
    ie("empty content.");
}
$articles = array();
if ($request->reid > 0) {
    $ret = bbs_get_records_from_id($bname, $request->reid, $dir_modes["NORMAL"], $articles);
    if ($ret == 0) {
        ie("no such article.");
    }
    if ($articles[1]["FLAGS"][2] == "y") {
        ie("reply is denied.");
    }
}
$ret = bbs_postarticle($bname, $title, $content, 0, $request->reid, 0, 0, 0, 0);
if ($ret < 0) {
    ie("error code: {$ret}.");
}
$response->id = $ret;
int_finish($response);
?>