Ejemplo n.º 1
0
function attach_list()
{
    global $vars, $_attach_messages, $_string;
    if (Auth::check_role('safemode')) {
        Utility::dieMessage($_string['prohibit']);
    }
    $page = isset($vars['page']) ? $vars['page'] : null;
    $refer = isset($vars['refer']) ? $vars['refer'] : $page;
    $type = isset($vars['type']) ? $vars['type'] : null;
    if (!empty($refer)) {
        $wiki = Factory::Wiki($refer);
        $wiki->isReadable();
        $attaches = $wiki->attach();
        if ($type === 'json') {
            $headers = Header::getHeaders('application/json');
            Header::writeResponse($headers, 200, Json::encode($attaches));
            exit;
        }
        // ページ別添付ファイル一覧
        $msg = str_replace('$1', Utility::htmlsc($refer), $_attach_messages['msg_listpage']);
        if (count($attaches) === 0) {
            return array('msg' => $msg, 'body' => 'No files uploaded.');
        }
        $ret[] = '<table class="table table-borderd plugin-attach-list" data-pagenate="true" data-sortable="true"><thead>';
        $ret[] = '<thead>';
        $ret[] = '<tr>';
        $ret[] = '<th>' . $_attach_messages['msg_file'] . '</th>';
        $ret[] = '<th>' . $_attach_messages['msg_filesize'] . '</th>';
        $ret[] = '<th>' . $_attach_messages['msg_type'] . '</th>';
        $ret[] = '<th>' . $_attach_messages['msg_date'] . '</th>';
        $ret[] = '</tr>';
        $ret[] = '</thead>';
        $ret[] = '<tbody>';
        foreach ($attaches as $name => $files) {
            unset($files['log']);
            foreach ($files as $backup => $file) {
                $attach = new Attach($refer, $name, $backup);
                $ret[] = '<tr>';
                if ($backup === 0) {
                    $ret[] = '<td>' . $attach->toString() . '</td>';
                } else {
                    $ret[] = '<td>' . $name . '<em>(Backup no.' . $backup . ')</em></td>';
                }
                $ret[] = '<td>' . $attach->getSize() . '</td>';
                $ret[] = '<td>' . $attach->getMime() . '</td>';
                $ret[] = '<td>' . $attach->getDate() . '</td>';
                $ret[] = '</tr>';
            }
        }
        $ret[] = '</tbody>';
        $ret[] = '</table>';
    } else {
        // 全ページ添付ファイル一覧
        $msg = $_attach_messages['msg_listall'];
        $ret[] = Listing::get('attach', 'attach');
    }
    return array('msg' => $msg, 'body' => join("\n", $ret));
}
Ejemplo n.º 2
0
function page_list($pages = array('pagename.txt' => 'pagename'), $cmd = 'read', $withfilename = FALSE)
{
    return Listing::get();
}
Ejemplo n.º 3
0
function plugin_backup_get_list_all($withfilename = FALSE)
{
    global $_string;
    if (Auth::check_role('safemode')) {
        die_message($_string['prohibit']);
    }
    return Listing::get('backup', 'backup', $withfilename);
}