Ejemplo n.º 1
0
                    dheader('Content-Disposition: attachment; filename=' . $filename . '.xml');
                    dheader('Content-Type: text/xml');
                }
                echo $str;
                exit;
            } else {
                showmessage('diy_export_no_data', '/');
            }
        } else {
            showmessage('diy_export_tpl_invalid', '/');
        }
    }
    showmessage('diy_operation_invalid', '/');
} elseif ($op == 'import') {
    $tpl = $_POST['tpl'] ? $_POST['tpl'] : $_GET['tpl'];
    tpl_checkperm($tpl);
    if (submitcheck('importsubmit')) {
        $isinner = false;
        $filename = '';
        if ($_POST['importfilename']) {
            $filename = DISCUZ_ROOT . './template/default/portal/diyxml/' . $_POST['importfilename'] . '.xml';
            $isinner = true;
        } else {
            $upload = new discuz_upload();
            $upload->init($_FILES['importfile'], 'temp');
            $attach = $upload->attach;
            if (!$upload->error()) {
                $upload->save();
            }
            if ($upload->error()) {
                showmessage($upload->error(), 'portal.php', array('status' => $upload->error()));
Ejemplo n.º 2
0
                    topic_upload_error($attach, 'diy_remote_upload_failed');
                }
            }
        }
        $setarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'filename' => $attach['name'], 'filepath' => $attach['attachment'], 'size' => $attach['size'], 'thumb' => $attach['thumb'], 'remote' => $attach['remote'], 'dateline' => $_G['timestamp'], 'topicid' => $topicid);
        $setarr['picid'] = DB::insert("portal_topic_pic", $setarr, true);
        topic_upload_show($topicid);
    }
}
if (submitcheck('diysubmit')) {
    require_once libfile('function/portalcp');
    $template = getstr($_POST['template'], 50);
    $savemod = getstr($_POST['savemod'], 1);
    $recover = getstr($_POST['recover'], 1);
    $optype = getstr($_POST['optype'], 10);
    tpl_checkperm($template);
    list($template, $clonefile) = explode(':', $template);
    list($mod, $file) = explode('/', $template);
    $targettplname = $template;
    if ($savemod == '1' && !empty($clonefile)) {
        $targettplname = $template . '_' . $clonefile;
    }
    if ($optype == 'canceldiy') {
        @unlink(DISCUZ_ROOT . './data/diy/' . $targettplname . '_diy_preview.htm');
        if ($targettplname == $template) {
            @unlink(DISCUZ_ROOT . './data/diy/' . $targettplname . '_' . $clonefile . '_diy_preview.htm');
        }
        showmessage('do_success');
    }
    $istopic = false;
    if ($template == 'portal/portal_topic_content') {