コード例 #1
0
ファイル: news.php プロジェクト: shifter/ospap2
        $objNewsTemplate->setText('DATE', date('Y-m-d', strtotime($objNews->get('date'))));
        $objNewsTemplate->setText('TITLE', $objNews->get('title'));
        $objNewsTemplate->setText('TEXT', bbcode_format($objNews->get('text')));
        echo $objNewsTemplate->get();
    }
} else {
    if (!$objUser || $objUser->get('is_admin') != 1) {
        throw new Exception("exception_accessdenied");
    }
    $objNews = new clsDB('news');
    $objNews->getFromRequest(array('id', 'title', 'text'));
    if ($strSubAction == 'edit') {
        $objNews->load();
        echo "<form action='index.php' method='post'>";
        echo "<input type='hidden' name='subaction' value='save'>";
        echo $objNews->getHiddenField('id');
        echo "Title:<br>";
        echo $objNews->getTextField('title', new clsParameters('size', 40)) . "<br><br>";
        echo "Post:<br>";
        echo $objNews->getTextArea('text', 4, 45) . "<br><br>";
        echo $objNews->getSubmit('Post');
    } else {
        if ($strSubAction == 'save') {
            if ($objNews->isNew()) {
                $objNews->set('user_id', $objUser->get('id'));
                $objNews->set('date', date('Y-m-d H:i:s'));
            }
            $objNews->save();
            header("Location: index.php");
        } else {
            if ($strSubAction == 'delete') {
コード例 #2
0
ファイル: admin.php プロジェクト: shifter/ospap2
        }
    }
}
if ($strSubAction == 'settings_save') {
    $objSetting = new clsDB('setting');
    $objSetting->getFromRequest(array('id', 'value'));
    $objSetting->save();
    $strSubAction = 'settings';
}
if ($strSubAction == 'settings') {
    $arrSettings = clsDB::getListStatic('setting');
    print "<table>";
    print "<tr>";
    print "<td>Name</td><td>Value</td><td>Comments</td><td>Save</td>";
    print "</tr>";
    foreach ($arrSettings as $objSetting) {
        print "<form action='index.php' method='get'>";
        print $objSetting->getHiddenField('id');
        print "<input type='hidden' name='action'    value='admin'>";
        print "<input type='hidden' name='subaction' value='settings_save'>";
        print "<tr>";
        print "<td>" . $objSetting->get('name') . "</td>";
        print "<td>" . $objSetting->getTextField('value') . "</td>";
        print "<td>" . $objSetting->get('comment') . "</td>";
        print "<td>" . $objSetting->getSubmit('Save') . "</td>";
        print "</tr>";
        print "</form>";
        print "<tr><td>&nbsp;</td></tr>";
    }
    print "</table>";
}